View Full Version : Hazy Images
I have set up a program to load images and display them. I can switch back and forth on the menu from openGL to GDI. The GDI image is much crisper, the openGL image looks like it has had a blur filter applied. It's not really noticible that much until you switch back and forth. I tried different options with glTexEnvf and glTexParameteri and different ways of binding the image and it doesn't become any clearer. Is this just a limitation with openGL or can I overccome this to get clear pictures?
03-30-2003, 01:25 AM
My guess is that you actually have a filter applied to your image.
(That is, a bilinear filter maybe)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
Hope it helps!
[This message has been edited by B_old (edited 03-30-2003).]
03-30-2003, 03:55 AM
Also remember that OpenGL requires all texture dimensions to be a power of two (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 etc). If your image is e.g. 640x480 pixels, depending on how you upload it to OpenGL it might be resized to say 512x512 pixels. This filtering will cause "bluring".
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
This is how I am loading, and I tried other ways too, so I don't think it was that. That's what I had figured it was.
POWERS OF TWO!! That's what it has to be, I didn't think about that. Some images are worse then others so this has to be it. I will check with even images to make sure there is no bluring and this is it.
By the way, can openGL can handle different width and height if they are both in powers of 2? So is 256 by 128 is ok? Or should I always load square images?
As long as both the dimensions are from the list above it will be ok, even 2 x 1024 will work.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.