Loss of detail in texture

Hi all,

I am doing some sort of a GUI uisng the 2D overlay method. But I seem to be losing the details in the textures that I am loading. FYI I am loading them from a tga file and using glAlphaFunc to ‘blank out’ what I don’t want. The tga file when viewed through some other external programs ie Photoshop etc looks ok but when I load it into the program it looks all messed up (blurry).

If you’re distorting the image by mapping it in such a manner that it will have a different aspect ratio than the original image or if the resultant texels are larger or smaller than pixels (very likely) then OpenGL could very likely cause “blurriness” due to texture filtering.

If this is the case, look into glTexParameter* and the GL_TEXTURE_MAG_FILTER and GL_TEXTURE_MIN_FILTER parameters. You can keep it from blurring them.

Also, if your image is appearing to be diluted or missing colors, perhaps you’re rendering at a lower bit depth than the original image was stored.

the image is 1024 x 1024 being mapped onto a quad of the same size. GL_TEXTURE_MAG_FILTER is set to GL_LINEAR while GL_TEXTURE_MIN_FILTER is set to GL_LINEAR_MIPMAP_NEAREST. are these settings wrong?

I’d guess you’d want it to be like

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

I don’t know if this’ll do it though…for some reason, I’m having a crap problem drawing in 2D in my program too.

Also, make sure you’re using uncompressed targas.

nope, it’s still rather blur, still couldnt get it to be as ‘sharp’ as the image. any other ideas on where i could have gone wrong?

Your probably using the mipmap texture filter? use the linear or nearest filter.

i am using gl_linear for both. could that be the problem?

thanks ppl for your help. figured out the problem alrady. the textures are in 32bits but my voodoo3 can only do 16.

Also, if your image is appearing to be diluted or missing colors, perhaps you’re rendering at a lower bit depth than the original image was stored.[/b]

Booyah!