Change view

Started by
2 comments, last by r_bewick 13 years, 5 months ago
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
Advertisement
Change your projection matrix to orthographic mode.

glOrtho() or gluOrtho()
Hi.
You need to change the projection matrix to map (-1,-1) to (1,1) to your screen coordinates.

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();


[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
thanks :)

This topic is closed to new replies.

Advertisement