2d Radar bitmap

Hello

I can put up a bitmap up on the screen with the following code, but, It’s not 2d. It’s 3d… and when my first person walks up “very close” to other 3d objects in the scene, the bitmap will get clipped and partially obscured by them.

This doesn’t happen with text I put up on the screen, like, frame counters ect.

I’m weaving in and out of the projection and modelview matrices pretty much in the same manner in my renderScene() function in both cases.

So, I was wondering if somebody had some ideas about making my bitmap “truly 2d”.

Thanks in advance

Radar

This is really 3d and not 2d:
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f );
glMatrixMode( GL_MODELVIEW );

// Strange…I have to enable depth testing or it will get drawn behind all other objects.
// When I draw text to the screen i disable depth
//testing to draw it on top of everything.

//glDisable( GL_DEPTH_TEST );
glEnable(GL_DEPTH_TEST);

glColor4f(1.0f, 1.0f,0.0f, 1.0f); // yellow glBegin( GL_QUADS );
glVertex2f( 0.0, 0.0 );
glVertex2f( 0.3, 0.0 );
glVertex2f( 0.3, 0.2 );
glVertex2f( 0.0, 0.2 );
glEnd( );

glMatrixMode( GL_PROJECTION );
glLoadIdentity();

gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,1000.0f);
glMatrixMode( GL_MODELVIEW );

Best bet is to use glOrtho mode after drawing everything else. Then draw your 2D radar bitmap at depth = 0 (ok for ortho mode) and any other stuff which needs to be part of an overlay of the 3D scene .

Ok. , thanks for your input.

I ended up combining the render text and draw bitamp sections into one and left them where render text was…which was after all other 3d stuff got drawn.

Now the bitmap is truly 2d just like the text had been all along…and does’nt get clipped by other objects neither!

Made it semi-transparent too with that :

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

thanks again…Problem fixed.