Jump to content
  • Advertisement

Archived

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

Crypthor

OpenGL OpenGL ( displaying text ) question ?

This topic is 6727 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

Hi, i need your help with text displaying ( HUD drawing ) This steps are correct ? 1. DrawScene 2. ( turn off DepthTest ) 3. draw text 4. turn back DepthTest on In my programm texts displaying offscreen ! When i''m using glVertex2f( x, y ); x: (-1.0f ; 1.0f ) here is question : if x == -1.0f ( the screen coord. should be equal 0) and if x == 1.0f ; screen coord = 640, why this isn''t work. The screen X in case of x == -1.0f going off screen, why ? how to set that ( -1.0; 1.0 ) will be equal to ( 0; 640; )?? tnx !

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I think you should setup a 2d projection before drawing the hud, and the set it back to 3d again. It looks sometinhg like this:
[its the code i use]
XRES and YRES are global variables.
void SetIn2d()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, XRES,YRES,0, -99999, 99999);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE);
}

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!