View Full Version : Visual C++ release configuration and OpenGL Light problem...

03-22-2003, 08:26 AM
I've been spending a few hours building a little simple solar system in OpenGL using Visual C++.

When I changed to release configuration and compiled, the result suddenly *had no light*. The debug exe still works perfectly, but in the release someone has turned my sun off.

Anyone have any idea what may be causing this?

03-23-2003, 08:02 AM
Hi !

I guess you are causing it....

If you use MFC or so then check your code for TRACE messages...

If you for example have

if( some_expression)
TRACE( blabla);

glEnable( something);

When you compile this code as release code, then TRACE will be gone and the glEnable() will end up after the if statement and your code will behave pretty different, make sure you have { } around such TRACE statements.

That's the most common mistake people make...


03-23-2003, 11:36 AM
Sounds like you do something awkward to the stack. When you compile in "Debug Mode" the Stackpointer will be stored at the begin of every function you write and restored when the function is done. In "Release Mode" that doesnt happen.

You could also try to change the optimization from "Maximize Speed" to "Minize Size" to see if that does make a difference.

03-27-2003, 04:52 PM
One not-so-obvious difference between debug and release modes is: initialization of variables.

Whenever you create a bunch of variables the language/compiler you work with 'may' initialize them to a default value (usually zero) for you in debug mode, but may not do it for you in release mode.

It always helps to initialize all of your variables explicitly, so you know what they 'will be'. That's all I'm going to say. It may be 'obvious' to many seasoned programmers, but this is the 'beginners' forum, so I wouldn't want to 'assume' anything, would you? <like the initial values in your variables?> http://www.opengl.org/discussion_boards/ubb/wink.gif