othomode and 2d text ?

Started by
2 comments, last by logout 20 years, 2 months ago
Does anyone know why my drawing code does not work with ortho mode ?

// move one unit into the screen
				glTranslatef(0.0f, 0.0f, -1.0f);

				glColor3f(1.0f, 1.0f, 1.0f);
				glRasterPos2f(-0.35f, 0.0f);

				glColor3ub(255,255,255);

				glPushAttrib(GL_LIST_BIT);
					glListBase(m_uFontStart - 32);
					glCallLists(strlen(str), GL_UNSIGNED_BYTE, str);
				glPopAttrib();
 
And how can i get it to work with ortho mode ?? *yes, it does work without orthomode*
Advertisement
Post the code you use to setup an orthographic projection. I suspect the problem will be the glTranslatef line. Try taking it out.

Enigma
	//from CoMaNdore	int vPort[4];	glGetIntegerv(GL_VIEWPORT, vPort);	glMatrixMode(GL_PROJECTION);	glPushMatrix();	glLoadIdentity();	glOrtho(0, vPort[2], vPort[3], 0, -1, 1); // CoM   	glMatrixMode(GL_MODELVIEW);	glPushMatrix();	glLoadIdentity(); 
As I thought, everything is being culled by the near clip plane. Your orthographic projection specifies a near clip plane of -1 and a far clip plane of 1. You translate by -1 on z, bringing your polygons right onto the near clip plane.

EDIT: also, you're going to quickly overflow your matrix stacks unless you pop those matrices you push.

Enigma.

[edited by - Enigma on February 8, 2004 11:52:33 AM]

This topic is closed to new replies.

Advertisement