View Full Version : Automatic MIPMAPS
08-25-2001, 10: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......
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R, GL_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, landInfo.biWidth, landInfo.biHeight, GL_RGB, GL_UNSIGNED_BYTE,landTexture);
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
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?
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
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.
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.
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-26-2001, 11:07 PM
From memory nVidia recommends using SGIS_generate_mipmap instead of gluBuildiDMipmaps for better performance.
Hope that helps.
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.