OpenGL ES (iPhone) multi-texture (2D) code

I have a texture from this PNG:

alt text

And one more of this PNG:

alt text

They both have the same blending function:

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

First I want to see them on the same training ground. I just could not find a simple example of this. Drawing them at different polygons works great, but I just can't “merge” them into one texture. Any working code examples would be appreciated.

The second problem is to make the alpha variable of the mirror map. I see that I need the texture to somehow combine alpha with the main color (created from my variable), but again, I don't have a working code example. I started to learn the glTexEnvi function, but so far I have no result.

, 16 ! , .

, ( ), .

+3
1

, , , glTexEnv... opengles 1.1 . , :

glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, myTextureObject);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);

// Tell OpenGL which arithmetic operation to use: 
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, <operation>);

// Set the first argument:
glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, <source0>);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, <operand0>);

// Set the second argument:
glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, <source1>);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, <operand1>);

, , , FBO, .

0

Source: https://habr.com/ru/post/1730784/


All Articles