#160587 - FireSlash - Fri Jul 18, 2008 4:28 am
I'm trying to get some text to display on the 3d screen, but I can't get the dimensions to 1:1 in perspective mode, so I'd like to flip into ortho for displaying it. I wrote some code to swap in and out on the fly, but it's not working out so well. Maybe someone knows where I've gone wrong?
The code is supposed to work like this:
// blah blah 3d rendering wee
screen.toOrtho();
fnt_Arial.print("lol text");
screen.toPerspective();
// lol lol lol more rendering weeeeeeeeee
_________________
FireSlash.net
The code is supposed to work like this:
// blah blah 3d rendering wee
screen.toOrtho();
fnt_Arial.print("lol text");
screen.toPerspective();
// lol lol lol more rendering weeeeeeeeee
Code: |
void screen3d::toOrtho()
{ glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho( 0, 255 , 191 , 0, -1, 1 ); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); } void screen3d::toPerspective() { glMatrixMode( GL_PROJECTION ); glPopMatrix(1); glMatrixMode( GL_MODELVIEW ); glPopMatrix(1); } |
_________________
FireSlash.net