AG_GLView *
AG_GLViewNew
(AG_Widget
*parent, Uint flags);
void
AG_GLViewSetBgColor
(AG_GLView
*glv, AG_Color
c);
void
AG_GLViewSizeHint
(AG_GLView
*glv, int w,
int h);
void
AG_GLViewDrawFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewOverlayFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewUnderlayFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewScaleFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewKeydownFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewKeyupFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewButtondownFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewButtonupFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
void
AG_GLViewMotionFn
(AG_GLView
*glv, void (*fn)(AG_Event
*), const char
*args, ...);
The AG_GLViewNew
() function allocates,
initializes, and attaches a new AG_GLView
widget.
Acceptable flags include:
- AG_GLVIEW_BGFILL
- Clear the widget background with the specified color (see
AG_GLViewSetBgColor
()).
- AG_GLVIEW_HFILL
- Expand horizontally in parent (equivalent to invoking
AG_ExpandHoriz(3)).
- AG_GLVIEW_VFILL
- Expand vertically in parent (equivalent to invoking
AG_ExpandVert(3)).
- AG_GLVIEW_EXPAND
- Shorthand for
AG_GLVIEW_HFILL|AG_GLVIEW_VFILL
.
AG_GLViewSetBgColor
() specifies the
background color (effective only if AG_GLVIEW_BGFILL
is set).
AG_GLViewSizeHint
() suggests an initial
widget size in pixels.
The AG_GLViewDrawFn
() registers a the
rendering function (specified in
AG_Event(3)
format). Prior to invoking this function, the widget will set the
glViewport(3)
to the widget area, save the current OpenGL matrices and load the
widget-specific matrices.
AG_GLViewOverlayFn
() registers a function
that will be invoked after rendering, after the GUI matrices and viewport
have been restored. It is typically used to draw text or controls
independently of the projection and viewing matrices. Similarly,
AG_GLViewUnderlayFn
() registers a function that will
be invoked before rendering. Both overlay and underlay callbacks may invoke
standard Agar GUI primitives such as
AG_DrawRect(3)
or
AG_WidgetBlit(3).
AG_GLViewScaleFn
() registers a function to
invoke whenever the widget is resized.
AG_GLViewKeydownFn
(),
AG_GLViewKeyupFn
(),
AG_GLViewButtondownFn
(),
AG_GLViewButtonupFn
() and
AG_GLViewMotionFn
() register general event handler
functions that will be forwarded ‘key-down’,
‘key-up’, ‘mouse-button-down’,
‘mouse-button-up’ and ‘mouse-motion’ events,
respectively.