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

Started by
7 comments, last by skow 20 years, 5 months ago
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]
Advertisement
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
--------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened...
Or maybe you did something like...

ASSERT(a++);

In debug assert would compile but in release it wouldnt nd so you get different results.
Nope, no memmory leaks.

I have no asserts no #if _DEBUG

The only noticible difference seems to be the lighting on the ball on the right. Post some code and we''ll see what screws up.
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]
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.

Ahhhh that happened to me too once, what a pain in the butt... I don''t think Debug Mode is doing anyone any favors by initializing things for us...

-Andrew
Doh, I re wrote the normal funcion like 3 times.

I usually use my own 3d vector function that i have a constructor that initalizes.

Thanks a ton.

This topic is closed to new replies.

Advertisement