# OpenGL opengl fonts

This topic is 4878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is there a way using the nehe tutorial on fonts to draw a screen font NOT affected by lighting ? Mine dissapears when I move behind it or something.

##### Share on other sites
glDisable(GL_LIGHTING);

##### Share on other sites
i realize the greater problem is in fact that while my view changed using gluLookAt, the light still seems to come from the same place, when I rotate around something, i should see its dark side, and I don't. Any thoughts ?

##### Share on other sites
Because the light is always in the 'same spot', and is moving with the view. Like a video camera with a light on it.

Are you drawing 3d letters, and you want to be able to see the backside? Be more specific.

If you are rending 2d text over a scene, you always want the lights off, as well as texturing (unless you use it for the letters).

##### Share on other sites
Ya you've kindof got what I'm saying. My view is like im holding a flashlight or something. Thats not how I want the scene to be rendered. i want the light to be stationary so that as I rotate around these little 3d boxes and 3d text i have, that at some point I see the back (dark) side of them. Is that what the CameraClass on NEHE's site is about or will gluLookAt still work ? I ask only because I did SO MUCH work with spherical coordinates and such that I feel like I should keep using it.

##### Share on other sites
You've got to think of the light positions as you think of the positions of other objects in the scene - if you want them to be affected by a transformation of some kind, you set the light's position after you've set the transformation.
So what you do is you that you set the light position (with glLight*v) after you've done the viewing transformation (e.g. with gluLookAt.) Of course you need to do this every frame for it to work :)
(The same goes for light direction)

##### Share on other sites
The problem is that your modelview matrix seted up by gluLookAt affects the position of your light. So you should put light before gluLookAt, such as:

LightPosition(x, y, z);gluLookAt(...);

##### Share on other sites
Repositioning the light each frame.. is that the preferred way of doing it ? or is that inefficient ?

##### Share on other sites
Quote:
 Original post by harnacksRepositioning the light each frame.. is that the preferred way of doing it ? or is that inefficient ?

Setting the light every frame is more inefficient that not setting it every frame, yes. The cheapest operation is the one you don't have to do, you know. But if you want the light position to be affected by the modelview matrix, then you don't have a choise but to set it after the modelview matrix is set, which usually means every frame.

##### Share on other sites
Basicly, lights work like any other object with a position. They get rotated and translated with the rest of the objects. If you want the light to follow an object that is rotating, you must set the light position along with the rotation, not before.

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632961
• Total Posts
3009489
• ### Who's Online (See full list)

There are no registered users currently online

×