Texture Quality?

Hi All,
I load a bmp in my texture. When I see bmp in paint its is good, but when I see that in opengl with 100% zoom its quality is less than paint.Which setting should I do?

My MagFilter is Linear and MinFilter Is LinearMipmapNearest.

What is the original definition of your .bmp ?

If you want to enlarge a 16x16 icon into a 1024x764 (or more) this is normal that the quality cannot be as good as this …

@+
Yannoo

“its quality is less than paint” :do you mean the texture apears blurry ?

First try “trilinear” filtering :
MinFilter with LinearMipmapLinear.
If it works, maybe your 100% zoom is only 99,9% so with LinearMipmapNearest it means “use a lower res mipmap”.

Extreme test :
MagFilter with Nearest and MinFilter with Nearest.

If you could post screenshots it would be much easier to help you.

Hi ZbufferR

My bmp is 1024*1024 and its a map.
when i see that in paint its text s ok, but when see in opengl
its text isn’t good.
I don’t tray your above solution yet.I do an say you the result.

Hi ZbufferR
I do your above solution.
I do all possible MAG and MIN filtter, but my image has still less quality than i view it in paint or MS Picture Manager.

My opengl view is -1 to 1 x, -1 to 1 y and 1 to -1 z.In glOrtho.

And what is your screen definition ?
(I don’t think that this can be this, but in the case …)

And when you reduce the size of the opengl window, it’s the same thing ?

You only map the picture on a simple quad or you make a quad for each pixel ?

@+
Yannoo

Hi Yann LE PETITCORPS,

My screen is 800*600.

And yes, when I reduce the size of gl window, or create texture from half of image, result is the same.

I Only map the picture on a simple quad.

And you see a very better picture at exactely the same 800x600 definition with Paint ?

With what you load this picture into an OpenGL texture ?

Can you give me the picture at yann.lepetitcorps@free.fr please ?

@+
Yannoo

10241024 -> 800600 this not 100% zoom.
try with a 1024*1024 window.

Hi ZbufferR,
My problem exist on 1024*1024 window.
I don’t set any gl setting and in nvidia setting,I set texture quality to high.

Give more details and screenshots please.

Hi ZbufferR,
Its some of my code :
//----- Load Teature Function -----
glBindTexture(GL_TEXTURE_2D, ImageTex);

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );

glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);

gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, Width, Height, GL_BGR_EXT, GL_UNSIGNED_BYTE, Data);

glNewList(ImageList,GL_COMPILE);
	glEnable(GL_TEXTURE_2D);		
	glBegin(GL_QUADS);
		glTexCoord2f(0.0, 0.0);		glVertex3f(-1.0, -1.0, 0.0);
		glTexCoord2f(0.0, 1.0);		glVertex3f(-1.0, 1.0, 0.0);
		glTexCoord2f(1.0, 1.0); 	glVertex3f(1.0, 1.0, 0.0);
		glTexCoord2f(1.0, 0.0);		glVertex3f(1.0, -1.0, 0.0);			
	glEnd();
	glDisable(GL_TEXTURE_2D);
glEndList();

//----- Display Function -----
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, ImageTex);
glCallList(ImageList);
//----- Resize Function -----
glViewport(0,0,(GLsizei)cx,(GLsizei)cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(XLeft,XRight,YDown,YUp,1.0,-1.0);
// 4 above variable indicate 100% zoom.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
////////////////
The result of view in opengl window is this:
http://www.4shared.com/file/158522085/8026808f/1-OpenGL.html

And when view in MS Picture Manager teh result is:
http://www.4shared.com/file/158522084/f721b019/2-MSPicMang.html

Oh sorry
link above have problem
please try this link for viewing image :
http://www.4shared.com/file/158544183/c2ace5f1/TexQuality.html

I think there is some problem with magnification/minification. Dimensions doesn’t match and you get a resized/blended texture.

Try to set ortho to (0.f; 1023.f; 0.f, 1023.f), don’t use mipmaps you don’t need them for now. draw a quad from 0.f to 1023.f and set tex coords from 0.f to 1.f. And set window size to 1024x1024px. If it looks good backtrack 1 step at a time to find what was the problem.

Also, if your input file is not power of 2, then it’s possible file loading routines are resizing it to the nearest, I think DevIL did that.

How are you creating a 1024x1024 window? If you’re using CreateWindow(Ex) to set the window dimensions, then you need to look at AdjustWindowRect(Ex) -