Sign in to follow this  
PaxNoctis

Multiple Light Sources

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this