[SDL] 2D above OpenGL graphics

Nuno Santos developer at imaginando.net
Wed Nov 22 17:10:57 PST 2006


Ok,

I now got something, but my 3D gets very weird and almost doest shows  
up.

I would love to have this font rastering on while the 3D stuff is  
under it.

Is it possible?

I also don't know what is happening with that code.

This is what i got:

void renderScene(void) {
	glClearColor(0.0f,0.0f,0.0f,0.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	eyeX = sin(angle);
	eyeZ = -cos(angle);
			
	glLoadIdentity();
	
	gluLookAt((eyeX*c.ex)*zoom,c.ey+eyeY,(eyeZ*c.ez)*zoom,
			c.cx,c.cy,c.cz,
			0.0f,1.0f,0.0f);
				
	
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glLoadIdentity();
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();

	glOrtho( 0, 640, 0, 480, 0.0, 1.0 );


	glMatrixMode(GL_MODELVIEW);
	// some 2d drawing like

	glRasterPos2i(50, 50); // draw at position 0 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();
	
	
	glutSwapBuffers();
}



Em Nov 22, 2006, às 6:31 PM, Sami Näätänen escreveu:

> glOrtho( 0, width, 0, height, 0.0, 1.0 );

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061123/bc5bee28/attachment.htm 


More information about the SDL mailing list