PDA

View Full Version : glgeneratemipmap()didn't run correctly



ashi08104
03-08-2011, 08:02 PM
hey,I'm reading OpenGL SB 5ed recently,when I run the example in chapter 5 about mipmap,the example crashed on my laptop under window 7.I found the function glgeneratemipmap() didn't work,just black screen.and I also can't step into this function(why?).However,I just comment out this function in the code,then it works,but without any mipmap effect.I think this problem maybe caused by my intel graphic card(GM 4 series),because I got some other problems previously solved by upgrade the graphic card driver.I wonder is there any other solutions?upgrading driver will not work any more since I have the latest driver installed.
by the way,I worked both under windows and linux.Strangely,I also run that example in gentoo linux, it works well.I know little about OpenGL under linux.
thanks for any reply:)

V-man
03-09-2011, 04:33 AM
Requires GL 3.0
and it requires creation of a GL 3.0 context
examples are here for making gl 3
http://www.opengl.org/wiki/Tutorials

mhagain
03-09-2011, 05:05 AM
This is nothing to do with the OS, it's entirely down to the graphics card driver, and if that doesn't support glGenerateMipmap (or if it has a botched implementation of it) then it won't work.


my intel graphic card(GM 4 series)
I think we've found the cause of your problem.

if (IntelGraphics + OpenGL == (GOOD & RELIABLE))
Hell->FreezeOver ();

mobeen
03-09-2011, 05:19 AM
Could u try this add


glewExperimental=GL_TRUE;

before the glewInit() call and see if this helps.

ashi08104
03-10-2011, 05:43 AM
hey,mobeen,adding your code doesn't work.

V-man,I didn't understand what GL3.0 context is for.

intel card...hmm,it's really bad luck:(

V-man
03-10-2011, 07:15 AM
glGenerateMipmap requires a GL 3.0 context.
If you have <3.0, then you use the old method.
http://www.opengl.org/wiki/Common_Mistakes#Automatic_mipmap_generation

ZbuffeR
03-10-2011, 08:14 AM
3.0 context or the extension GL_ARB_framebuffer_object which any sane gl 2.0 context should provide ;-)

dukey
03-10-2011, 04:43 PM
I stumbled across this issue recently. I tried this

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

But on my ATI card all mipmaps came out black. In the end I just used good old gluBuildMipmaps2d. Older hardware seems to much prefer the power of 2 mipmaps it generates :p

ZbuffeR
03-10-2011, 04:47 PM
if it is about power of two, it is better to resample the image separately to power of two, you can get better results than the crude job done by gluBuildMipmaps2d.