Archived

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

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

This topic is 5391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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: 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 on other sites
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 on other sites
Or maybe you did something like...

ASSERT(a++);

In debug assert would compile but in release it wouldnt nd so you get different results.

Share on other sites
Nope, no memmory leaks.

I have no asserts no #if _DEBUG

Share on other sites
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.

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 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 on other sites
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

Share on other sites
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.

1. 1
2. 2
JoeJ
16
3. 3
4. 4
5. 5
frob
11

• 13
• 16
• 13
• 20
• 12
• Forum Statistics

• Total Topics
632178
• Total Posts
3004606

×