Re: trouble with mipmap minification filtering

Brian Paul <[email protected]>
Newsgroups gmane.comp.video.mesa3d.user
Message-ID <[email protected]>
On 08/10/2014 03:46 PM, David Hart wrote:
>
> Hi, I'm having a little trouble getting texture mipmap minification
> filtering to work with Mesa, I'm wondering if one of you gurus might be
> able to spot what I'm doing wrong. I've setup a test program that runs
> the same code once via Mesa and once via glut, and with glut I see
> proper mipmap sampling, but with Mesa I don't - only the base level
> texture is sampled, no matter what GL_TEXTURE_MIN_FILTER settings I use.
> Maybe I've done something stupid or in the wrong order?
>
> I'm constructing my mip levels manually with different colors, so I can
> see them. My base texture is blue, and when I render several quads at
> different sizes using Mesa, the entire image is blue indicating base
> texture.
>
> I'm on Mac (OSX 10.9.4) + PyOpengl 3.0.2 + Mesa 8.0.5 (via macports)
>
> Glut results:
> https://dl.dropboxusercontent.com/u/364079/mesa-mipmap/mip_test_glut.png
> <https://urldefense.proofpoint.com/v1/url?u=https://dl.dropboxusercontent.com/u/364079/mesa-mipmap/mip_test_glut.png&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=178IiCEt0ce%2BVVUdiIn1f60HqblZIj8qMyY4aZvMwTg%3D%0A&s=c937bf0f1177a430842276acb5b562c4652b3655aec32f38956461e392ba4a3e>
> Mesa results:
> https://dl.dropboxusercontent.com/u/364079/mesa-mipmap/mip_test_mesa.png
> <https://urldefense.proofpoint.com/v1/url?u=https://dl.dropboxusercontent.com/u/364079/mesa-mipmap/mip_test_mesa.png&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=178IiCEt0ce%2BVVUdiIn1f60HqblZIj8qMyY4aZvMwTg%3D%0A&s=f6c11a494050189558750db6242c659d88c7596aad0d77ab38b07db526e5d015>
> Code:
> https://dl.dropboxusercontent.com/u/364079/mesa-mipmap/mesa_mip_test.py
> <https://urldefense.proofpoint.com/v1/url?u=https://dl.dropboxusercontent.com/u/364079/mesa-mipmap/mesa_mip_test.py&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0A&m=178IiCEt0ce%2BVVUdiIn1f60HqblZIj8qMyY4aZvMwTg%3D%0A&s=d5563982883e6f35aafc9960ccfa09fe3345d17573ccb24fb82295936dffdf16>
> (Images were generated by running "mesa_mip_test.py 0 &&
> mesa_mip_test.py 1")
>
> I've tried a lot of searching, attempted (so far, unsuccessfully) to
> build a newer Mesa version locally, re-read OpenGl's "Common mistakes",
> etc. I also ran the same code in a linux/Xvfb environment, and there
> both versions have the same results -- both the Glut and Mesa versions
> come out all blue; minification filtering seems to not work.
>
> ---------
> FWIW, here's my environment. I'm on a very old version of Mesa, but for
> now I am assuming my problem is with my code, not Mesa, and unlikely to
> be version dependent.
>
>  > uname -a
> Darwin porkchop.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3
> 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 i386
> MacBookPro8,2 Darwin
>
>  > port list installed | grep mesa
> mesa                           @8.0.5          x11/mesa
>
>  > pip list | grep -i gl
> PyOpenGL (3.0.2)
> PyOpenGL-accelerate (3.0.2)
>

Your terminology is a bit mixed up.  GLUT is a window system toolkit 
that can be used with Mesa or any other OpenGL implementation.  It is 
not an alternative to Mesa.

I suspect that when you're using GLUT you're using the native OpenGL 
library on MacOS.  Printing the value of glGetString(GL_VENDOR) in your 
code would probably clear that up.

That said, I don't know why you're seeing different results.  I took a 
quick look at your code.  The only thing that seemed a bit off was the 
different wrap modes for the S/T texcoords:

     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT        )
     glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );

-Brian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.