Archived

This topic is now archived and is closed to further replies.

Gandalf

OpenGL SpotLights OpenGL

Recommended Posts

glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, LightDirection); glLighti(GL_LIGHT0, GL_SPOT_CUTOFF, 90); glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1); glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0); glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0); Which values to choose to get a "normal" spotlight? Gandalf the White

Share this post


Link to post
Share on other sites
How to create a decent spotlight in OpenGL? All my objects turn dark. I´m sure about the direction but not so sure about GL_SPOT_EXPONENT and the attenuation params. I set the angle to 90 degree. Nothing happend. Darker then coffe.

Please help, OpenGL wizard out there!

Gandalf the White

Share this post


Link to post
Share on other sites
bad reply but one nonetheless:
read the OpenGL programming guide (aka red book) version 2 (about OpenGL1.2)
It must be available online.

I''ll check that these evening I''m just to tired to answer now.

You will get my answer only tomorrow, sorry.

-* Sounds, music and story makes the difference between good and great games *-

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Your object might have too few vertices, and your spotlight might not be caught by any of them, thus everything is dark. Mark Kilgaard had an article on Opengl.org on the 16 most common OGL mistakes, and this was one of them.

Share this post


Link to post
Share on other sites
I don´t think sow. I have 100 objects. Every objects is build by 24 vertices. That makes 2400 vertices.

Gandalf the White



Edited by - Gandalf on June 16, 2000 4:02:34 AM

Share this post


Link to post
Share on other sites
It´s a hard problem. I don´t think I can solve it this time. I really need help.

In D3DIM everything works fine. I get the result I want: A spotlight moving up and down, eluminating a circle. Everytning else is almost black. But The weird thing is I have tried to set up exactly the same scene in D3DIM and OpenGL. Same lightsource, direction, position, angle. Same number of vertices, same polygon type (triangle strip), texture (also tried wihout textures) and same perspective (nearClipPlane and nearClipPlane is same). Everyhing turns coffe black in OpenGL!

Please, please... I´m dying over here!

Gandalf the White



Edited by - Gandalf on June 16, 2000 6:26:56 AM

Share this post


Link to post
Share on other sites
Jabadabadoooooooooooooooooooooooooooooooooooooo!

Bad Monkey, I fix it, all thanks to you!

Never play with the GL_PROJECTION matrix.


Gandalf the White

Share this post


Link to post
Share on other sites