• Advertisement
Sign in to follow this  

Multiple Light Sources

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

So, I wrote a very basic 3d engine at work today. Basically, it's Final Fantasy Tactics style graphics, with textured, 3D tiles in a 3dimensional grid. So far so good... Problem is, I can't get more than one light source to work. For example: LightPosition[0] = 0.0f; LightPosition[1] = CUBE_SIZE; LightPosition[2] = (CUBE_SIZE * 1.75f); glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); glEnable(GL_LIGHT0); Works fine. Adding: GLfloat pos2[] = {1.5f, 0.3f, 0.5f, 1.0f }; glLightfv(GL_LIGHT1, GL_POSITION, pos2); glEnable(GL_LIGHT1); Doesn't work, though. It will only show the first light. What am I doing wrong? Thanks =). ~Pax

Share this post


Link to post
Share on other sites
Advertisement
For some unknown reason, the default OpenGL state for lights is different for the first light compared to all the other lights. IIRC, anything other than light0 has a default colour of black (ie. invisible), and probably no set position/range/direction etc. Try explicitly setting as much light state as you can.

Share this post


Link to post
Share on other sites
Wh00tage!

Thanks a ton dude. That did it. Wierd bug, but heck, those are the fun ones.

It's amazing the amount of code that can be quickly prototyped and implemented with OGL.

~Pax

Share this post


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

  • Advertisement