View Full Version : Automatic MIPMAPS

08-25-2001, 11:07 AM
I am trying to use gluBuildMipmaps to automatically generate mipmap textures, but I keep running in to an access violation...
here is my code......

gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, landInfo.biWidth, landInfo.biHeight, GL_RGB, GL_UNSIGNED_BYTE,landTexture);

08-25-2001, 02:45 PM
For the last parameter of the gluBuild2DMipMaps() function are you sure you are passing a pointer to the image data?

I mean, are you
a) passing a pointer
b) is it at the image data, NOT the texture


08-25-2001, 04:55 PM
on a similar note - is it better to use the built in functions? or create your own textures to be used at different distances?

what are the performance advantages/disadvanteages?

08-25-2001, 05:56 PM
mipmapping should usually increase performance.
generating your own textures to be used at the smaller resolutions should look better than the ones from gluBuildMipmaps(..).
though of course this is time consuming esp if the artist has to paint them.
perhaps its best to rescale them with say gluScaleImage(..) + then check to see if theres any improvements u can make

08-26-2001, 12:34 AM
Couldn't you just use a program like photoshop to rescale the image? Halfing it each time using bicubic and you could probable just use the batch/action to do it.

On the performance note I definately notice a performance increase when using mipmaps.

08-26-2001, 02:22 AM
MasterDark: if you rescaled the image in photoshop you'd need to store it on the HDD or somewhere, which would increase the space required for whatever program you are creating.

gluBuild2DMipMaps() uses gluScaleImage() internally to do at least some of the work.

If you want to see a method of generating your own mipmaps I believe there is one somewhere in the Quake 1 engine source code.


08-26-2001, 03:33 PM
a link to some fast scaleimage code was posted about a week ago on the c.g.a.o usenet group.
im using it + its a lot quicker than gluScaleImage 50x ?

08-27-2001, 12:07 AM
From memory nVidia recommends using SGIS_generate_mipmap instead of gluBuildiDMipmaps for better performance.

Hope that helps.

08-27-2001, 10:20 AM
The last parmeter in the second glTexParameteri() should be GL_x_MIPMAP_y where x and y are LINEAR or NEAREST, otherwise it wont use the mipmaps.