user1235872
user1235872

Reputation: 275

How can i draw a model on front screen in opengl

I want to draw a logo(3D awards) at the corner of the window(fixed position when change camera)

Upvotes: 0

Views: 1275

Answers (2)

fen
fen

Reputation: 10115

here is my code for drawing fullscreen rectangle (in old opengl)

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

glBegin(GL_QUADS);
glTexCoord2f( 0,0 );
glVertex3d( -1.0,-1.0, 0 );
glTexCoord2f( 1,0 );
glVertex3d(  1.0,-1.0, 0 );
glTexCoord2f( 1,1 );
glVertex3d(  1.0, 1.0, 0 );
glTexCoord2f( 0,1 );
glVertex3d( -1.0, 1.0, 0 );
glEnd();

glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();

just disable depth buffer abd set the texture to be able to draw your logo in front of eferything Of course you can change the position and the size of it

Upvotes: 1

Tim
Tim

Reputation: 35933

Could do it like so:

  1. Draw your scene
  2. Disable the depth test (or clear the depth buffer if you need self-depth testing to draw the model correctly)
  3. Set a new matrix on the stack which ignores camera position.
  4. Draw the logo.

Upvotes: 1

Related Questions