arithon
04-28-2002, 04:37 AM
I have a problem with multitexturing and vertex colors. Suppose I have a triangle with colors for each vertex specified with glColorPointer (I use glDrawElements for drawing my primitives), and I want to multitexture it with two textures.
The first is a simple RGB (no alpha) texture, and the second a ARGB texture I want to combine with GL_DECAL (to mask out and blend certain areas to let the first texture show 'through')
Ok, now the problem is that since I set GL_MODULATE on the first texture unit and GL_DECAL on the second, the vertex colors will be 'lost'. Sure, the areas where only the first texture is visible (where alpha is 0 in the second texture) is correctly colored since it modulates in the first texture unit. But the second unit's GL_DECAL environment will ignore the vertex colors.
Thinking bout it, the most logical way to do multitexturing would be to use a final modulate on the primitive color and combined texture value AFTER all texture units have been combined, but since OpenGL takes the primitive color as input to the first texture unit this doesn't seem possible.
What is the general solution to this problem (to get multitextured primitives with a decal texture 'shaded' with the vertex colors)?
The first is a simple RGB (no alpha) texture, and the second a ARGB texture I want to combine with GL_DECAL (to mask out and blend certain areas to let the first texture show 'through')
Ok, now the problem is that since I set GL_MODULATE on the first texture unit and GL_DECAL on the second, the vertex colors will be 'lost'. Sure, the areas where only the first texture is visible (where alpha is 0 in the second texture) is correctly colored since it modulates in the first texture unit. But the second unit's GL_DECAL environment will ignore the vertex colors.
Thinking bout it, the most logical way to do multitexturing would be to use a final modulate on the primitive color and combined texture value AFTER all texture units have been combined, but since OpenGL takes the primitive color as input to the first texture unit this doesn't seem possible.
What is the general solution to this problem (to get multitextured primitives with a decal texture 'shaded' with the vertex colors)?