Sign in to follow this  

weird obj-loader behaviour

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
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!

Share this post


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

Share this post


Link to post
Share on other sites
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".

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this