2012-01-07 8 views
0

openglによってcolorsplash効果のような効果を実装したいので、私はウェブサイトで検索し、ガイドを入手します(http://www.idevgames.com/forums/thread-899.html)OpenGL ESテクスチャマスキング

私は描画時間の3番目のステップでブロックする、私はマルチテクスチャを作成する方法がわからないガイドに従って、あなたは私を助けることができますか?

答えて

1

マルチテクスチャを行うには、さまざまなテクスチャをさまざまなテクスチャユニットに配置し、それらのテクスチャ座標を設定する必要があります。このようなもの:

// 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();