#11 byref_at for returning references to array elements

open
nobody
None
5
2006-08-14
2006-08-14
Shane Holloway
No

Implements a simple way to return references to array elements. Allows
the following C code::

// from the OpenGL Programming Guide (Red Book), Fifth Edition, pp
455
glTexGenfv(GL_T, GL_OBJECT_PLANE, &tmpMatrix[4]);

To be written in ctypes like::

glTexGenfv(GL_T, GL_OBJECT_PLANE, byref_at(tmpMatrix, 4))

Instead of::

p = cast(tmpMatrix, c_void_p)
p.value += sizeof(tmpMatrix._type_) * 4
glTexGenfv(GL_T, GL_OBJECT_PLANE, cast(p, c_float_p))

Discussion

  • Shane Holloway
    Shane Holloway
    2006-08-14

    Strawman byref_at implementation

     
    Attachments