Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Getting "GL_INVALID_ENUM" when calling glEnable(GL_TEXTURE_2D)

  1. #1
    Junior Member Regular Contributor
    Join Date
    Apr 2014
    Posts
    109

    Getting "GL_INVALID_ENUM" when calling glEnable(GL_TEXTURE_2D)

    Hello,

    Title says it all, really. I am initializing my OpenGL context and in the middle of setting up stuff like glPolygonMode(GL_FRONT_AND_BACK, GL_FILL), glEnable(GL_DEPTH_TEST), etc. when I make a call to glEnable(GL_TEXTURE_2D) I get the following ENUM error: "GL_INVALID_ENUM"

    I looked up the function: https://www.opengl.org/sdk/docs/man2/xhtml/glEnable.xml

    And no fragment shader is active when I call it on my open OpenGL context.

    Any ideas?

    Thank you.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,005
    It sounds as if you have an OpenGL 3+ core profile context, where GL_TEXTURE_2D is indeed not a valid argument to glEnable() (it's only meaningful for the fixed-function pipeline, and OpenGL 3+ core profile doesn't support the fixed-function pipeline).

  3. #3
    Junior Member Regular Contributor
    Join Date
    Apr 2014
    Posts
    109
    Quote Originally Posted by GClements View Post
    It sounds as if you have an OpenGL 3+ core profile context, where GL_TEXTURE_2D is indeed not a valid argument to glEnable() (it's only meaningful for the fixed-function pipeline, and OpenGL 3+ core profile doesn't support the fixed-function pipeline).
    I see, makes sense.

    I don't plan on coding in the fixed-function pipeline at all; is it safe to take out and still use textures? I assume yes but I want to check.

    Thank you.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,005
    Quote Originally Posted by tmason View Post
    is it safe to take out and still use textures?
    Yes.

    glEnable(GL_TEXTURE_2D) instructs the fixed-function pipeline's equivalent of the fragment shader to use textures to determine the fragment colour, in accordance with the glTexEnv() settings. If disabled, the fragment colour is based upon vertex colours or the current colour, without involving textures.

    It doesn't affect anything else, so when a fragment shader is being used it doesn't affect anything.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Apr 2014
    Posts
    109
    Quote Originally Posted by GClements View Post
    Yes.

    glEnable(GL_TEXTURE_2D) instructs the fixed-function pipeline's equivalent of the fragment shader to use textures to determine the fragment colour, in accordance with the glTexEnv() settings. If disabled, the fragment colour is based upon vertex colours or the current colour, without involving textures.

    It doesn't affect anything else, so when a fragment shader is being used it doesn't affect anything.
    Thanks! Removing this line was indeed OK. I have another issue but that'll be in a separate post.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •