Results 1 to 2 of 2

Thread: glTexParameter affects render/texture state?

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jun 2003
    Posts
    121

    glTexParameter affects render/texture state?

    When I call glTexParameter() is it changing a state assocatiated with the currently bound texture, or is it changing a state associated with the renderer?

    eg. Does each individual texture have a filtering state and edge clamping state that is applied everytime I use that texture, or are these state parameters of the texture units like glTexEnv() is?

    The reason I'm asking is that I see lots of examples where glTexParameteri() is called before glTexImage2D() to set the filtering mode like this:

    glBindTexture(GL_TEXTURE_2D, cacheTexID);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, texData);

    but is this necessary? With glTexEnv() I can set the mode to GL_MODULATE before rendering, and this works because the TexEnv mode is a property of the texture units themselves. Can you similarly set the filtering mode just before you render, and not worry what the mode was when you called glTexImage2D() and glBindTexture()? ... of course assuming that you've created the appropiate mipmap levels beforehand if you're using a mipmapped filter setting.

    I've tried to find the answer in the red book and in the OpenGL1.4 spec, but maybe I'm not looking in the right spot, or maybe they don't actually say.

    Thanks.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2003
    Posts
    177

    Re: glTexParameter affects render/texture state?

    TexParameter is per-texture-object state.
    TexEnv is per-texture-unit state.

Similar Threads

  1. glTexParameter
    By bonfo in forum OpenGL ES
    Replies: 3
    Last Post: 10-01-2010, 09:27 AM
  2. Separate sampler state from texture state
    By The Fiddler in forum OpenGL: General
    Replies: 79
    Last Post: 03-15-2010, 05:12 PM
  3. about glTexParameter()
    By Tanwa1234 in forum OpenGL: General
    Replies: 4
    Last Post: 10-16-2009, 02:45 PM
  4. glDetachObjectARB on ATI - affects link state !!!
    By k_szczech in forum OpenGL: GLSL
    Replies: 1
    Last Post: 02-25-2006, 09:07 PM
  5. batch rendering/render state management
    By valoh in forum OpenGL: General
    Replies: 10
    Last Post: 03-23-2004, 06:15 AM

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