Multiple textures with ofGLProgrammableRenderer and shaders

hi,

im alpha blending two textures using ofGLProgrammableRenderer on a shader.
it works great with two textures that are the same size and in the same position.
the frag shader blending looks like this,

 vec4 texel0 = texture(src_tex_unit0, texCoordVarying);
 vec4 texel1 = texture(src_tex_unit1, texCoordVarying);
 gl_FragColor = vec4(texel0.rgb, texel0.a * texel1.a);

where this fails is when the two textures are in different positions,
this is because texCoordVarying is only correct for one of the textures and not the other.

not sure of the best way to get the correct texCoordVarying of the other texture…
think the only way is to pass in another set of texcoord into the vert shader and call it texcoord2, that way a second texCoordVarying2 can be calculated for the other texture. then it should be possible to blend two textures with different sizes and positions.

is this the correct?

yeah, correct, take a look at this post to see how to add additional attributes to an ofVboMesh: ofVbo / ofVboMesh generic attributes?

ok great, will try to do it that way.