Results 1 to 6 of 6

Thread: gluBuild2DMipmaps?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    16

    gluBuild2DMipmaps?


    In the docs for gluBuild2DMipmaps, it says:

    Code :
    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():

    Code :
    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.

  2. #2
    V-man
    Guest

    Re: gluBuild2DMipmaps?

    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

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    16

    Re: gluBuild2DMipmaps?

    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?

  4. #4
    V-man
    Guest

    Re: gluBuild2DMipmaps?

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR OR GL_NEAREST) turns off.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    16

    Re: gluBuild2DMipmaps?

    Quote Originally Posted by V-man
    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.

  6. #6
    V-man
    Guest

    Re: gluBuild2DMipmaps?

    The specification doesn't say, so it is implementation dependent.
    See page 178 "Automatic Mipmap Generation" (or 192 shown in Adobe Reader)

Similar Threads

  1. gluBuild2DMipmaps()
    By devdept in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-24-2008, 08:23 AM
  2. need help with gluBuild2DMipmaps...
    By Lexx in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-24-2005, 03:34 AM
  3. GL_OUT_OF_MEMORY on gluBuild2DMipmaps()
    By pdubz in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-21-2004, 08:04 AM
  4. gluBuild2DMipmaps()...
    By Sephiroth in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-25-2002, 02:58 AM
  5. gluBuild2DMipmaps
    By MikeM in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-07-2001, 07:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean