OpenGL.pm (PDL-2.076) | : | OpenGL.pm (PDL-2.077) | ||
---|---|---|---|---|
skipping to change at line 228 | skipping to change at line 228 | |||
OpenGL::GLUT::glutKeyboardFunc( \&_pdl_fake_KeyPress ); | OpenGL::GLUT::glutKeyboardFunc( \&_pdl_fake_KeyPress ); | |||
OpenGL::GLUT::glutMouseFunc( \&_pdl_fake_button_event ); | OpenGL::GLUT::glutMouseFunc( \&_pdl_fake_button_event ); | |||
OpenGL::GLUT::glutMotionFunc( \&_pdl_fake_MotionNotify ); | OpenGL::GLUT::glutMotionFunc( \&_pdl_fake_MotionNotify ); | |||
OpenGL::GLUT::glutDisplayFunc( \&_pdl_display_wrapper ); | OpenGL::GLUT::glutDisplayFunc( \&_pdl_display_wrapper ); | |||
OpenGL::GLUT::glutSetOption(OpenGL::GLUT::GLUT_ACTION_ON_WINDOW_CLOSE(), OpenG L::GLUT::GLUT_ACTION_GLUTMAINLOOP_RETURNS()) if OpenGL::GLUT::_have_freeglut(); | OpenGL::GLUT::glutSetOption(OpenGL::GLUT::GLUT_ACTION_ON_WINDOW_CLOSE(), OpenG L::GLUT::GLUT_ACTION_GLUTMAINLOOP_RETURNS()) if OpenGL::GLUT::_have_freeglut(); | |||
OpenGL::GLUT::glutMainLoopEvent(); # pump event loop so window appears | OpenGL::GLUT::glutMainLoopEvent(); # pump event loop so window appears | |||
} | } | |||
sub DESTROY { | sub DESTROY { | |||
my ($self) = @_; | my ($self) = @_; | |||
print __PACKAGE__."::DESTROY called (win=$self->{glutwindow}), GLUT says ", Op | ||||
enGL::GLUT::glutGetWindow(), "\n" if $PDL::Graphics::TriD::verbose; | ||||
OpenGL::GLUT::glutMainLoopEvent(); # pump to deal with any clicking "X" | ||||
if (!OpenGL::GLUT::glutGetWindow()) { | ||||
# "X" was clicked, clear queue then stop | ||||
@{ $self->{xevents} } = (); | ||||
OpenGL::GLUT::glutMainLoopEvent(); # pump once | ||||
return; | ||||
} | ||||
OpenGL::GLUT::glutSetWindow($self->{glutwindow}); | ||||
OpenGL::GLUT::glutReshapeFunc(); | OpenGL::GLUT::glutReshapeFunc(); | |||
OpenGL::GLUT::glutCloseFunc(); | OpenGL::GLUT::glutCloseFunc(); | |||
OpenGL::GLUT::glutKeyboardFunc(); | OpenGL::GLUT::glutKeyboardFunc(); | |||
OpenGL::GLUT::glutMouseFunc(); | OpenGL::GLUT::glutMouseFunc(); | |||
OpenGL::GLUT::glutMotionFunc(); | OpenGL::GLUT::glutMotionFunc(); | |||
OpenGL::GLUT::glutDisplayFunc(); | OpenGL::GLUT::glutDestroyWindow($self->{glutwindow}); | |||
glutDestroyWindow($self->{glutwindow}); | OpenGL::GLUT::glutMainLoopEvent() for 1..2; # pump so window gets actually clo | |||
sed | ||||
delete $self->{glutwindow}; | delete $self->{glutwindow}; | |||
} | } | |||
=head2 default GLUT callbacks | =head2 default GLUT callbacks | |||
These routines are set as the default GLUT callbacks for when GLUT windows | These routines are set as the default GLUT callbacks for when GLUT windows | |||
are used for PDL/POGL. Their only function at the moment is to drive a | are used for PDL/POGL. Their only function at the moment is to drive a | |||
fake XEvent queue to feed the existing TriD GUI controls. At some point, | fake XEvent queue to feed the existing TriD GUI controls. At some point, | |||
the X11 stuff will be deprecated and we can rewrite this more cleanly. | the X11 stuff will be deprecated and we can rewrite this more cleanly. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 13 lines changed or added |