Jump to content
  • Advertisement

Archived

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

Dunge

Weird textures

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

Anyone know how can my texture appear so strange? It''s the best looking one I saw.. testing with other gave even weirder results.. and applying it on quaratics/other objects do the same thing.. This is how I create it: glGenTextures(1, &BallTex.texID); glBindTexture(GL_TEXTURE_2D, BallTex.texID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, BallTex.width, BallTex.height, GL_RGB, GL_UNSIGNED_BYTE, BallTex.data);

Share this post


Link to post
Share on other sites
Advertisement
are you sure that the bitmap''s format is RGB?

Is it square size (even with gluBuildMipmaps it''s good to have a square 2^n size image) ?



[ My Site ]
''I wish life was not so short,'' he thought. ''Languages take such a time, and so do all the things one wants to know about.'' - J.R.R Tolkien
Founding member of "Un-Ban nes8bit" association (UNA) (to join put this in your sig) (Welcome back to JesperT)
/*ilici*/

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''ve seen that type of artifact often when the bitmap is not read in correctly. Make sure you are reading the file properly. It will be easier if it is a power of 2, which it should be anyway before you send the data to the video card.

Share this post


Link to post
Share on other sites
Well I use the code of the OpenGL Game Programming book to loadd the BMP and set it as a texture... and I use a texture from the source cd too... 512*512.. dunno what could go wrong!

Share this post


Link to post
Share on other sites
glGenTextures(1, &BallTex.texID);
glBindTexture(GL_TEXTURE_2D, BallTex.texID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, BallTex.width, BallTex.height, GL_RGB, GL_UNSIGNED_BYTE, BallTex.data);

You need to use different texture parameters when you use mipmaps.

Use this

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

Share this post


Link to post
Share on other sites
Hi dunge. when you can see the different channels like that in the texture, it is probably incorrect format. I think I can see an alpha channel there too (look at the bands, red, green, blue, grey). Have you tried GL_RGBA instead of GL_RGB?

Share this post


Link to post
Share on other sites
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

Change GL_LINEAR_MIPMAP_LINEAR to GL_LINEAR and run that see what happens

Share this post


Link to post
Share on other sites

  • 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!