Advertisement

Fixed-Positioned Text (based on Tutorial 13)

Started by February 22, 2003 07:28 AM
7 comments, last by MarvinTheRobot 22 years ago
i´m trying to use tutorial 13 to output some text in my game. the player can zoom in and out during the game, but the text should remain at the bottom of the screen. however, it always goes to the middle of the screen when i zoom out, and out of the screen when i zoom in... is there a way to change that?
use ortho mode
Advertisement
even if he uses ortho mode it''ll still scale..
you need to do this:
// do your scaling, then
glPushmatrix();
glLoadIdentity();
// draw your text
glPopMatrix();
-eldee;another space monkey;[ Forced Evolution Studios ]
quote:
Original post by eldee
even if he uses ortho mode it''ll still scale..

it won''t if you always specify the same sizes for the ortho matrix.
quote:
Original post by eldee
even if he uses ortho mode it''ll still scale..
you need to do this:
// do your scaling, then
glPushmatrix();
glLoadIdentity();
// draw your text
glPopMatrix();


that doesnt work... first it didnt compile because that function is called glPushMatrix, but even after i renamed it it didn´t draw any text on the screen.

and i didn´t get that with ortho-mode, i´m rather an opengl-beginner.

quote:
Original post by MarvinTheRobot

that doesnt work... first it didnt compile because that function is called glPushMatrix, but even after i renamed it it didn´t draw any text on the screen.

and i didn´t get that with ortho-mode, i´m rather an opengl-beginner.




well i dunno what to tell you... i''m using it right now

-eldee
;another space monkey;
[ Forced Evolution Studios ]

::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

-eldee;another space monkey;[ Forced Evolution Studios ]
Advertisement
maybe it´s because i´m not using matrices in the rest of the program... should i create a matrix before using pushMatrix and popMatrix? and if yes, how can i do that? (i´m not into matrices with opengl yet)
just to check something really silly, you did translate after the glLoadIdentity()? like this:


  // the rest of your drawingglPushMatrix();    glLoadIdentity();    glTranslatef(-1.0f, -1.0f, -10.0f); // or whatever your values are    // draw textglPopMatrix();  
no, didn´t translate... now it works, thanks

This topic is closed to new replies.

Advertisement