Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

logout

othomode and 2d text ?

This topic is 5277 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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*

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

//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();

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!