[GtkGLExt] [Repost] Re: GdkGLPixmap troubles
- From: Jose Commins <axora axora net>
- To: gtkglext-list gnome org
- Subject: [GtkGLExt] [Repost] Re: GdkGLPixmap troubles
- Date: Tue, 08 Sep 2009 13:33:00 +0100
Hi, just to note a few caveats when dealing with GL contexts.
First, before performing any context reference operations, the GL
widget should be +realized+ to manipulate any references inside. I have
included some source code that I use in one of my apps to enlighten.
with typecasts to make it easier to associate types:
// Get OpenGL rendering context.
gtk_widget_realize ((GtkWidget *) yourGLCapableWidget);
(GdkGLContext *) theSharedGlContext = gtk_widget_get_gl_context
((GtkWidget *) yourGLCapableWidget);
// Initialise the other GL areas with the same shared context.
(GtkWidget *) anotherGLWidget = GTK_WIDGET (gtk_builder_get_object
(yourGTKBuilderXml, "GLwidget2"));
// Add OpenGL-capability to the other widget, sharing the same context.
gtk_widget_set_gl_capability ((GtkWidget *) anotherGLWidget,
glConfig, (GdkGLContext *) theSharedGlContext, TRUE, GDK_GL_RGBA_TYPE);
... etc
Note that 'gtk_widget_realize' is essential for the following
functions to reference data within.
Another caveat is that some drivers align texture data, depending on
hardware - after the storage->framebuffer phase the alignment can vary
if the hardware is not capable of non-powers-of-two textures. You may
find that the driver will texture-split any non-power-of-two
rectangles. The solution to this is to make sure that if the
driver/hardware does not support non-power-of-two textures, to use the
stride value in retrieving data back from the framebuffer.
Regards,
Jose.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]