debug lighting vs release lighting

i have a very weird problem, with the following code which render a simple landscape

	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	land.Render(frustumhelper, draw_debug);
	{
		GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
		GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
		GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
		//GLfloat light_position[] = { 1.0f, 1.0f, 1.0f, 0.0f };
		GLfloat light_position[] = { 0.0f, 0.0f, 1.0f, 0.0f };

		glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
		glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
		glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
		glLightfv(GL_LIGHT0, GL_POSITION, light_position);
	}
	glDisable(GL_LIGHTING);


in release mode, lighting is correct however in debug mode the landscape doesn’t lit at all : full dark !!

any hint about this behaviour ??
thanks for the help.

Do you have any ASSERTs, cause if you do, they may be the problem…

Yes, check all TRACE and ASSERT lines, one typical problem is if you have:

if( … )
TRACE( …);

This will break in release mode, you must use:

if( … )
{
TRACE( … );
}

Mikael

Then sit down and debug what’s the difference in OpenGL calls for both paths.
You’re setting the lighting parameters after you have rendered the frustum helper(?).
If the frustum helper has modified the modelview matrix, the light position is transformed by the current modelview matrix.

Then sit down and debug what’s the difference in OpenGL calls for both paths

there is no difference between the debug and release code :slight_smile:

You’re setting the lighting parameters after you have rendered the frustum helper(?).
If the frustum helper has modified the modelview matrix, the light position is transformed by the current modelview matrix.

actually the frustumhelper modify nothing, it just compute the 6 planes (normal and distance values) so the light is till tied to the modelview matrix before frustum operation.

however the debug version works great now. it seems it’s another compile problem :frowning: but i’m sure sure i did many rebuild all (using vc 6)…
weirdo.

thanks for your replis guyz :wink: