PDA

View Full Version : gluBuild2DMipmaps?



roswell
08-07-2008, 08:01 PM
In the docs for gluBuild2DMipmaps, it says:



int gluBuild2DMipmaps(
GLenum target,
GLint components,
GLint width,
GLint height,
GLenum format,
GLenum type,
const void *data
);

components
The number of color components in the texture. Must be 1, 2, 3, or 4.


However, I see some OpenGL examples using internalformat, such as GL_RGB8, for the components argument instead.
The internalformat argument belongs to glTexImage2D():



void glTexImage2D(
GLenum target,
GLint level,
GLint internalformat,
GLsizei width,
GLsizei height,
GLint border,
GLenum format,
GLenum type,
const GLvoid *pixels
);


Just wondering if the docs for gluBuild2DMipmaps are wrong, out-dated, or incomplete.

V-man
08-07-2008, 10:02 PM
Yes, components IS internalformat however gluBuild2DMipmaps is not necessary anymore. Let the hw handle it with

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

See
http://www.opengl.org/wiki/index.php/Texture_Mapping

roswell
08-08-2008, 12:07 PM
Thanks! That looks much better. No confusing arguments. I suppose if I wanted to "turn off" mip-mapping for a texture that
was already created using this method, I could just set GL_TRUE to GL_FALSE and call it again?

Or perhaps I have to delete the textureID to get rid of the mimaps?

V-man
08-08-2008, 05:55 PM
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR OR GL_NEAREST) turns off.

roswell
08-09-2008, 08:36 PM
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR OR GL_NEAREST) turns off.

What I mean is, calling GL_GENERATE_MIPMAP with GL_TRUE allocates texture memory for mipmapping.

I'm assuming calling GL_GENERATE_MIPMAP with GL_FALSE de-allocates this mipmap texture memory, rather than
just "suspending" its use.

V-man
08-10-2008, 11:25 AM
The specification doesn't say, so it is implementation dependent.
See page 178 "Automatic Mipmap Generation" (or 192 shown in Adobe Reader)