Я пытаюсь сделать что-то вроде этого, используя OpenGL ES и GLKitGLKit и прозрачность
Но я получаю это
Хотя текстура си прозрачный, верхние слои модели вместо текстуры заменяют текстуру. Можно ли это как-то исправить?
- (void)setup {
self.effect = [[GLKBaseEffect alloc] init];
NSURL *textureURL = [[NSBundle mainBundle] URLForResource:@"portalTexture_ALIENS" withExtension:@"png"];
texture = [GLKTextureLoader textureWithContentsOfURL:textureURL options:nil error:nil];
if (texture != nil) {
self.effect.texture2d0.enabled = GL_TRUE;
self.effect.texture2d0.envMode = GLKTextureEnvModeReplace;
self.effect.texture2d0.target = GLKTextureTarget2D;
self.effect.texture2d0.name = texture.name;
}
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, texturedPortalVerts);
glEnableVertexAttribArray(GLKVertexAttribTexCoord0);
glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, texturedPortalTexCoords);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- (void)draw {
[self.effect prepareToDraw];
glDrawArrays(GL_TRIANGLES, 0, texturedPortalNumVerts);
}
спасибо.