Hello

I am loosing my wits here, and must be misunderstanding something basic.

In short, does anyone have a working implementation of copyRenderedTextureForCGLContext that handles flipping textures while properly retaining texture coordinates? I cant use the QCPluginContext outputImageProviderFromTextureWithPixelFormat because I am doing multipass rendering within the plugin.

In long:

I have working plugin which implements the QCPluginOutputImageProtocol, that takes in an image, processes it within an FBO and outputs the texture. My plugin implements

- (GLuint) copyRenderedTextureForCGLContext:(CGLContextObj)cgl_ctx pixelFormat:(NSString*)format bounds:(NSRect)bounds isFlipped: (BOOL*)flipped

and renders to an FBO within this function to an attached texture. My plugin does multiple passes within this function. However, my issue is handling flipping while retaining proper texture coordinates. Within the FBO, I am using convolution GLSL Shaders for image processing. Ff I do not handle flipping, the texture coordinates to my shader are correct. If I handle flipping, my texture coordinates are not being properly flipped along with the image, resulting in the first pass being flipped image wise, but not coordinate wise.

In pseudo code:

copyRenderedTextureForCGLContext
{
GLuint pass1 = renderFBOToTexture(image1, flipped); // coordinates get messed up if flipped is true GLuint pass2 = renderFBOToTexture(pass1, NO); // dont flip after the first FBO, since weve corrected, the following passes are correct. GLuint pass3 = renderFBOToTexture(pass2, NO); // dont flip after the first FBO, since weve corrected. GLuint pass4 = renderFBOToTexture(pass3, NO); // dont flip after the first FBO, since weve corrected. GLuint pass5 = renderFBOToTexture(pass4, NO); // dont flip after the first FBO, since weve corrected.

        // delete pass 1 - 4 since we dont need them (code omitted)
        return pass5; // our final output image
}

I implement flipping by doing the following, after resetting the projection, texture and modelview matrices

if(flipped)
  glOrtho(0, width, 0, height, -1, 1);
else
    glOrtho(0, width, 0, height, -1, 1);

the top ortho call properly flips the image so it appears correct. I then bind my texture and enable the GLSL program, and draw to a quad.

Thanks for reading through this, i know its a lot to digest :)
Im happy to supply the project, as it will be open source once its available.

The blurs are VERY fast, and id love to get these working properly. They are meant for realtime video use, and are a huge step up from the provided Apple blurs, and am more than willing to share credit on the final plugins, as this is *really vexing me*

Thank you very much!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to