OpenGL ES と GLKit を使用して、このようなものを描画しようとしています
しかし、私はこれを取得しています
テクスチャは透明ですが、モデルの上位レイヤは、ブレンドする代わりに下位のテクスチャを置き換えます。どうにかして修正することは可能ですか?
- (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);
}
ありがとうございました。