Jump to content
  • Advertisement
Sign in to follow this  
Klarre

OpenGL OpenGL texture artifacts

This topic is 4207 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 working on a 2D-pixel-art game (this style: http://www.lovepixel.idv.tw/ ). The problem is that my textures are filled with artifacts when OpenGL have generated them, and I don't have an idea how to fix this. The left image is the original texture, and the right is the image applied on a quad in the game engine. artifacts The code I am using to generate the textures are
glGenTextures(1, &mHandle);
glBindTexture(GL_TEXTURE_2D, mHandle);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, loader->getWidth(), loader->getHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, loader->getData());
Should I use some other glTexParameter's, or what should I try? Thanks for your thoughts! /Klarre

Share this post


Link to post
Share on other sites
Advertisement
The banding on the gradient looks like being a precision issue - try changing the GL_RGB to GL_RGB8 to explicitly request 32bit colour rather than leaving the driver to decide. Make sure you're creating your framebuffer at 32bit rather than 16 too (if you don't set it, it'll probably default to the desktop depth).

The blocky artifacts are odd though. If this was 3d I'd say it could be z-fighting, but if thats one big texture then thats not going to be it. It could be some kind of block-based texture compression - are you loading DXT or DDS format textures? Perhaps you've tinkered with something in your computer's 3d settings to force texture compression?

It might be useful if you posted code from the loader class too.

Share this post


Link to post
Share on other sites
I had things like that happen to me too when I turned down the image quality settings in my nvidia drivers. All my smooth 2d GUI textures looked like shit.

Share this post


Link to post
Share on other sites
Problem solved!

I checked up my driver settings and changed the "Image settings" from "High performance" to "Performance" on my NVIDIA graphics card - the blocky uglyness disappeared!

Thank you guys!

/Klarre

Share this post


Link to post
Share on other sites
Quote:
Original post by Klarre
Problem solved!

I checked up my driver settings and changed the "Image settings" from "High performance" to "Performance" on my NVIDIA graphics card - the blocky uglyness disappeared!

Thank you guys!

/Klarre


Yeah, turning it down doesn't really tell you what it does, but it's something I did just because I always have low specs and I just turn off all the bells and whistles to keep things smoother.

I posted the same topic here, and people posted all kinds of things about what I was doing wrong, when I wasn't doing anything wrong at all. Damn driver. I'm wondering what exactly this optimization does to get those artifacts.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!