What I am trying to do is have the first ARB use the input frame and output to a pbuffer (that will be stored in an array in the _multiTexHelp object), the second ARB is to take it's input from that pbuffer and outputs to the screen as per normal. I am using the EffectHelpers.mm code (PBuffer_Begin, PBuffer_End, PBuffer_Use) from the DirectionalBlur example. I am only concerned with hardware rendering right now...
What it is doing is only applying the latter ARB to a black input. I am not sure if it is not storing the first result properly to the pbuffer, or if it is not taking that pbuffer as input for the second. With the example code below I get a white screen (inverted from the black input). I have tried replacing "[_multiTexHelp getPbufferAtIndex:0]" with the Effect_PBuffer* itself and there was no change in behavior.
If you have any ideas why the pbuffers are not storing the output of shader 1 or not using that for the input of shader 2 it would be greatly appreciated :D
here is some of the code I have for the hardware rendering, I have already created a pbuffer and added it to the _multiTexHelp object:
glEnable( GL_FRAGMENT_PROGRAM_ARB );
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, _doesSomethingCoolProgramID );
[inTex bind];
[inTex enable];
PBuffer_Begin([_multiTexHelp getPbufferAtIndex:0]);
glBegin(GL_QUADS);
{
glTexCoord2f( tLeft, tBottom );
glVertex2f( left, bottom );
glTexCoord2f( tRight, tBottom );
glVertex2f( right, bottom );
glTexCoord2f( tRight, tTop );
glVertex2f( right, top );
glTexCoord2f( tLeft, tTop );
glVertex2f( left, top );
}
glEnd();
glDisable( GL_FRAGMENT_PROGRAM_ARB );
PBuffer_End([_multiTexHelp getPbufferAtIndex:0]);
glEnable( GL_FRAGMENT_PROGRAM_ARB );
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, _invertProgramID );
// Don't affect alpha!
glProgramLocalParameter4fARB( GL_FRAGMENT_PROGRAM_ARB, 0, bright, bright, bright, 1.0 );
PBuffer_Use([_multiTexHelp getPbufferAtIndex:0]);
glBegin(GL_QUADS);
{
glTexCoord2f( tLeft, tBottom );
glVertex2f( left, bottom );
glTexCoord2f( tRight, tBottom );
glVertex2f( right, bottom );
glTexCoord2f( tRight, tTop );
glVertex2f( right, top );
glTexCoord2f( tLeft, tTop );
glVertex2f( left, top );
}
glEnd();
glDisable( GL_FRAGMENT_PROGRAM_ARB );
[inTex disable];
glBindTexture ([inTex target], 0);
glPopAttrib();