Jump to content
  • Advertisement
Sign in to follow this  
McSlay

Texturing error

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

Hi,

I am currently programming a game in c# using csgl. In this game i am using a mostly lightish blue texture for my model and glcolor3f for cubes. The problem is that when i draw both the model and the cubes the colors are all messed up.

For instance when i have allot of green cubes my model turns green, but when i have rows of red, white and blue cubes the model textures are right but the red row of cubes turns black, the white row turns lightish blue and the blue row doenst change.

But when i draw either the model or the cubes it works perfectly.

I am new to this forum and i havent been able to figure out how to create a box for my code. So if you need the code to figure out the problem just tell me how to make the box and i will post it. But my texture code is basically the same as the code used in the c# code for lessen 7 of the NeHe tutorials.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=07

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
OpenGL is a state machine and therefore 'remembers' the settings as soon as you set them.

For rendering this means that you need to disable certain things when you don't need them, or reset their values.

For example, when you are rendering the coloured cubes with no texture, you need to disable texturing glDisable(GL_TEXTURE_2D), and when rendering the textured cubes, you need to set the vertex colour to white glColour4f(1.0, 1.0, 1.0, 1.0).

Try wrapping these around the rendering of the various cubes and see if that has any effect.

Share this post


Link to post
Share on other sites
Hi,

Thank you for posting a reply, it worked perfectly. The color cubes are correct again, and after enabeling GL_Texture_2D again in the model the textures where correct as well.

Thank you very much for helping me with my problem.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!