harvey.ding
harvey.ding

Reputation: 1

OpenGL ES Texture Masking

I want to implement a effect like colorsplash effect by opengl es,so I search by the website and get the guide(http://www.idevgames.com/forums/thread-899.html)

Now I block in the third step for the draw time,i don't know how to create the multi-texture followed the guide,can you help me? give me some suggestions or some code about it

Upvotes: 0

Views: 293

Answers (1)

user1118321
user1118321

Reputation: 26365

To do multi-texturing, you need to put different textures into the various texture units, and set texture coordinates for them. Something like this:

// Put a texture into texture unit 0
glActiveTexture (GL_TEXTURE0);
glBindTexture (GL_TEXTURE_RECTANGLE_EXT, texID0);
...    
// Put a texture into texture unit 1
glActiveTexture (GL_TEXTURE1);
glBindTexture (GL_TEXTURE_RECTANGLE_EXT, texID1);
...
// Now draw our textured quad - you could also use VBOs
glBegin (GL_QUADS);
// Set up the texture coordinates for each texture unit for the first vertex
glMultiTexCoord2f (GL_TEXTURE0, x0, y0);
glMultiTexCoord2f (GL_TEXTURE1, x1, y1);
// Define the first vertex's location
glVertex2f (x, y);
... // Do the other 3 vertexes
glEnd();

Upvotes: 1

Related Questions