Hi, I am new to OpenGL and was wondering how to change the view from drawing 3d to drawing 2d text and back again. (so when I draw 2d (-1,1) will be top left and (1,-1) will be bottom right)
Thanks,
r_bewick
Change view
You need to change the projection matrix to map (-1,-1) to (1,1) to your screen coordinates.
Something like:
Something like:
glMatrixMode(GL_PROJECTION);gluPerspective(...);glMatrixMode(GL_MODELVIEW);...render 3d scene...glPushMatrix();glLoadIdentity();glMatrixMode(GL_PROJECTION);glPushMatrix();glLoadIdentity();glOrtho(-1,1,1,-1,-1,1);glDisable(GL_DEPTH_TEST);...draw text...glEnable(GL_DEPTH_TEST);glPopMatrix();glMatrixMode(GL_MODELVIEW);glPopMatrix();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement