Hello there,
first of all, I would like to thank everyone who answered and helped me
in my endeavour.
The main problem seems to be that I do not know enough about how OpenGl
is working. I have done 3d development before, but with highly
abstracted frameworks like Irrlicht and in scripting languages like
Lingo in Adobe Director.
Doing OpenGl in C is another pair of shoes - so for instance, I don't
know anything about state machines, nor what would be needed to be saved
and restored for my scaling.
Heck, I do simply *not know* what is being affected by my operations to
scale down that image that would need to be saved and be restored.
Did you look at the FBO code in v002 at all? DId you read the docs on
glPushAttrib? It does not capture "all state", just some state, you
still need to capture the
current FBO binding
current read buffer
current draw buffer
(and any other state you change).
Ok, so first, you got me. :-)
I was tired and frustrated, and, I admit it, I am also a lazy bum and
didn't read the FBO code in your project.
But again, there are so many concepts and acronyms that I cannot figure
out for the moment that I simply do not know where to start.
FBO = frame buffer object? I am not even clear what this is (despite
Christophers explainaitions), nor what the frame buffer exactly does.
Is the frame buffer where the next frame to be drawn is written to?
current fbo binding = what is bound to what and where for which reason?
Is this the binding of an otherwise unbound object to the frame buffer
in order for it to be drawn?
read buffer = draw buffer = hu?
Now I understand that you are not here to teach me about OpenGl, yet
when I started, I just had a few lines that locked an image, scaled it
down using the CPU. According to the docs provided by Apple and
Christopher Wright, it seemed quite feasible to try to do it in hardware
in order to boost the speed a bit. 300 additional lines of code later, I
am not so sure about this anymore. The bulk of it seems to be working
(=no error is thrown), yet I haven't been able to read out the pixel
data just yet.
I am having concerns that these many lines added to the patch will
indeed result in a somewhat faster scaling method?
Personally, I am all for it - I like to learn, even if it is a bit
frustrating, so if there is any docs I could read in a fair(!) amount of
time, then please let me know.
and /make sure to reset them once you overwrite them/
ie:
PushAttrib, then
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &previousFBO);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &previousReadFBO);
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &previousDrawFBO);
Thank you for that, I will add that to my code.
DO STUFF HERE, ASSUMING YOU DO NOT DO ANYTHING OTHER THAN ALTER THE
ABOVE STATE
RESET STATE
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, previousFBO);
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, previousReadFBO);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, previousDrawFBO);
popAttrib
OK, will do!
State machines are a pain in the ass, and managing all of this can be
difficult. Just be sure you pay close attention to the details of what
you are doing in GL, since pretty much /everything/ is state, you need
to manage /everything, /especially because Quartz Composer manages
things in a black box before, and after your plugin runs - so while
you may have something that works in one comp, it might not in another.
IE: forgetting to test / reset FBO binding may allow a plugin to
directly render into the viewer, but break Render In Image, since
Render In Image uses an FBO (or two).
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/archive%40mail-archive.com
This email sent to arch...@mail-archive.com