home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / lib / site-packages / OpenGL / GL / EXT / multi_draw_arrays.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  1.5 KB  |  48 lines

  1. '''OpenGL extension EXT.multi_draw_arrays
  2.  
  3. This module customises the behaviour of the 
  4. OpenGL.raw.GL.EXT.multi_draw_arrays to provide a more 
  5. Python-friendly API
  6. '''
  7. from OpenGL import platform, constants, constant, arrays
  8. from OpenGL import extensions, wrapper
  9. from OpenGL.GL import glget
  10. import ctypes
  11. from OpenGL.raw.GL.EXT.multi_draw_arrays import *
  12. ### END AUTOGENERATED SECTION
  13. from OpenGL.lazywrapper import lazy
  14. from OpenGL.GL.pointers import glDrawElements
  15.  
  16. @lazy( glMultiDrawElementsEXT )
  17. def glMultiDrawElementsEXT(baseOperation, primtype, counts, typ, indices, primcount):
  18.     """Currently glMultiDrawElementsEXT is not working in the wrapper 
  19.     
  20.     We are replacing the code with a sequence of glDrawElements calls
  21.     as per the spec for the function...
  22.     """
  23.     for i in xrange( primcount ):
  24.         glDrawElements( primtype, counts[i], typ, indices[i] )
  25.  
  26. #def convertIndices( arg, wrappedOperation, args ):
  27. #    """Convert indices to an array of arrays"""
  28. #    return [
  29. #        arrays.ArrayDatatype.asArray( element, args[2] )
  30. #        for element in arg
  31. #    ]
  32. #def resolveIndices( value ):
  33. #    pointers = []
  34. #    for v in value:
  35. #        pointers.append( arrays.ArrayDatatype.voidDataPointer( v ) )
  36. #    typ = ctypes.POINTER(None) * len(value)
  37. #    return typ( *pointers )
  38. #
  39. #glMultiDrawElementsEXT = wrapper.wrapper( glMultiDrawElementsEXT ).setPyConverter(
  40. #    'indices', convertIndices,
  41. #).setCResolver( 
  42. #    'indices', resolveIndices,
  43. #).setPyConverter(
  44. #    'count', arrays.AsArrayTyped( 'count', arrays.GLsizeiArray ),
  45. #).setCResolver(
  46. #    'count', arrays.ArrayDatatype.voidDataPointer ,
  47. #)
  48.