Integrating PerlMagick with Perl OpenGL (POGL)
Posted: 2007-06-13T03:05:36-07:00
I'm the primary owner of CPAN's OpenGL module, and would like to work with PerlMagick's authors to tightly integrate our two modules.
POGL supports mapping GPU memory to CPU memory (via Frame Buffer Objects and Vertex Buffer Objects). POGL provides an OpenGL::Array object that wraps C buffers, which allows Perl developers to efficiently share/pass C arrays without copying/converting/casting the data.
What I'd like to do is add/expose an interface in PerlMagick (via XS) to do the following:
1. Use a C pointer (to an RGB or RGBA buffer from POGL) and create a PerlMagick image object or blob (directly caching/using the C pointer - not a copy), and
2. Get a C pointer to an RGA/RGBA buffer from a PerlMagick image object or blob (a direct reference, not a copy).
This would provide a mapped buffer between the GPU and IM, and would be much faster than using GetPixels, converting the resulting Perl array into a C array, do a GPU operation, to convert it back to a Perl array, then finally back to SetPixels.
IM provides a perfect compliment to POGL by loading/creating/saving textures, as well as providing data processing for vertex data (stored as images).
You can read about POGL's performance at http://graphcomp.com/opengl/benchmarks/
Ideally, I'd like to see this added to PerlMagick (I'd be happy to help); alternately, I could add the IM interfaces within POGL. I'd prefer the former; the latter is a fallback if no one has the time to implement this in PerlMagick.
If anyone knows how to contact PerlMagick's authors (Kyle Shorter?), please send them my way.
Thanks! - Bob Free
POGL supports mapping GPU memory to CPU memory (via Frame Buffer Objects and Vertex Buffer Objects). POGL provides an OpenGL::Array object that wraps C buffers, which allows Perl developers to efficiently share/pass C arrays without copying/converting/casting the data.
What I'd like to do is add/expose an interface in PerlMagick (via XS) to do the following:
1. Use a C pointer (to an RGB or RGBA buffer from POGL) and create a PerlMagick image object or blob (directly caching/using the C pointer - not a copy), and
2. Get a C pointer to an RGA/RGBA buffer from a PerlMagick image object or blob (a direct reference, not a copy).
This would provide a mapped buffer between the GPU and IM, and would be much faster than using GetPixels, converting the resulting Perl array into a C array, do a GPU operation, to convert it back to a Perl array, then finally back to SetPixels.
IM provides a perfect compliment to POGL by loading/creating/saving textures, as well as providing data processing for vertex data (stored as images).
You can read about POGL's performance at http://graphcomp.com/opengl/benchmarks/
Ideally, I'd like to see this added to PerlMagick (I'd be happy to help); alternately, I could add the IM interfaces within POGL. I'd prefer the former; the latter is a fallback if no one has the time to implement this in PerlMagick.
If anyone knows how to contact PerlMagick's authors (Kyle Shorter?), please send them my way.
Thanks! - Bob Free