***icons and text on screen***
is the following the best way to display text i.e high score and number of lives etc on my screen? i have a 3d game viewed from a fixed perspective so really its 2d but with 3d models and i need to display high score:
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f );
glMatrixMode( GL_MODELVIEW );
glBindTexture( GL_TEXTURE_2D, radarIDTexture );
glEnable( GL_TEXTURE_2D ); //enable your bitmaps texture
glDisable( GL_LIGHTING ); // disable lighting
glDisable( GL_DEPTH_TEST ); // disable depth testing
// White is a great color for material to texture
glColor3f( 1.0, 1.0, 1.0 );
// draw a quad to texture with
glBegin( GL_QUADS );
glTexCoord2f( 0.0, 0.0 );
glVertex2f( 0.0, 0.0 );
glTexCoord2f( 1.0, 0.0 );
glVertex2f( 0.3, 0.0 );
glTexCoord2f( 1.0, 1.0 );
glVertex2f( 0.3, 0.2 );
glTexCoord2f( 0.0, 1.0 );
glVertex2f( 0.0, 0.2 );
glEnd( );
Then.....destroy the ortho projection similar to lazork357' s approach
and disable glBlend
Also, in your init() function set up for blending :
glEnable(GL_BLEND);
// give blending translucensy to your bitmaps by calling this function
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
is this the best way to do it and does this just get done within a method? where should i call the method from? also is there anywhere i could find for instance a texture for the radar? are there code examples of games where something similar has been done?
thanks, sorry for all the questions but i am a newbie
Hi,
I would push the projection matrix before you go to ortho. That way all you have to do to switch back to projection is pop the matrix. Check out the font system I implemented on this thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=290348
You're going to have to do a bit of digging to find the source tree ect (proly on page 7). There are also a few other subsystems that you might be interested in like:
- texture loading
- 3d sound
- model loading
Cheers,
- llvllatrix
I would push the projection matrix before you go to ortho. That way all you have to do to switch back to projection is pop the matrix. Check out the font system I implemented on this thread:
http://www.gamedev.net/community/forums/topic.asp?topic_id=290348
You're going to have to do a bit of digging to find the source tree ect (proly on page 7). There are also a few other subsystems that you might be interested in like:
- texture loading
- 3d sound
- model loading
Cheers,
- llvllatrix
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement