Re: [GtkGLExt] What about GTK+-3.0 support?



On Wed, 2011-07-27 at 10:57 +0200, dagecko free fr wrote:
> It is quite easy to make it more automatic, by using if statements in 
> the row, just like this:
> 
> if (cannot create context GL 4.1)
>    if (cannot create context GL 4.0)
>       if (cannot create context GL 3.1)
>          if (cannot create context GL 3.0)
>             create old default context

It's not safe to just use the newest version available, because newer
versions may remove deprecated features and the application might rely
on those features.  That's why the application has to specify what
version it wants.

The application also has to specify whether the context should be
"forward-compatible", which makes deprecated features unavailable.  And
for OpenGL 3.2 or newer, it has to specify which profile it wants:  core
or compatibility.

I think GtkGLExt should provide something similar to
glXCreateContextAttribsARB(), where the application provides a list of
attributes including the desired GL version, but it should be abstracted
enough that the application doesn't have to refer to any GLX-specific
constants.  If the GL implementation supports GLX_ARB_create_context, we
can just call glXCreateContextAttribsARB(); if not, we'd fall back to
glXCreateNewContext() if the app requested major version 1 or 2, or
report an error if the app asked for GL 3 or newer.

The attribute list could also be used for the "direct" flag that's
currently provided as a separate argument to gdk_gl_context_new().  I'm
guessing that flag is GLX-specific (though I admit I don't actually know
anything about WGL or the Mac API) so it'd be nicer not to have it as a
named parameter in the GtkGLExt API.  It can default to true if the
application doesn't specify it.
-- 
Mike Paul <mike wyzardry net>



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