[SDL] blitting images onto OpenGL scene

Guilherme De Sousa g_hds at yahoo.co.uk
Sat Dec 2 04:10:37 PST 2006


Hi,

I'm using SDL and OpenGL and I have a question relating to displaying bitmaps. 

I've got a 3d scene with some text drawn on top using freetype (based on NeHe lesson 43 I think). I'm using glOrtho to draw some rectangles over the top and bottom of the 3D scene and my text is being drawn on these areas without any problem.

I'm wanting to place some bitmap images over the display to create items like a status panel and compass but wasn't sure of the best way to do this. Should I render these as textured quads or does openGL have a blit type command for use when working in 2D? I'm really just wanting to keep the bitmaps as they are without any scaling or smoothing.

Thanks for any help.

Guilherme 



----- Original Message ----
From: Sami Näätänen <sn.ml at bayminer.com>
To: A list for developers using the SDL library. (includes SDL-announce) <sdl at libsdl.org>
Sent: Wednesday, 22 November, 2006 6:31:54 PM
Subject: Re: [SDL] 2D above OpenGL graphics


On Wednesday 22 November 2006 15:17, Nuno Santos wrote:
> Hi,
>
> I've tried your code but i dont know what linker option should i use
> to have to get glOrtho2d recognized.

That is his own function or something like that.
The function you should use is glOrtho.

glOrtho( 0, width, 0, height, 0.0, 1.0 );
should be fine.

> I also don't understand what he does. Can you make me a resume?
>
> I putted it in my render function, in the end, just before
> glSwapBuffes
>
> Can you give me some lights here?
>
> Cheers,
>
> Nuno
>
> Em Nov 20, 2006, às 9:43 AM, kuon - Nicolas Goy - 時期精霊
>
> escreveu:
> > Nuno Santos wrote:
> >> Hi,
> >> Yes, i was meaning that! I see!
> >> My first goal in that direction was to include some text above my
> >> scenes! Do you recommend me the same strategy?
> >> Cheers,
> >> Nuno
> >
> > Hoy.
> > Opengl can be a very good 2d api.
> >
> > Just do:
> >
> > glMatrixMode(GL_MODELVIEW);
> > glPushMatrix();
> > glLoadIdentity();
> > glMatrixMode(GL_PROJECTION);
> > glPushMatrix();
> > glLoadIdentity();
> >
> > glOrtho2d(0, screenWidth, 0, screenHeight);
> >
> >
> > glMatrixMode(GL_MODELVIEW);
> > // some 2d drawing like
> >
> > glRasterPos2i(100, 100); // draw at position 100 100 pixel
> > glutBitmapCharacter(GLUT_BITMAP_8_BY_13, 'H'); // Will draw a H at
> > 100 100, for more advanced text handling or if you don't wanna link
> > with glut, check the opengl.org site for font rastering, SDL also
> > provide true type library.
> >
> > glPopMatrix();
> > glMatrixMode(GL_PROJECTION);
> > glPopMatrix();
> >
> >
> > Some tips:
> >
> > Always draw your 2d (interface or anything) AFTER the scene.
> >
> > Disable as much option as you can (man glPushAttrib) like depth
> > test, blending (you need it if image has alpha value), texture,
> > lighting... before drawing the 2d layer.
> >
> >
> > Regards
> >
> >
> >
> > --
> > Kuon
> > CEO - Goyman.com SA
> > http://www.goyman.com/
> >
> > "Computers should not stop working when the users' brain does."
> > _______________________________________________
> > SDL mailing list
> > SDL at libsdl.org
> > http://www.libsdl.org/mailman/listinfo/sdl

_______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


	
	
		
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html




More information about the SDL mailing list