weird obj-loader behaviour

Started by
5 comments, last by deathkrush 16 years, 2 months ago
hello, i have a quite normal OpenGL/C++ game which occasionally has two weird behaviours 1. models i have in the game are in the *.obj format and they have all their vertices of one half in the infinity. so all the objects look like they are stretched to infinity on one half. this does not happen in debug mode but only in release mode. 2. i use framebufferobjects to render a mirror. however certain objects in the mirror look different from the "real" ones. they have other geometry and they have very heavy z-fighting artifacts. but i am sure i am calling the same rendering-functions for the framebuffer as for the "real" scene. however i just render my scenegraph, where all the objects reside, again. thanks for any help! [Edited by - ehmdjii on February 16, 2008 8:20:09 AM]
Advertisement
anyone?

i really can't understand why it works in RELEASE mode and why not in DEBUG mode.

thanks a lot!
When something works in Release mode, but not in Debug mode, or vice versa, the most common cause are unitialised variables.

So I would check for those.

Furthermore I'd check for buffer over- and underruns.

For the Z fighting, check your geometry and check your near and far clip planes.

If you need more help, you have to provide more information.

Your memory is getting trashed. The stretch into infinity or center happens when data corruption occurs.

You didn't mention the compiler, but MSVC adds overflow guards to all arrays. What happens is that somewhere in your code you're reading past the properly initialized array values, and that causes visual artifacts, since your coordinates are actually memory guards.

In release mode, this things just happen to be initialized to zero or some sensible value.
thank you very much for your help!
yes the compiler is MSVC (VS2005).

so is there any other way to check for uninitialized variables other than stepping through the code with the debugger?

thanks!
Well, this isn't very helpful as an afterthought, but you should establish the habit of initializing variables when they're declared. It saves you the kind of hassle you're looking at right now. Otherwise, would it be too much effort to go through your code and set a default value at the declaration? Copy/paste "= 0" or some such. It'd be tedious, but it wouldn't take too long, and you could narrow it down to your object loader or whatever for starters.

GDNet+. It's only $5 a month. You know you want it.

Quote:Original post by ehmdjii

so is there any other way to check for uninitialized variables other than stepping through the code with the debugger?



Yes, there is. Crank up the warning level to "/W4" and add "/Wall" switch to compiler command line options. Watch out for "variable used uninitialized" warnings. The default warning level "/W3" might already catch uninitialized variables, but who knows what else you might find with "/W4 /Wall".
deathkrushPS3/Xbox360 Graphics Programmer, Mass Media.Completed Projects: Stuntman Ignition (PS3), Saints Row 2 (PS3), Darksiders(PS3, 360)

This topic is closed to new replies.

Advertisement