I’ve been trying to make a zoom on openGL without smoothing the pixels, cause I need to see each pixel when I zoom in the imagem. But I still didn’t have any success on this. I’m loading the image using SDL, then loading it like texture to openGL, and zooming with glTranslate(); I tried using glScale, but it still smooth the pixels. Is there any flag or function to disable the smooth on openGL?
but i did some similar non-smoothing zoom feature for my openGL videoplayer, by using LINEAR for the texture, not NEAREST (isnt it? cause linear take the pixel as it is, while nearest smooths it?), and modify the z axis of the glTranslatef, with keyboard input
im sorry i was wrong, i dont think linear is the right solution for you.
in my app, if i use nearest, then the picture is jagged, so i use linear to load the real pixel value.
btw, i found nice sample to test texture filtering parameters: http://www.xmission.com/~nate/tutors.html
the texture tutorial program.
When you sampling a texture with GL_NEAREST, it will search the nearest texel in the texture for the given texture coordinates. So, this won’t be smooth. The center of the sampled pixel is represented as a red point on the image.
Using GL_LINEAR will make a linear interpolation using the four nearest texels. Each texel’s weight is proportional with the area of the rectangle formed with the center of the catercorner texel and the uv point. So, this will be “smooth”.
If it’s still smooth with GL_LINEAR, maybe there’s some option in the nvidia or ati control center that could force linear filtering of textures.
Sorry, in the last sentence I mistyped, meant GL_NEAREST instead of GL_LINEAR.
On my NV control panel there’s a Force mipmaps setting, which could be set to none, bilinear and trilinear. Of course for magnification there’s no any mean of mipmaps, but I thought it could alter the filtering mode anyway. Now I tried it, and realized that it’s not forced mipmaps for minification and any filtering mode for both minification and magnification. Maybe this switch is for DX applications only.
I tried zoom out and zoom in and nothing happens. I don’t understand why this is happening, when I use GL_TEXTURE_MIN_FILTER, the texture appear, but when I use GL_TEXTURE_MAG_FILTER nothing appears.