![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
void (*RedrawMethod) (guint width, guint height, gpointer data); GtkWidget* openGLWidgetNew (gboolean contextIsDirect); void openGLWidgetSwap_buffers (OpenGLWidget *render); void openGLWidgetRedraw (OpenGLWidget *render); gboolean openGLWidgetSet_current (OpenGLWidget *render); void openGLWidgetSet_redraw (OpenGLWidget *render, RedrawMethod method, gpointer data); guchar* openGLWidgetGet_pixmapData (OpenGLWidget *render, int *width, int *height, gboolean offScreen); OpenGLWidget* openGLWidgetClassGet_currentContext ();
This is a simple implementation of GtkGlExt to create an OpenGL surface that is
a full GtkWidget. When creating such a widget, one should give then a RedrawMethod()
to tell the widget how to redraw itself when needed.
The current implementation is working on X11 and Win32.
void (*RedrawMethod) (guint width, guint height, gpointer data);
Methods of this prototype are called when the redraw of the OpenGL zone should be done.
|
the width of the drawing area ; |
|
the height of the drawing area ; |
|
some user defined informations. |
GtkWidget* openGLWidgetNew (gboolean contextIsDirect);
Create a new OpenGL area inside a GTK widget. If contextIsDirect
then
it tries to initialise the OpenGL context to a direct one.
|
a boolean. |
Returns : |
a newly created widget. |
void openGLWidgetSwap_buffers (OpenGLWidget *render);
Swap the buffers of the OpenGL area.
|
a OpenGLWidget object. |
void openGLWidgetRedraw (OpenGLWidget *render);
Force redraw on the given surface, if a redraw method have been given (see
openGLWidgetSet_redraw()
).
|
a OpenGLWidget object. |
gboolean openGLWidgetSet_current (OpenGLWidget *render);
Make this object current. This means that all future OpenGL primitive will be rendered on this surface.
|
a OpenGLWidget object. |
Returns : |
TRUE if succeed. |
void openGLWidgetSet_redraw (OpenGLWidget *render, RedrawMethod method, gpointer data);
This method is used to defined a redraw method for the OpenGL area. By doing this
the area will automatically redraw itself when necessary. Before doing it
it calls openGLWidgetSet_current()
; and after it calls openGLWidgetSwap_buffers()
.
|
a OpenGLWidget object ; |
|
a redraw method ; |
|
a user defined pointer. |
guchar* openGLWidgetGet_pixmapData (OpenGLWidget *render, int *width, int *height, gboolean offScreen);
Create an image from the OpenGL area. The size can be changed, using width
and
height
. If these pointers contains positive values, then they are used to set the
size for the image. If not, the current size is used and stored in these pointers.
The boolean offScreen is used to tell if the image is taken from current context
or if an offscreen pixmap is created for the rendering.
|
a OpenGLWidget object ; |
|
a pointer to the desired width or -1 ; |
|
a pointer to the desired height or -1 ; |
|
a boolean. |
Returns : |
image data, row by row. |