Jump to content
  • Advertisement
Sign in to follow this  
Aidamina

OpenGL GLlight and GLlookat versus GLtranslate

This topic is 5027 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

Well i got two questions and i decided to post em in one thread but they are completely different from each other. Question one: How do the GLlight functions work. I've read a lot of articles about them, but none of them explained me how the light points work eg. when i set the position of the light is it a point which radiates to every side, or is it a beam. And is there a limitation how far the light extents in an opengl app. Question two: At the moment im using gltranslate to move around in a 3d application i am writing. This works ok, but i was wondering if GlLookat would be better or would give better performance, enlighten me. Slap me if these are noob questions :D Greetz Aidamina PS I'm sorry for my crappy English

Share this post


Link to post
Share on other sites
Advertisement
Google always helps, even if you have to look in odd places. I found this assignment rather useful when it came to figuring out exactly what everything was, and I'm pretty sure it'll help you figure it out too.

As for the gluLookAt problem, it all depends on your needs. For something like cameras, I personally see it as a static camera, which would change as you switched rooms, always pointing at the main character, or a camera on the side of a track that follows a car that goes racing by. With a few more modifications you could turn it from this into a 'look-from' camera (as used in FPS games, looks from some position at some position that can be calculated from the rotations on the 3 axiis), or even a 'look-at-3rd-person' camera (which sits behind the character at some distance, where the now 'look-from' position can be calculated the same way the normal 'look-from' camera is). On the other hand, if you just want something simple (like an over-head view of a city/landscape), translating the position is more than enough.

Share this post


Link to post
Share on other sites
Thx Gorax

That was a great reference, but this leaves me with a few questions:

Quote:
And is there a limitation how far the light extends in an opengl app.


And i know which one is the easiest. I'm just wondering which one will give the best performance asin framerate.

Greetz,
Aidamina

Share this post


Link to post
Share on other sites
Quote:
Original post by Aidamina
Thx Gorax

That was a great reference, but this leaves me with a few questions:

Quote:
And is there a limitation how far the light extends in an opengl app.


Lights extends to infinity. You can set some attenuation factors to attenuate the light over distance, but they will never fade completely.

Quote:

Original post by Aidamina
And i know which one is the easiest. I'm just wondering which one will give the best performance asin framerate.

Greetz,
Aidamina

They just create a matrix which is passed to OpenGL. How it was created doesn't matter, it's just a set of numbers to OpenGL, and different functions are just different ways of generating these numbers.

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!