Click to See Complete Forum and Search --> : OpenGL 3D Text


jteagle@home
April 16th, 1999, 03:18 PM
I am just starting out in OpenGL, and it is going pretty well. I am using wglUseFontOutlines() to create 3D text, and I have managed to display it at an angle, in a big Comic Sans MS font. Wonderful.

The problem is that the face of the text has no edge, and the object is all the same colour. Is there a way or trick to get an edge to the face of the letters so that you can tell which is the front or back and which is the side, and is it possible to get the sides a different colour from the faces? Any way, official or hacked, will do.

If you don't understand what I'm getting at, take a look at the Windows '95 OpenGL text screensaver - those letters have distinct edges.


_ _
o o Jason Teagle
<
v jteagle@geocities.com

jricks
April 28th, 1999, 01:55 PM
Jason,

Try using OpenGL lighting... I assume that you're not yet. That would explain why everything's the same color and you can't distinguish edges.

call wglUseFontOutlines(...) with WGL_FONT_POLYGONS as the format argument. From the sound of your post, you're doing this already.

The wglUseFontOutlines help page recommends using


glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);



because of the way wglUseFontOutlines orders the vertices.

You can figure out lighting by looking at any exmaple program that uses lighting.

or you could look here:


GLfloat ambient[] = {0.0, 0.0, 0.0, 1.0};
GLfloat diffuse[] = {1.0, 1.0, 1.0, 1.0};
GLfloat specular[] = {1.0, 1.0, 1.0, 1.0};
GLfloat position[] = {1.0, 1.0, 1.0, 0.0};

glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glLightfv(GL_LIGHT0, GL_POSITION, position);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

drawTextAsYouWere();

glDisable(GL_LIGHTING);




Hope this helps,

Jeff