Hello again. I am creating a spotlight centered in the viewport where 2 texture quads are rendered. As the image shows, only the red cursor is getting the light. I have no idea why the checkerboard isn't receiving the light. They are both rendered the same way.
Here is the code I use to setup the light (I am still experimenting so please correct me if I'm doing something wrong):
Code :GLfloat position[] = { ViewWidth / 2.0f, ViewHeight / 2.0f, 100.0, 1.0f }; GLfloat direction[] = { 0.0, 0.0, -1.0f }; GLfloat color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; glLightfv(GL_LIGHT0, GL_POSITION, position); glLightfv(GL_LIGHT0, GL_AMBIENT, color); glLightfv(GL_LIGHT0, GL_DIFFUSE, color); glLightfv(GL_LIGHT0, GL_SPECULAR, color); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, direction); glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 60.0f); glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 12.0f);
The viewport is orthographic if it matters. So any ideas what's going wrong here?



Reply With Quote