Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Opengl Fonts and glRasterPos2f

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
7 replies to this topic

#1 q2guy   Members   

122
Like
0Likes
Like

Posted 09 January 2005 - 06:49 AM

Exists an easy way to tell opengl where to put text on screen ?, I am using display list and HFONTs, and then I have to use glRasterPos2f to put text on a screen position. I want something easy, user friendly, based on window height and width, like this: PrintGL(FontList, win.height / 2, win.width / 2, "Hi world"); so it begin putting in window center the H letter. thanks

#2 Fen   Members   

882
Like
0Likes
Like

Posted 09 January 2005 - 07:07 AM

what can I say... hmmm...
just read one from the NeHe tutorials

you can find information about fonts in 13th, 14th, 15th and 17th lesson

NeHe

when you read them you will be able create very nice pice of code... For example you will have glPrint function that works not only with 2d bitmap fonts but also with full 3 dimensional fonts! the lessons are great!

good luck :)

Se my programming blog: Code and Graphics


#3 ff8   Members   

134
Like
0Likes
Like

Posted 09 January 2005 - 07:11 AM

try to glOrtho() and glTranslate*()like this

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0,win.width,0,win.height,-1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslated(X,Y,0);
PrintGL("Hi world");
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();



bye! :)

#4 q2guy   Members   

122
Like
0Likes
Like

Posted 09 January 2005 - 07:12 AM

I have read the nehe tutorials, I only ask one thing, easy of use in positioning text.

#5 ff8   Members   

134
Like
0Likes
Like

Posted 09 January 2005 - 07:42 AM

do you print the letters one after one ??

#6 q2guy   Members   

122
Like
0Likes
Like

Posted 09 January 2005 - 07:53 AM

I call the display lists:
glCallLists(strlen(text),GL_UNSIGNED_BYTE,text);


#7 ff8   Members   

134
Like
0Likes
Like

Posted 09 January 2005 - 11:09 AM

i think you can control the position easy by your function.


#8 q2guy   Members   

122
Like
0Likes
Like

Posted 09 January 2005 - 11:48 AM

Thanks, I have solved, thanks to ff8 code and "Avoiding 16 Common OpenGL Pitfalls" article.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.