Jump to content
  • Advertisement
Sign in to follow this  
JJFMJR

OpenGL 2D Texturing Error

This topic is 3477 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

I've been working on a 3d gaming application using the OpenGL API. Anyways, I'm getting a strange error with texturing. I have a model that contains only material data for lighting. The model draws perfectly well, but prior to drawing the wall I draw a skybox which is textured. So I turn on texturing, draw the skybox, turn off texturing, and draw the model. However, on random compiles, my model will draw with a certain portion being textured with one of the skybox's (Or so it looks like) textures, messing up the visual effects. It only happens every few times or so, but I'd like to see if anyone can give a valid reason for this mishap. Info: I'm using Win32 and OpenGL APIs in the Codeblocks IDE. The real interesting part is, when setting the build target in my IDE to "Debug", the above occurs. However, if I set the build target to "Release", the above occurs every time, meaning the model is messed up 100% of the time. I'm fairly comfortable using OpenGL, but can't seem to figure out why it would behave like this. If anyone can lend some information, I'd greatly appreciate it :). Thanks for your time.

Share this post


Link to post
Share on other sites
Advertisement
If I had to guess, I'd say that you've introduced undefined and/or non-deterministic behavior somewhere in your program (for example, an uninitialized variable). This sort of problem can lead to different behaviors depending on the build settings, just like what you've described.

Perhaps you could post the code you're using to set up the rendering state for the model and to render the model.

Share this post


Link to post
Share on other sites
Quote:
Original post by JJFMJR
I've been working on a 3d gaming application using the OpenGL API. Anyways, I'm getting a strange error with texturing. I have a model that contains only material data for lighting. The model draws perfectly well, but prior to drawing the wall I draw a skybox which is textured. So I turn on texturing, draw the skybox, turn off texturing, and draw the model. However, on random compiles, my model will draw with a certain portion being textured with one of the skybox's (Or so it looks like) textures, messing up the visual effects. It only happens every few times or so, but I'd like to see if anyone can give a valid reason for this mishap.

Info: I'm using Win32 and OpenGL APIs in the Codeblocks IDE. The real interesting part is, when setting the build target in my IDE to "Debug", the above occurs. However, if I set the build target to "Release", the above occurs every time, meaning the model is messed up 100% of the time. I'm fairly comfortable using OpenGL, but can't seem to figure out why it would behave like this. If anyone can lend some information, I'd greatly appreciate it :). Thanks for your time.

I agree to what jyk has mentioned. I feel the OpenGL state machine is messed up somewhere. I usually do the following assertion in my rendering code to check the status of the error bit to make sure that the state machine is ok.

GLuint error = glGetError();
assert(error == GL_NO_ERROR);



Hope this helps,
Mobeen

Share this post


Link to post
Share on other sites
yeah I thought the exact same thing, a variable initialized incorrectly. Have been searching for a while, haven't seemed to find it yet. I have been looking at the modeling class I wrote to draw the model. It loads it from a custom file that I'm using. I've had some strange problems with creating the file holding the model data in a different program. I'm thinking that it may be loading incorrectly. I'll keep looking, thanks :). Can't be too many reasons to cause this haha!

Thanks again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!