When you set the display mode for OpenGL, you enable all the coolness of 3D rendering, but you disable the bread-and-butter raster SDL functionality like fill() and blit(). Since the GUI libraries use those surface methods extensively, they cannot readily be used in OpenGL displays.
Lamina provides the PanelOverlaySurface class, which bridges between the two.
The 'surf' attribute is a surface, and can be drawn on, blitted to, and passed to GUI rendering functions for alteration. The 'display' method displays the surface as a transparent textured quad in the OpenGL model-space. The 'refresh' method indicates that the surface has changed, and that the texture needs regeneration. The 'clear' method restores the blank and transparent original condition.
There are four demonstration scripts in the distribution: The PGU and Ocemp versions of my GUI comparison script have been converted to use PanelOverlays, and the clock-spinner has been replace with a rotating wireframe sphere, to show the 3D quality. The other two scripts are conversions of Nehe tutorial lesson04 for Ocemp and PGU; the GUI provides buttons to toggle the image rotations on and off.
This implementation requires you to stipulate where the PanelOverlay will be drawn, and, if your surface is not screen-sized, to make adjustments for mouse coordinates. This is most useful if your viewer (camera) does not pan or pivot. I may add a feature to pin the PanelOverlay to a fixed location in eyespace.
The file can be found at
Log in to post a comment.