Probably trivial Opengl question..but
In the Red Book I see a line of code:
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
what gives with glTexEnv{if} definition. Aren't the three GL_xxxx above
enums so wont shouldn't it be glTexEnvi(....)?
Also, does the glTexEnv?() always need to be performed before a
glTexImage2D(....)?
Or can this be updated dynamically before each
glBindTexture(...)
glBegin(GL_QUADS);
{
}
glEnd();
thanks
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
what gives with glTexEnv{if} definition. Aren't the three GL_xxxx above
enums so wont shouldn't it be glTexEnvi(....)?
Also, does the glTexEnv?() always need to be performed before a
glTexImage2D(....)?
Or can this be updated dynamically before each
glBindTexture(...)
glBegin(GL_QUADS);
{
}
glEnd();
thanks
glTexEnvi probably would be better, but I think it's designed to work with the floating point versions as well. It can be called at any time, not just before loading the texture.
"Better"? It doesn't matter. The f is around for the glTexEnvfv, where you can supply an RGBA value to the params when using GL_TEXTURE_ENV_COLOR. Using f or i for the singular GL_TEXTURE_ENV_MODE does not matter at all.
As for when to call it, this operation does not modify the texture at all. So calling it before loading the texture isn't going to do anything if end up changing it. You should call it after you activate a texture unit(glBindTexture(), glActiveTextureARB()) and most likely return it to GL_MODULATE when you are done, since that is the default.
Read the man page.
As for when to call it, this operation does not modify the texture at all. So calling it before loading the texture isn't going to do anything if end up changing it. You should call it after you activate a texture unit(glBindTexture(), glActiveTextureARB()) and most likely return it to GL_MODULATE when you are done, since that is the default.
Read the man page.
Better for that case, I mean. (aka: when you're passing in an enumerated value)
Calling the f version assumes that (GLenum)(float)GL_X == GL_X, which certainly should be true of any IEEE float as long as GL_X has fewer than 23 significant bits. As far as I know, GLenums are all 17 bits or less, so it's OK for now.
I'd still call the i version, myself, just to be safe. If nothing else, it's more efficient
I'd still call the i version, myself, just to be safe. If nothing else, it's more efficient

