View Full Version : Silly Bothersome Texture Issue
11-26-2004, 09:36 AM
I feel dumb asking this, but I will anyway. I'm loading an image from a bitmap file that I want to display on the screen. In order to make it display more quickly, I'm drawing it as a texture-mapped rectangle rather than drawing the pixels directly. When I do this, though, the texture is kind of fuzzy. Does that have something to do with the mipmaps? If so, what do I do to make the texture display on the screen exactly as it is defined in the file?
11-26-2004, 07:11 PM
Could you give us a little more info on how you're doing it now? Does this still happen with mipmapping disabled?
11-26-2004, 07:33 PM
You must excuse my inexpertise with regard to texturing issues. When I don't generate the mipmaps the texture doesn't work at all, it just looks like a big white rectangle. Is that what you meant?
12-02-2004, 03:09 AM
The default texture filtering is set to GL_LINEAR for magnification and GL_LINEAR_MIPMAP_NEAREST for minification.
That means you must download mipmaps to get texturing or change the glTexParameter for minification filter to something which doesn't use mipmaps.
Else you get an inconsistent texture and the texture unit is switched off => white geometry.
If your texture works and looks fuzzy it's because of the filtering. Even if you have not sampled one of the smaller mipmaps, the linear filter used for magnification will mix four texels.
To get a 1-to-1 correspondence you need to setup a pixel aligned orthographic projection (e.g. with gluOrtho2D), set the modelview matrix to identity, set the texture filtering to GL_NEAREST for mag and min filter (no need for mipmaps then), and draw a pixel aligned textured quad of the size of the texture.
I bet there are tutorials doing exactly this.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.