Re: OpenGL, GtkGlArea, GtkGLExt




On Wed, 2008-03-05 at 20:08 +0000, Jon Harrop wrote:

If anyone is interested in improving the situation for scientists and
engineers then I would recommend taking this into account: keep it simple
to bind.

you can't really get much simpler than a:

  GLXContext gl_context;

  gl_context = gdk_glx_create_context (GDK_DRAWABLE (widget->window));

How would I provide parameters for the GL context (e.g. multisample)?

first of all, that is a completely made up API: I haven't investigated
whether it's actually doable like that - even though it resembles
GtkGLExt enough to be implementable in the same way.

I suppose that setting up the parameters can be done with a:

  GdkGLContext *
  gdk_gl_create_context_full (GdkDrawable *drawable,
                              guint       *gl_attributes);

which will, in the GLX implementation, pass the attributes_mask to the
glXChooseVisual() function and will use the returned visual for the
glXCreateContext() call. GDK would provide a set of sane defaults for
the common case.

we could even drop the _full() variant, and just do:

  GdkGLContext *
  gdk_gl_create_context (GdkDrawable *drawable,
                         guint       *gl_attributes);

and, if the cached GdkGLContext gl_attributes are different than the
passed ones (with NULL meaning "use the default"), then scratch the
current context and return a new one - otherwise, return the context
created the first time the function was invoked.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi,
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]