GL_SPOT_EXPONENT and GL_SPOT_CUTOFF not working on Mac OSX

Started by
1 comment, last by floatingwoods 12 years, 1 month ago
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
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.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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)

This topic is closed to new replies.

Advertisement