Archived

This topic is now archived and is closed to further replies.

skow

Huh? What? Debug/Relase mode effects lighting? (solved)

Recommended Posts

Ok after 20 hours of frustraition with triing to get litting to work properly I finally figured out me probem. In MS VC++ 6 If i comple in release mode it work! In debugmode it doesn't. This happens when I'm using my .3ds loader (modified off the Gametutoruals.com) That calculates the normals the same way as theirs. I made a program that loads a sphere from .3ds and draws a quadratic sphere. There is a light in the middle of the screen. The quadratic always is lit propperly but below you can see the .3ds one isn't. Debug: debug Release: release I don't get this, i have no debug/release specific code in the program (unless there is somthing im unaware of). Any one know what could be causing this? [edited by - skow on November 15, 2003 5:20:04 PM] [edited by - skow on November 16, 2003 7:33:08 PM]

Share this post


Link to post
Share on other sites
I had similar problems.
Are you sure that your memory managemanet is correct? Do you use delete[] with a pointer you allocated with new type[x]?
Try to debug your code with _CrtCheckMemory() function. Maybe there are some mem leaks in your program.

--------------------------------------------------------

"If it looks good, it is good computer graphics"
"If it looks like computer graphics, it is bad computer graphics"

Corrail
corrail@gmx.at
ICQ#59184081

Share this post


Link to post
Share on other sites
Well it is more than the location of the light that is messed up.

It's kinda hard to explain, the rotations of the object effects the lighting, and the lighting wraps around the whole sphere. I'll just share the simple program so you can see what it does for yourself, and be able to see all the code.

I just modified the 3dloader tutortal from gametutorials to mess around with this (simple is easier to play around with). As my project im working on is made up of 25 source and header files.

Sorry the code is ugly. Here is a link:
1.4 meg zip file

The debug version is in the directory (once unziped). You can hit left twice to stop the orbiting and see how the debuged version still changes as it rotates in place.

left click for wire frame (easier to see the rotation).




[edited by - skow on November 16, 2003 6:48:40 PM]

Share this post


Link to post
Share on other sites
Fixed it...

in this function: void CLoad3DS::ComputeNormals(t3DModel *pModel)

find the code that goes something like...


//////////////// Now Get The Vertex Normals /////////////////

CVector3 vSum;
CVector3 vZero = vSum;
int shared=0;


and change it to...


//////////////// Now Get The Vertex Normals /////////////////

CVector3 vSum;
vSum.x = 0.0f;
vSum.y = 0.0f;
vSum.z = 0.0f;
CVector3 vZero = vSum;
int shared=0;


It was a variable initialization problem. Release mode caught it, debug didn''t.

Share this post


Link to post
Share on other sites