Patch to add GLX 1.4 support and new GLX extensions
Original Reporter info from Mantis: Michalis @michaliskambi
-
Reporter name: Michalis Kamburelis
Original Reporter info from Mantis: Michalis @michaliskambi
- Reporter name: Michalis Kamburelis
Description:
Attaching the patch that extends packages/opengl/src/glx.pp with many new functions up to GLX 1.4 (previously GLX unit was at 1.1). Also some popular extensions are added. GLX 1.3, together with glXCreateContextAttribsARB, is necessary to initialize new OpenGL (> 3) contexts that may be forward-compatible (i.e. without deprecated stuff).
The new GLX functions (from higher GLX versions and extensions) are automatically loaded, just like in previous GLX unit version. So programs that want to, can just assume their existence (e.g. glX >= 1.3 is now pretty much standard).
To ease the job for programs that want to play nice, the patch also adds new GLX_Xxx functions, that carefully check whether the given GLX version/extension is really supported (which may depend on X display and even screen).
- Version checks (GLX_version_) check glXQueryExtension, glXQueryVersion, and whether all entry points are assigned.
- Extension checks (other GLX_Xxx) check glXQueryExtensionsString and whether all entry points are assigned.
So, similar to Load_GL_Xxx functions in GLExt unit, these are the safest way to check if extension/version is present.
I hope this can be merged into 2.6 fixes branch too --- it's quite safe IMHO, we only add stuff to GLX unit, not changing previously existing functions.
Based on /usr/include/GL/glx.h and glxext.h inside Debian (from Debian testing "mesa-common-dev" package, version 7.10.3-3). Tested on 32-bit Linux, but should work everywhere where glX is. I preserved all "GLX 1.x and later" comments from C header, since these may be useful.
I clearly marked and separated sections for particular glX extensions.
Types translation follows convention of existing functions. For example, int -> Integer, long -> LongWord. Should probably be fixed to use CTypes, but in a separate patch, to not break two things at once :) Where appropriate (documentation says it's sensibel, and NULL makes no sense), pointer parameters were translated as "var" parameters.
Attached is also a patch for glxtest, that shows how to initialize OpenGL context using new glX 1.3 methods (using new GLXFBConfig concept). It also shows how to use GLX_ARB_create_context to request OpenGL 3.0 forward-compatible context. It also fixes error reporting in glxtest (it should go to stderr and halt, instead of trying to continue with invalid values, causing X errors).
Mantis conversion info:
- Mantis ID: 19953
- OS: Debian GNU/Linux
- OS Build: (testing)
- Platform: i386
- Fixed in version: 2.6.0
- Fixed in revision: 18839 (#893c1d9f)