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: glEnable

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

Any ideas?

Thank you.

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.

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.

[QUOTE=GClements;1262281]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.[/QUOTE]

Thanks! Removing this line was indeed OK. I have another issue but that’ll be in a separate post.

Thanks again.