PDA

View Full Version : MipMapping troubles



azcoder
10-23-2007, 11:32 AM
I have enabled mipmapping, but up close the texture looks wrong

http://img30.picoodle.com/img/img30/6/10/23/f_Picture4m_663e0e8.png

It should be

http://img29.picoodle.com/img/img29/6/10/23/f_Picture5m_991fa7a.png

I am using
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );


Thanks in advance for any help...

ZbuffeR
10-23-2007, 12:41 PM
this is not really "advanced" opengl, this is more beginner questions.

You are wrong, mipmapping is enabled with :
(with trilinear filtering, come on, we are in 2007)

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

then the mag filter should be bilinear :
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

And about your rgb stripes
on your texture it looks like you did not upload it correctly.

azcoder
10-23-2007, 01:56 PM
Sorry - I did not post enough info -

When I render the texture without mipmapping, it appears fine up close (no rgb colors). But when viewing from a far it looks poor - lots of aliasing of the lines.

When I render with mipmapping, the aliasing goes away, but I get strange rgb stripes up close.

I am generating mipmaps with:
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, w, h, GL_RGB, GL_UNSIGNED_BYTE, image->pixels );


and rendering with (thanks for the trilinear tip):
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );


Why do I get strange RGB lines when rendering with mipmapping enabled?

Thanks again for any help...

azcoder
10-23-2007, 02:03 PM
I solved it.

It was my own error.

Format should have been GL_RGBA
gluBuild2DMipmaps( GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels );

Thanks for your help...