“TEXTURE texture color of corresponding texture unit”
does this meen you can use texture color, does texture color meen current texture fragment color?, from any of the texture units by using GL_TEXTUREX_ARB ???
It means the texel at the current textue coordinate for that texture unit. If you want to access arbitrary texture units from any stage you need GL_ARB_texture_env_crossbar or GL_NV_texture_env_combine4.
am i rigt in persuming that “PRIMARY_COLOR_ARB” would get the current fragment color of the polygon? I know someone has put glColor* but bearing in mind that the color can be smoothed across the surface the curent glColor* would not necesarly be the color of the polygon at the current point
[This message has been edited by Zerosignull (edited 08-19-2003).]
//not even going to bother with these three
glActiveTextureARB(GL_TEXTURE2_ARB);
glBindTexture (GL_TEXTURE_2D, a_texture);
glEnable(GL_TEXTURE_2D);
//set tex evironment blend mode to one of the new(ish) blend modes instead
//of the base set of MOD, BLEND, ADD*, DECAL
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
//combine the current texel wit the textel from the previous TMU
//using GL_MODULATE. not a new(ish) one in know but still ...
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
//tell the TMU the source is going to be the current texture bound to this unit
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
//use the current U,V coords from the operation and use the above source color
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
//take the interpolated color from the POLYGON, not texture, which HAS to be derived from
//glColor*
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT);
//use the current U,V coords from the operation and use the above derived color
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
Now all the above mode sets are merly going to tell the TMU how to apply the texture to the previous TMU operation or if TMU == 0 how to apply to the polygon?
[This message has been edited by Zerosignull (edited 08-19-2003).]
[This message has been edited by Zerosignull (edited 08-19-2003).]
Basically you say that the output from state 2 is texture from TMU2 multiplied with the primary color. Since you don’t use GL_PREVIOUS as any of the sources you simply overwrite everything from earlier stages. Final results thus is primary color times texture 2.
The primary color doesn`t necessarily come from glColor.
primary color is just the vertex color, so if you have lighting enabled, lighting provides the vertex color.
If you enable separate specular, then the secondary color will be the specular (if you have lighting enabled), otherwise it will probably be zero or undefined.