Hi,
I want to be able to blend two textures according to a gray scale mask. The first texture should show up in the white area of the mask. The second texture should show up in the black area of the mask. And both textures should be blended accordingly in the gray areas.
I had no problem doing this using a fragment program, but I would like to implement this without using any shaders.
I figured I would have to render the object multiple times and use glBlendFunc to blend the textures. I’m able get the first texture blended correctly but I can’t figure out how to blend in the second texture. Here’s what I have so far:
glDisable(GL_BLEND);
//Draw object with gray scale mask texture
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO,GL_SRC_COLOR);
//Draw object with first blended texture
//This will fill in the white areas
What should I do next in order to blend in the second texture so that it fills in the black area of the original mask? Is possible to do with the technique I’m using? Should I use an alpha mask instead of a gray scale mask? Any help is greatly appreciated.