Perl Opengl Article Index for
Perl
Shopping
Opengl
Website Links For
Perl
 

Information About

Perl Opengl




  Caption A screenshot illustrating FBO and Vertex/Fragment program extensions via '''POGL'''
  Developer Stan Melax, Kenneth Albanowski, Ilya Zakharevich, Jean-Louis Morel, Bob Free
  Latest Release Version '''056'''
  Latest Release Date July 29 , 2007
  Operating System Cross-platform
  Genre 3D Computer Graphics Software (library/API)
  License Perl Artistic And GPL Licenses
  Website graphcompcom/opengl


Perl OpenGL ('''POGL''') is a portable, compiled wrapper Library that allows OpenGL to be used in the Perl Programming Language .

POGL provides support for most OpenGL 2.0 extensions, abstracts OS-specific proc handlers, and supports GLUT , a simple cross-platform windowing interface.

POGL provides additional Perl-friendly APIs for passing/returning strings and arrays.


PLATFORM SUPPORT


  • Windows: NT/XP/Vista

  • MacOSX: 10.4/10.5

  • Linux: Fedora 6, Debian/Ubuntu (Dapper/Etch), Gentoo

  • FreeBSD

  • Solaris


Confirmed with

  • nVidia (Quadro-110M,6600,6800,7300,7800,7950,8800)

  • ATI (Radeon 9000/9200, FireGL)

  • Cygwin/X (Mesa)



INTEROPERABILITY



ImageMagick - Image Loading/Modification/Saving


The POGL team has collaborated with the ImageMagick team to add PerlMagick APIs that allow GPUs and ImageMagick to share cache buffers via C pointers - optimizing performance for FBOs and VBOs - for use with loading/saving textures and GPGPU data transfer.

These APIs have been added to ImageMagick 6.3.5:

  • Get('Scene') - returns the number of scenes in an IM image.

  • Get('Quantum') - returns IM's cache depth.

  • GetImagePixels() - returns a C pointer to IM's image cache.

  • SyncImagePixels() - sync's IM's image cache after a write (for large/paged images).


Benchmarks demonstrate GetImagePixels is 188x faster than ImageToBlob or GetPixels.


FFmpeg - Video Frame Textures


CPAN's FFmpeg module may be used in conjunction with POGL and the above Image::Magick APIs to map video to OpenGL textures.


PERFORMANCE

POGL provides OpenGL performance comparable to that of C, and consistently outperforms
other Perl Bindings like SDL::OpenGL and other language bindings like Python.



COMPARISON WITH OTHER LANGUAGE BINDINGS



Perl vs C

General Purpose GPU ( GPGPU ) processing is one area in which Perl compares with compiled languages in terms of performance.

GPU benchmarks show no significant performance differences between C and Perl (via POGL), when rendering a realtime 3D animated object with dynamically generated texturemaps.

GPGPU Vertex Shaders can execute complex c-like code on large arrays of data, rarely touching the CPU. The CPU is left doing event handling, system calls, disk I/O and UI - which contributes a minor portion of the overall processing time. The performance difference between C and Perl becomes statistically insignificant.

In the case where GPU vertex shader code is being dynamically generated, Perl's optimized, interpretive string handling can provide better performance than C.

Since GPU performance depends on tight integration with an OS' windowing system (WGL/X11/etc), OpenGL APIs (particularly GPGPU extensions) are OS-dependent. POGL abstracts these dependencies, allowing portable code.



Perl vs Java

When using Perl for online service via Apache Mod_perl or ActivePerl ISAPI , Perl consistently outperforms Java - see benchmarks {Link without Title} .

In addition, Perl tends to rely on more binary modules than Java, providing additional performance benefits. POGL is a compiled module, and is used in conjunction with compiled imaging modules (such as ImageMagick ) for loading/saving data arrays ( Textures ).

As of this writing, the Java OpenGL ( JOGL ) binding does not support Framebuffer s and other advanced GPGPU extensions.


Perl vs Python / Ruby


As of this writing, Python and Ruby OpenGL bindings do not support Framebuffers and other advanced GPGPU extensions.

  • Benchmarks demonstrate that POGL performs over 20% faster than Python {Link without Title} . This includes a blog posting by PyOpenGL's author explaining why Python's OpenGL implementation is likely to be slower than POGL. These benchmarks are based on Trislam, an independent OpenGL benchmark; these results were independently reproduced by Trislam's author.

  • Benchmarks comparing performance between the Perl and Ruby languages are available on the Computer Language Shootout .



OPENGL OBJECTS


POGL provides specialized objects that dramatically enhance Perl performance.
POGL objects store data as typed C arrays, and pass data between APIs using C pointers -
eliminating the need to copy/convert/cast when passing data between interfaces.

The result is maximized performance, with the added flexibility/portability of Perl.


OpenGL::Array (OGA)


OGAs store OpenGL data as typed C arrays. OGAs may be populated by C pointer, Perl packed arrays (strings) or Perl arrays.

OGAs may be bound/mapped to VBOs to share data between the GPU and Perl.

Accessor methods provide a means to get/set array elements by C pointer, packed arrays or Perl arrays.

Documentation can be found on POGL's Developer Site


OpenGL::Image (OGI)


OGIs use OGAs to wrap image buffers from various imaging libraries. OGI simplifies loading/modifying/saving OpenGL textures, FBOs and VBOs.

OGI provides an extensible plug-in architecture to support new imaging libraries: OGI supports ImageMagick (v6.3.5 or newer), and by default Targa (uncompressed RGBA files).

OGI provides direct C pointer access to ImageMagick's image cache, resulting in dramatic performance in transferring images/data between the GPU and IM.

Documentation can be found on POGL's Developer Site

OGI is available on CPAN as a separate OpenGL-Image module {Link without Title} .


OpenGL::Shader (OGS)


The OSG module abstracts OpenGL APIs for ARB (assembly), Cg and GLSL shading languages.


= new OpenGL::Shader();
my = lc(->GetType());
my = ->LoadFiles("fragment.","vertex.");

->Enable();
->SetVector('surfacecolor',1.0,0.5,0.0,1.0);
->SetMatrix('xform',);

# Draw here

->Disable();


Documentation can be found on POGL's Developer Site

OGS is available on CPAN as a separate OpenGL-Shader module {Link without Title} .


SAMPLE RENDERINGS