PDA

View Full Version : Text, fonts



sergey
11-26-2002, 09:08 AM
Hi, i'm quite new to OpenGL. I was wondering if it's possible to display a message using an gl.... or glut.... function.
if it is possible could some one advice me how to do it!

Thanx a lot.
PS: I have this idea of drwaing a "heart" in 3D. could someone point me in the right direction of how to draw it?
Thanx again.

zen
11-26-2002, 09:17 AM
There are glut functions for drawing text.Take a look at the glut specification for more info(can be found in the developer documentation section here on opengl.org).Also in opengl.org to right you'll find this link: http://www.opengl.org/developers/code/features/fontsurvey/index.html for further info on opengl font rendering.

nexusone
11-26-2002, 10:22 AM
If you want to use simple text, the is a glut function glutBitmapCharacter.


examples of the usage on my website:
http://www.angelfire.com/linux/nexusone/index.html

Music_Man
11-26-2002, 11:16 AM
What you can use is: (this is in java, you will need to change bits for 'C' i.e. remove the preceeding gl. on all the gl commands and maybe some other bits):

//methods for displaying strings on the screen (in 2 different font sizes)
public void RenderStringSmall(String renderStr, double x, double y){
gl.glColor3f(1,1,1);
gl.glRasterPos2d(x, y);
glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN _10, renderStr);
}

public void RenderStringLarge(String renderStr, double x, double y){
gl.glColor3f(1,1,1);
gl.glRasterPos2d(x, y);
glut.glutBitmapString(glut.GLUT_BITMAP_TIMES_ROMAN _24, renderStr);
}

And then call it i.e.:

RenderStringLarge ("Press n to start a new game", 175, 240);


(Robbed from my space invaders game I did some time last year)

Hope this helps

Music_Man :-)