Jump to content
  • Advertisement
Sign in to follow this  
floatingwoods

OpenGL GL_SPOT_EXPONENT and GL_SPOT_CUTOFF not working on Mac OSX

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

Hello,

I have a cross-platform application that was first running on Windows. I ported it to Mac (using the Qt framework) and kept all the OpenGL routines same. Everything works as expected on Mac now, except for the spotlights.

It seems as if the command

glLighti(GL_LIGHT0+activeLightCounter,GL_SPOT_EXPONENT,spotExponentValue);

has no effect at all (i.e. behaves as with a spotExponent of 0 (default)). I tried values between 0 and 128, but nothing changes.

Additionally, following command

glLightf(GL_LIGHT0+activeLightCounter,GL_SPOT_CUTOFF,spotCutoffValue);

behaves strangely on Mac OSX: varying the value between 0 and 90, it seems that the visible cutoff is always around 10-20 degrees or so, and instantly goes to 180 degrees when I specify a value of 90!

This is very odd to me. Would someone have a clue? I need to mention that this happens on all tested Mac machine types (3) and OS versions (leopard, snow leopard and lion).

Is it possible that on Mac there are different default openGl settings? And if yes, which of those might influence the spotlights? (everything else appears same as on Windows).

Thanks for any insight

Share this post


Link to post
Share on other sites
Advertisement
Spot lights behave as point lights so fr their position, make sure that you provide a valid xyzw position. By that, I'm means that w should always be 1.0.
The direction of the spotlight, I don't remember if it was xyz or xyzw. If it takes a w, then w must be set to 0.0.

I'm not a Mac programmer but I know that they have a mailing list, in case you need to let them know about the bug you found.

Share this post


Link to post
Share on other sites
Thanks for the reply V-man.

I could fix my problem, I guess there is a bug in the Mac implementation. Following is what I noticed (Mac only):

- with a spot cutoff of 90, the spot exponent cannot be changed (i.e. appears to be 0)

- glLighti(GL_LIGHT0,GL_SPOT_EXPONENT,spotExponent); doesn't work

- glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,float(spotExponent)); works, but only if the spot cutoff is lower than 90 (see point 1)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!