0

Note: I am using GLKBaseEffect.

Im not sure what i could be doing wrong. Basically, for my GLKBaseEffect, i have setting up 2 textures. But i am only seeing the 1st texture (texture2d0) rendered. I would like to have the 2nd texture (texture2d1) to be blended with the 1st texture.

Perhaps my blend function is incorrect, or am i using the GLKBaseEffect improperly. Is there anything obvious that im doing wrong?

Btw, both of my images are RGB (.PNG format) with no alpha channel. My texture2d1 image (below) is the texture that i want to blend over my first texture. Like a 50% overlay type of blend. enter image description here

////glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
glEnable(GL_DEPTH_TEST);

[EAGLContext setCurrentContext:self.context];

// 1st texture
self.photoEffect = [[GLKBaseEffect alloc] init];
self.photoEffect.light0.enabled = GL_FALSE;
self.photoEffect.light0.diffuseColor = GLKVector4Make(1.0f, 1.0f, 1.0f, 0.5f);
self.photoEffect.lightingType = GLKLightingTypePerPixel;
self.photoEffect.lightModelAmbientColor = GLKVector4Make(1.0f, 1.0f, 1.0f, 0.5f);

// 2nd texture
self.photoEffect.texture2d1.envMode =  GLKTextureEnvModeModulate;
self.photoEffect.texture2d1.target = GLKTextureTarget2D;
self.photoEffect.texture2d1.enabled = TRUE;

UIImage *styleImage = [UIImage imageNamed:@"style_1.png"];
_photoStyleTextureId = [ImageLoader LoadGLKTextureInfo_ByImage:styleImage];
self.photoEffect.texture2d1.name = _photoStyleTextureId;
AlvinfromDiaspar
  • 6,611
  • 13
  • 75
  • 140
  • Im currently looking at glBlendFunc examples. This is helping a lot! http://www.machwerx.com/2009/02/11/glblendfunc/ – AlvinfromDiaspar May 12 '13 at 20:03
  • Ok, i pretty much did all the combinations in the above link in my previous comment. No matter what i do the result texture doesn't seem to be affected in any way. :( – AlvinfromDiaspar May 12 '13 at 20:08

0 Answers0