Getting OpenGL-ctypes to work with ctypes (Done, sorta, but I don't recall these weird array problems before...)

At one of those annoying moments in coding where you're not sure if something is a bug in your own code, or one of two different libraries. I've been getting a few problems ironed out with the ctypes release (a tool we were using was removed, but equivalent functionality is there).

The problem is that, on running the tests in OpenGLContext and OpenGL-ctypes that Numpy 24.2 arrays are returning arrays where they should be returning numbers. That is:

(Pdb) p result
(Pdb) p result.shape
(Pdb) p result[0]
(Pdb) type(result[0])
<type 'array'>
(Pdb) p result[0][0]
(Pdb) type(result[0][0])
<type 'int'>

The shape of the result[0] array is (), which doesn't even seem remotely reasonable. No idea if this is new Numpy 24.2 behaviour (I upgraded Numpy for other reasons than ctypes work) a problem with using ctypes to fill the array, or a problem in ctypes itself (though I doubt that at this point).


  1. Rene Dudfield

    Rene Dudfield on 02/21/2006 8:14 p.m. #

    Numeric and Numpy have been making changes that have broken stuff recently.<br />
    <br />
    At least we were having problems with pygame and Numeric. I think a recompile with the Numeric fixed things.<br />
    <br />
    I'm not sure of the changes... but just thought I'd let you know.

  2. Mike Fletcher

    Mike Fletcher on 02/21/2006 9:42 p.m. #

    Thanks very much! Turns out this was the problem, a simple recompile of the (trivial) C extension in OpenGL-ctypes that gets the data-point from the array was all that was required to get back to working status.<br />
    <br />
    I guess at some point I should look at encoding the version in the pyd/so so that I can reject loading a Num* version that doesn't match the compiled version.

Comments are closed.


Pingbacks are closed.