Prima::GLWidget - general purpose GL drawing area / widget
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;
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.
Prima::Widget
gl
gl_config contains requests to GL visual selector. See description of keys in "Selection of a GL visual" in Prima::OpenGL.
gl_config
By default, sets glViewport to the new widget size. Override on_size if that is not desired.
glViewport
on_size
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, OpenGL
To install Prima::OpenGL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prima::OpenGL
CPAN shell
perl -MCPAN -e shell install Prima::OpenGL
For more information on module installation, please visit the detailed CPAN module installation guide.