Top | ![]() |
![]() |
![]() |
![]() |
GdkWindow * | gdk_gl_context_get_window () |
void | gdk_gl_context_make_current () |
void | gdk_gl_context_clear_current () |
GdkGLContext * | gdk_gl_context_get_current () |
#define | GDK_GL_ERROR |
#define | GDK_TYPE_GL_ERROR |
#define | GDK_TYPE_GL_PROFILE |
GdkDisplay * | display | Read / Write / Construct Only |
GdkGLProfile | profile | Read / Write / Construct Only |
GdkGLContext * | shared-context | Read / Write / Construct Only |
GdkWindow * | window | Read / Write / Construct Only |
GdkGLContext is an object representing the platform-specific OpenGL drawing context.
GdkGLContexts are created for a GdkWindow using
gdk_window_create_gl_context()
, and the context will match
the GdkVisual of the window.
A GdkGLContext is not tied to any particular normal framebuffer.
For instance, it cannot draw to the GdkWindow back buffer. The GDK
repaint system is in full control of the painting to that. Instead,
you can create render buffers or textures and use gdk_cairo_draw_from_gl()
in the draw function of your widget to draw them. Then GDK will handle
the integration of your rendering with that of other widgets.
Support for GdkGLContext is platform-specific, context creation
can fail, returning NULL
context.
A GdkGLContext has to be made "current" in order to start using it, otherwise any OpenGL call will be ignored.
In order to create a new GdkGLContext instance you need a GdkWindow, which you typically get during the realize call of a widget.
You will need to make the GdkGLContext the current context before issuing OpenGL calls; the system sends OpenGL commands to whichever context is current. It is possible to have multiple contexts, so you always need to ensure that the one which you want to draw with is the current one before issuing commands:
1 |
gdk_gl_context_make_current (context); |
You can now perform your drawing using OpenGL commands.
You can check which GdkGLContext is the current one by using
gdk_gl_context_get_current()
; you can also unset any GdkGLContext
that is currently set by calling gdk_gl_context_clear_current()
.
GdkWindow *
gdk_gl_context_get_window (GdkGLContext *context
);
Retrieves the GdkWindow used by the context
.
Since 3.16
void
gdk_gl_context_make_current (GdkGLContext *context
);
Makes the context
the current one.
Since 3.16
void
gdk_gl_context_clear_current (void
);
Clears the current GdkGLContext.
Any OpenGL call after this function returns will be ignored
until gdk_gl_context_make_current()
is called.
Since 3.16
GdkGLContext *
gdk_gl_context_get_current (void
);
Retrieves the current GdkGLContext.
Since 3.16
“display”
property“display” GdkDisplay *
The GdkWindow the gl context is bound to.
Flags: Read / Write / Construct Only
Since 3.16
“profile”
property“profile” GdkGLProfile
The GdkGLProfile of the context
Flags: Read / Write / Construct Only
Default value: GDK_GL_PROFILE_DEFAULT
Since 3.16
“shared-context”
property“shared-context” GdkGLContext *
The GdkGLContext that this context is sharing data with, or NULL
Flags: Read / Write / Construct Only
Since 3.16