I have a question that I cannot figure out on my own.
Maybe somebody could give me a hint or a link.
Any help would be appreciated!
Thanks in advance.
What I want to do:
I want to draw a little 2D sprite on the screen.
When drawing the sprite I want to take the color information from one texture (“tex”) and the alpha information from another one (“mask”).
The texture coordinates in texture “tex” and the ones in “mask” are not the same.
Unfortunately I don’t know how to pass two different texture coordinates to my shader.
Right now I pass texture coordinates like this:
try using
glMultiTexCoord2f( GL_TEXTURE0, s1, t1);
glMultiTexCoord2f( GL_TEXTURE1, s2, t2);
and access them in the sahder as gl_TexCoord[0].st and gl_TexCoord[1].st .
Alternatively (based on the target hardware) you could use generic vertex attributes & VBOs instead of using the old immediate mode and the fixed number of texture coordinates.
(The immediate mode is still fine for simple applications where performance is not a concern or if the app has to run on hardware older than 5 years but it’s probably not the way to start learning OpenGL in 2012…).