side4linux, a
simple integrated development environment!
Library
GTKGLAREA Help
GtkGLArea
widget is derived from GtkDrawingArea widget.
(click
on Function to place description at top of screen and use your Browsers "Go Back one
page" button to return here.)
void gtk_gl_area_glError(char
errMessage[]);
PARAMETERS
errMessage
Specifies a character string from the calling
function.
DESCRIPTION
Provides a way of calling the OpenGL
error system to discover accumulated errors. Use when you wish to
report OpenGL errors.
Error list will appear on the command line if program called from there.
Example
gint glareaInit2d(void)
{
if(gtk_gl_area_make_current(GTK_GL_AREA(glarea)))
{
glViewport(0,0,glarea->allocation.width,glarea->allocation.height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,100, 100,0, -1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
else
{
gtk_gl_area_glError("main, glareaInit2d,
gtk_gl_area_make_current() failed with the following Errors");
return FALSE;
}
return TRUE;
}
GtkWidget*
gtk_gl_area_new(int *attrList)
PARAMETERS
attrList
Specifies a list of Boolean attributes and
enum/integer attribute/value
pairs. The last attribute must be zero or GDK_GL_NONE.
DESCRIPTION
Make
an OpenGL widget, attrList is passed to glXChooseVisual GLX call. See glXChooseVisual man page
for explanation of attrList. Widget is created with visual
and colormap of the requested type and GLX context is
created for this widget. You can't do opengl calls on widget until
it has X window. X window is not created until widget is
realized.
GtkWidget* gtk_gl_area_share_new(int
*attrList, GtkGLArea *share)
PARAMETERS
attrList
Specifies a list of Boolean attributes and
enum/integer attribute/value
pairs. The last attribute must be zero or GDK_GL_NONE.
share
Specifies the widget with which to share display
lists and texture
objects. NULL indicates that no sharing is to take place.
DESCRIPTION
Make
an OpenGL widget, attrList is passed to glXChooseVisual GLX call. See glXChooseVisual man page
for explanation of attrList. Widget is created with visual
and colormap of the requested type and GLX context is
created for this widget. You can't do opengl calls on widget until
it has X window. X window is not created until widget is
realized.
GtkWidget*
gtk_gl_area_new_vargs(GtkGLArea *share, ...)
PARAMETERS
attrList
Specifies a list of Boolean attributes and
enum/integer attribute/value
pairs. The last attribute must be zero or GDK_GL_NONE.
share
Specifies the widget with which to share display
lists and texture
objects. NULL indicates that no sharing is to take place.
DESCRIPTION
Make
an OpenGL widget, attrList is passed to glXChooseVisual GLX call. See glXChooseVisual man page
for explanation of attrList. Widget is created with visual
and colormap of the requested type and GLX context is
created for this widget. You can't do opengl calls on widget until
it has X window. X window is not created until widget is
realized.
gtk_gl_area_new_vargs
takes attrList as variable arguments, last argument must be zero.
gint
gtk_gl_area_make_current(GtkGLArea *gl_area)
PARAMETERS
gl_area
Specifies a gtkglarea widget.
DESCRIPTION
gtk_gl_area_make_current
must be called before rendering into OpenGL widget, it returns TRUE if
rendering to widget is possible. Rendering is not possible if
widget is not
GtkGLArea widget or widget is not realized.
void
gtk_gl_area_swap_buffers(GtkGLArea *gl_area)
PARAMETERS
gl_area
Specifies a GtkGLArea widget.
DESCRIPTION
Wrapper
around gdk_gl_swap_buffers. Promotes contents of back buffer of widget to front buffer. The contents
of the front buffer become
undefined. This function is called because drawing takes place on the
buffer currently offline. When you swap buffers the newly drawn image
is placed on the screen for you to see.
.