NAME
Win32::GUI::OpenGLFrame - Integrate OpenGL with Win32::GUI
SYNOPSIS
use Win32::GUI::OpenGLFrame qw(w32gSwapBuffers);
my $oglw = $win->AddOpenGLFrame(...);
DESCRIPTION
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.
EXPORTS
The function c<w32gSwapBuffers> is exportable on request - nothing is exported by default.
AVAILABLE FUNCTIONS
w32gSwapBuffers
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.
Win32::GUI::OpenGLFrame Object
Constructor: $win->AddOpenGLFrame()
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:
- Use
-init
for OpenGL initialisation function -
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. - Use
-reshape
rather than-onResize
-
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
-onReszie
option. - Use
-display
rather than-onPaint
-
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
-onPaint
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 ALSO
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
- OpenGL - http://www.opengl.org/
- Perl OpenGL (POGL) - http://graphcomp.com/opengl/
- OpenGL for Win32 - http://www.bribes.org/perl/wopengl.html
- The OpenGL Utility Toolkit (GLUT) - http://www.opengl.org/resources/libraries/glut/
- OpenGL on MSDN - http://msdn.microsoft.com/en-gb/library/dd374278%28VS.85%29.aspx
SUPPORT
Contact the author for support.
AUTHORS
Robert May (robertmay@cpan.org
)
COPYRIGHT AND LICENSE
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.