OGL Multitexturing terminolgy help.

I can do multitexturing fine but i would like to find out what the specs for advanced things things like “texture_env_combine” are talking about.

My problem is i can find tutoruials that show you how to do things but dont explaing the advanced arguments.

ive figured out a few of them, stop me if im wrong.

I shall mostly be using this extension as referal material:

GL_SOURCEX_RGB_EXT - can have upto three sources. This denotes where the fragment information is coming from.

GL_OPERAND0_RGB_EXT - up to three. these say what you want to do with the source fragment.

The genrall flow of the texture umapping i can follow but im unsure of what is refered to by the source eg.

“PRIMARY_COLOR_ARB primary color of incoming fragment”

what is the primary color of the incoming fragment? Would this be the color that apears most in the texture?

If any one can point me in the direction of somewhere hepfull ide bee greatfull

Primary color is what you set with glColor() etc. Texture color is simply called GL_TEXTURE.

i noticed in the spec it says

“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).]

Correct. It’s the interpolated color, not the last values passed to glColor*().

– Tom

so am i reading the follwing right?

//not even going to bother with these three
glBindTexture (GL_TEXTURE_2D, a_texture);

//set tex evironment blend mode to one of the new(ish) blend modes instead
//of the base set of MOD, BLEND, ADD*, DECAL
//combine the current texel wit the textel from the previous TMU
//using GL_MODULATE. not a new(ish) one in know but still ...
//tell the TMU the source is going to be the current texture bound to this unit
//use the current U,V coords from the operation and use the above source color

//take the interpolated color from the POLYGON, not texture, which HAS to be derived from

//use the current U,V coords from the operation and use the above derived 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.