Win32::GUI::OpenGLFrame - Integrate OpenGL with Win32::GUI
use Win32::GUI::OpenGLFrame qw(w32gSwapBuffers); my $oglw = $win->AddOpenGLFrame(...);
Win32::GUI::OpenGLFrame provides a binding between the perl OpenGL module and Win32::GUI. If all you want is windows with OpenGL content, the the OpenGL module provides a binding to the Win32 glut windowing library. This module will be useful if the OpenGL content is a smaller part of your GUI - I.e. you want to mix OpenGL output with other Win32 controls.
The interface should be mostly familar to anyone with Win32::GUI experience, although it has been modified to try to make it more intuitave for those used to programming with the glut interface.
Familarity with both Win32::GUI and the perl OpenGL bindings are assumed.
The function c<w32gSwapBuffers> is exportable on request - nothing is exported by default.
This function swaps the front and back buffers on a double-buffered rendering context. Acts on the curretly active rendering context. It does nothing (and so is safe to call) on a single buffered rendering context. Equivilent to the glutSwapBuffers() function.
Creates a child window of c<$win> with an OpenGL rendering context associated with the window. Most of the standard Win32::GUI::Window options are available with the following additions and restrictions:
-init
The -init option supplies a function callback in which OpenGL initialiastion can be performed. The OpenGL rendering context is createed and made currrent before the callback is made. This is typically used for initialising views, textures etc.
The Win32::GUI::OpenGLFrame object is passed as the only parameter into the -init callback.
-reshape
-resize
This corresponds to the glut resize event handler. The OpenGL rendering context for the window is made active before the callback is made. The width and height of the window's client area are provied as parameters to the callback.
If no handler is supplied, the default handler make the OpenGL viewport match the size of the window.
It is an error to use the -reszie option.
-reszie
-display
-paint
This corresponds to the glud display event handler. The OpenGL rendering context for the window is made active before the callback is made. The Win32::GUI::OpenGLFrame object is passed as the only parameter in the <-display> callback.
If no hander is supplied, the deafult handler clears the view.
It is an error to use the -paint option.
-doublebuffer
The <-doublebuffer> option is a boolean indicating whether the created rendering context should be double buffered or not.
-depth
The <-depth> option is a boolean indicating whether a depth buffer should be requested. If it is then a 32-bit depth buffer s requested.
See the demos distributed with the module for further inspiration. If you have a recent Win32::GUI installation then try the demo browser by issuing the following command:
C:\> win32-gui-demos
Contact the author for support.
Robert May (robertmay@cpan.org)
robertmay@cpan.org
Copyright (C) 2006..2009 by Robert May
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Win32::GUI::OpenGLFrame, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::GUI::OpenGLFrame
CPAN shell
perl -MCPAN -e shell install Win32::GUI::OpenGLFrame
For more information on module installation, please visit the detailed CPAN module installation guide.