Jump to content
  • Advertisement
Sign in to follow this  
harnacks

OpenGL opengl fonts

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by harnacks
Repositioning 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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!