glGenTextures(1, &texture_tgatitle);
glBindTexture(GL_TEXTURE_2D, texture_tgatitle);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tgatitle->width, tgatitle->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tgatitle->pixelData);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
Why must I use glTexEnvf
Hey guys, I'm not sure I entirely understand what the command 'glTexEnvf' is doing. My book does not mention using it, and most texturing tutorials also don't mention it. I don't remember why I finally ended up putting it into my code, but now that I'm trying to load multiple textures, I realize that when i remove that function, my textures don't show up.
So my question is, why is this one command making or breaking my program when no one else seems to use it much.
Here is my code, I don't know if it would help.
It sets up the texture environment mode on the texture unit.
Sadly, there are many people that seem to think it is bound to the texture object itself so every time they create a texture, they shuve a glTexEnv call after the glTexParameter calls.
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
basically means ignore the primary color source and just send the texels down the pipe. Read the specification on opengl at opengl.org
I think the default mode is GL_MODULATE, which means multiply texels with the primary color.
Sadly, there are many people that seem to think it is bound to the texture object itself so every time they create a texture, they shuve a glTexEnv call after the glTexParameter calls.
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
basically means ignore the primary color source and just send the texels down the pipe. Read the specification on opengl at opengl.org
I think the default mode is GL_MODULATE, which means multiply texels with the primary color.
Of course, all this is merely of historical interest, since those nice little things called shaders came into existance...
So yeah, glTexEnvf was used to configure the fixed function pixel pipeline. It was inflexible, unintuitive and limited. Fortunately, it's not needed anymore nowadays. Good riddance.
So yeah, glTexEnvf was used to configure the fixed function pixel pipeline. It was inflexible, unintuitive and limited. Fortunately, it's not needed anymore nowadays. Good riddance.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement