我正在尝试淡出较远的项目。
我有它可以正常工作,纹理显示很好,但不会褪色。
effect.texture2d0.enabled = GL_TRUE;
effect.texture2d0.envMode = GLKTextureEnvModeReplace;
effect.texture2d0.target = GLKTextureTarget2D;
effect.texture2d0.name = texture.name;
// transparancy
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
然后,我将其更改为此(基于一些堆栈溢出帖子)。启用GLKTextureEnvModeModulate或添加glColor4f给我一个GL错误错误:0x0502
effect.texture2d0.enabled = GL_TRUE;
effect.texture2d0.envMode = GLKTextureEnvModeModulate;
effect.texture2d0.target = GLKTextureTarget2D;
effect.texture2d0.name = texture.name;
// transparancy
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // GL_SRC_ALPHA
glColor4f(0.7, 0.7, 0.7, 0.7);
最佳答案
这是我所做的:
self.effect.texture2d0.envMode = GLKTextureEnvModeModulate;
self.effect.texture2d0.target = GLKTextureTarget2D;
self.effect.texture2d0.name = mTexture.name;
self.effect.texture2d1.envMode = GLKTextureEnvModeDecal;
self.effect.texture2d1.target = GLKTextureTarget2D;
self.effect.texture2d1.name = mTexture2.name;
您将获得混合效果,但是我仍然无法应用动态不透明度系数。
关于iphone - iOS GLKit:动态淡化纹理(OpenGL),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11243182/