Copy link to clipboard
Copied
Hi Shachar and everyone!
I have a simple question: is it possible to use Drawbot during the Render call and / or render what's drawn on the layer / comp?
Thanx,
François
1 Correct answer
yo leroy! wassup?
well, you can't call access the comp overlay buffer during a render call,
regardless of drawbot.
you'll have to cache whatever it is you want to render during a "draw"
event call, and use that cache during the render call.
are you trying to use the drawbot tools as drawing tools for the render?
if so, then consider using some 3rd party drawing tools or even the os
tools. there have been some threads here discussing just that.
Copy link to clipboard
Copied
yo leroy! wassup?
well, you can't call access the comp overlay buffer during a render call,
regardless of drawbot.
you'll have to cache whatever it is you want to render during a "draw"
event call, and use that cache during the render call.
are you trying to use the drawbot tools as drawing tools for the render?
if so, then consider using some 3rd party drawing tools or even the os
tools. there have been some threads here discussing just that.
Copy link to clipboard
Copied
Thanx Shachar!
Yes, I have to use (and study first!) Drawbot for one of my plugins, so I was thinking, hey, why not drawing directly?
Do you think it's possible to cache what's rendered by Drawbot?
If not, I'll try some other drawing tool as you said. OpenGL may be? At least there's the GLator sample to help a bit...
Cheers,
François
Copy link to clipboard
Copied
as far as i can tell, drawbot's data structures are opaque and you can't
retrieve anything from them without using the drawbot suite, which in turn,
doesn't offer any tools for reading.
i only know of a way of drawing using any 3rd party tool and then
translating the resulting buffer to drawbot as an image, but not the other
way around...
Copy link to clipboard
Copied
I think I'll try with OpenGL or Processing.
By the way, do you know a reliable way to copy the buffer into a 3rd party api frame?
This code is from the Glator example:
for (int ix=0; ix < inputP->height; ++ix)
{
PF_Pixel8 *pixelDataStart = NULL;
PF_GET_PIXEL_DATA8( inputP , NULL, &pixelDataStart);
::memcpy( bufferP + (ix * S_GLator_EffectCommonData.mRenderBufferWidthSu ),
pixelDataStart + (ix * (inputP->rowbytes)/sizeof(GL_RGBA)),
inputP->width * sizeof(GL_RGBA));
}
It 'works' but fails with large picture... Do you use a similar code?
Cheers,
François
Copy link to clipboard
Copied
i don't see why that code would fail with large images. where does it fail?
i use a pixel by pixel code, because i don't assume the same RGBA
arrangement is used on both ends.
Copy link to clipboard
Copied
It fails on 'memcpy', when ix >= 1024...
Copy link to clipboard
Copied
is sizeof(GL_RGBA) == sizeof(PF_Pixel8)?
Copy link to clipboard
Copied
Yes, sizeof(GL_RGBA) == sizeof(PF_Pixel8) == 4
Is it a problem with the Handle size? I must admit I'm lost with memory stuff...
Thanx,
François
Edit:
I found the error.
S_GLator_EffectCommonData.mRenderBufferWidthSu maximum size was locked to 1024 by default...
For those who need it, it's in GLbase.h
Cheers,
François
Ce message a été modifié par: françois leroy
Copy link to clipboard
Copied
what error message is it giving when failing?
Copy link to clipboard
Copied
Well, it didn't show any message other than "AE encountered an error during the call of 'GLator'"...
that's why I was lost and had hard time finding the error.
But it 'works' now (I edited the previous post).
I've set the S_GLator_EffectCommonData.mRenderBufferWidthSu maximum size to 2048,
and limited the rendertexture to 2048x2048 too...
I'm not sure this is the best way, but at least it doesn't crash.
The 'sizeof(GL_RGBA)' put me on the good track!
Cheers,
François
Copy link to clipboard
Copied
oh good!
i was way off in my search for the problem...
Copy link to clipboard
Copied
thanx for the help (as usual) !
Copy link to clipboard
Copied
i did not help one bit. (but you're welcome... i guess...)
Copy link to clipboard
Copied
Even though sizeof(GL_RGBA) works in this case, technically it is not right. GL_RGBA is a macro with a constant value. On many compilers, macro constants are treated as integers and hence it results in a size of '4'.
Copy link to clipboard
Copied
Hi Gutsblow,
in fact I didn't change anything with sizeof(GL_RGBA), but with S_GLator_EffectCommonData.mRenderBufferWidthSu which was locked to 1024 in GLbase.h
I just set a higher value (2048) but couldn't find a way to change it according to output size...
Do you have any idea?
Cheers,
François
Copy link to clipboard
Copied
I don't exactly remember how the GLator sample worked, but I remember that it is not the best way to do OpenGL in AE. You can read through my posts and others' posts in this forum thread which explain various OpenGL related issues in AE
http://forums.adobe.com/thread/1004306
If all you need is 2D rendering, OpenGL is an overkill. The context and buffer management in OpenGL can get very tedious & complicated and not to mention the diverse GPU hardware which have their own way of doing things. You're much better off sticking with a regular 2D drawing library.
Copy link to clipboard
Copied
Hi Gutsblow,
in fact, I was more trying to understand the process of grabing, caching, storing a buffer, using it with a third party api, etc...
OpenGl is well documented, and the SDK provides an example (+ the threads on the forum), that's why I studied this case (and CCU, for direct access to the buffer).
But If you have any other example of 3rd party drawing tool integration (I first thought DrawBot was one of them), I'm really interested!
Thanx,
François
Copy link to clipboard
Copied
I'm also very interested in seeing an example. I've tried unsuccessfully with openFrameworks.
Copy link to clipboard
Copied
openFrameworks isn't the right framework as it does more than image rendering and it's designed to create apps. I would recommend using something just for drawing, like Quartz on the Mac, GDI on Windows or Cairo for both Mac/Win, athough I don't have much experience using these libraries.

