You aren't caching and restoring the fbo state, or draw buffer state.

Whenever you set a value like, current texture, fbo, its doesnt "push" the old 
value to a stack, it just overwrites (forever) it until someone comes around nd 
changes it again, even for multiple frames.

Check out v002  on github we have reusable fbo class that captures states for 
QC, or learn how to restore states by using glGet, and push/pop/Attrib.

 
On Nov 22, 2012, at 7:45 AM, Christophe Leske <i...@multimedial.de> wrote:

> Am 21.11.12 17:41, schrieb Christopher Wright:
>> rough pseudo-code:
>> 
>> glGenTextures(1, &scaledTexture); // make the destination scaled texture
>> // TODO: set up texture dimensions via glTexImage2D
>> glGenFramebuffers(1, &myFBO); // make the drawing FBO to perform the scaling
>> glBindFramebuffer(GL_FRAMEBUFFER_EXT, myFBO);
>> glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, 
>> GL_TEXTURE_2D, scaledTexture, 0);
>> glDrawBuffer(GL_COLOR_ATTACHMENT0);
>> 
>> // bind source texture -- you might just use the bindTextureRep call here?
>> glBindTexture(GL_TEXTURE_2D (or rect?), yourInputTexture);
>> 
>> // set up projection -- pixel-for-pixel orthographic
>> glMatrixMode(GL_MODELVIEW);
>> glLoadIdentity();
>> glMatrixMode(GL_PROJECTION);
>> glLoadIdentity();
>> glOrtho(0,0,width,0,height, -1, 1);
>> 
>> // draw the source to the destination
>> // TODO: if better-than-bilinear-scaling is desired, add a shader here to do 
>> bicubic or something
>> glBegin(GL_QUADS);
>> glTexCoord2f(0,0);
>> glVertex2f(0,0);
>> glTexCoord2f(1,0);
>> glVertex2f(width,0);
>> glTexCoord2f(1,1);
>> glVertex2f(width,height);
>> glTexCoord2f(0,1);
>> glVertex(0, height);
> This barfed at me - I presume this is meant to be glVertex2D, right?
> 
> 
>> glEnd();
>> 
>> // done!  scaledTexture now has the scaled contents using bilinear scaling 
>> in hardware
>> // make sure to delete fbos and texture when done.
>> // ALSO: RESTORE ALL THE GL STATE!  NOT DOING SO WILL BLOW UP!
>> 
> Sorry for my ignorance, but what is the GL state and how do I restore it?
> 
> 
> Thanks, 
> 
> -- 
> Christophe Leske
> multimedial.de
> 
> ----------------------------------------
> www.multimedial.de - i...@multimedial.de
> Hohler Strasse 17 - 51645 Gummersbach
> +49(0)2261-99824540 // +49(0)177-2497031
> ----------------------------------------
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/quartzcomposer-dev/anton%40noiseindustries.com
> 
> This email sent to an...@noiseindustries.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to