NAME
Prima::GLWidget - general purpose GL drawing area / widget
SYNOPSIS
use OpenGL;
use Prima qw(Application GLWidget);
my $window = Prima::MainWindow-> create;
$window-> insert( GLWidget =>
pack => { expand => 1, fill => 'both'},
onPaint => sub {
my $self = shift;
glClearColor(0,0,1,1);
glClear(GL_COLOR_BUFFER_BIT);
glOrtho(-1,1,-1,1,-1,1);
glColor3f(1,0,0);
glBegin(GL_POLYGON);
glVertex2f(-0.5,-0.5);
glVertex2f(-0.5, 0.5);
glVertex2f( 0.5, 0.5);
glVertex2f( 0.5,-0.5);
glEnd();
glFlush();
}
);
run Prima;
DESCRIPTION
GLWidget class takes care of all internal mechanics needed for interactions between OpenGL and Prima. The widget is operated as a normal Prima::Widget
class, except that all drawing can be done also using gl
OpenGL functions.
API
Properties
- gl_config %HASHREF
-
gl_config
contains requests to GL visual selector. See description of keys in "Selection of a GL visual" in Prima::OpenGL.
Events
- on_size
-
By default, sets
glViewport
to the new widget size. Overrideon_size
if that is not desired.
AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.