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 / ARB / vertex_shader.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  1.2 KB  |  29 lines

  1. '''OpenGL extension ARB.vertex_shader
  2.  
  3. This module customises the behaviour of the 
  4. OpenGL.raw.GL.ARB.vertex_shader 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.ARB.vertex_shader import *
  12. ### END AUTOGENERATED SECTION
  13.  
  14. from shader_objects import glGetObjectParameterivARB
  15.  
  16. base_glGetActiveAttribARB = glGetActiveAttribARB
  17. def glGetActiveAttribARB(program, index):
  18.     """Retrieve the name, size and type of the uniform of the index in the program"""
  19.     max_index = int(glGetObjectParameterivARB( program, GL_OBJECT_ACTIVE_ATTRIBUTES_ARB ))
  20.     length = int(glGetObjectParameterivARB( program, GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB))
  21.     if index < max_index and index >= 0 and length > 0:
  22.         name = ctypes.create_string_buffer(length)
  23.         size = arrays.GLintArray.zeros( (1,))
  24.         gl_type = arrays.GLuintArray.zeros( (1,))
  25.         base_glGetActiveAttribARB(program, index, length, None, size, gl_type, name)
  26.         return name.value, size[0], gl_type[0]
  27.     raise IndexError, 'index out of range from zero to %i' % (max_index - 1, )
  28. glGetActiveAttribARB.wrappedOperation = base_glGetActiveAttribARB
  29.