Re: [PyOpenGL-Users] PyOpenGL GLX extension problem
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@vr...> - 2013-04-01 04:05:10
|
On 13-03-29 07:30 AM, Jean-Baptiste Molle wrote:
> |Hi,
>
> I'm trying to create a program with PyOpenGL but I'm stuck with a GLX problem.
> |
|Attached find a script that does what your code is doing AFAICS, though
without a pixmap to actually use, it doesn't do anything useful. It is
written to be run from the PyOpenGL source-code checkout tests
directory|, but that's just so that I don't have to go about creating
contexts and the like.
Quick summary:
* you need the [0]'th element of the returned Display pointer to get
the Display reference that all other calls are expecting (you have
to dereference the pointer, basically)
* the array-of-enums pattern is shown, in this case I'm using ctypes
arrays to create the data:
o note that you need an ordered sequence (list or tuple) not a set
(the C syntax for arrays happens to look like a literal set in
Python)
o GLint * len(attributes) -> creates an array type
o (*attributes) --> then creates an instance of that array type
which is initialized to the values in the list
* you could also have used:
o GLintArray.asArray( attributes )
o but I'd suggest being explicit about this kind of thing where
possible
Note that the GLX API is not "wrapped" in the same way as the GL API,
it's an auto-generated/raw wrapper with little or no attempt to make the
API clean or friendly.
Hope that helps,
Mike
|