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 / raw / GL / SGIX / sprite.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  4.6 KB  |  109 lines

  1. '''OpenGL extension SGIX.sprite
  2.  
  3. Overview (from the spec)
  4.     
  5.         This extension provides support for viewpoint dependent alignment
  6.         of geometry, in particular geometry that rotates about a point or
  7.         a specified axis to face the eye point.  The primary use is for
  8.         quickly rendering roughly cylindrically or spherically symmetric
  9.         objects, e.g. trees, smoke, clouds, etc. using geometry textured
  10.         with a partially transparent texture map.
  11.     
  12.         Rendering sprite geometry requires applying a transformation to
  13.         primitives before the current model view. This matrix includes a
  14.         rotation which is computed based on the current model view matrix
  15.         and a translation which is specified explicitly
  16.         (SPRITE_TRANSLATION_SGIX). The current model view matrix itself
  17.         is not modified.
  18.     
  19.         Primitives are first transformed by a rotation, depending on the
  20.         sprite mode:
  21.     
  22.         SPRITE_AXIAL_SGIX: The front of the object is rotated about
  23.         an axis so that it faces the eye as much as the axis
  24.         constraint allows.  This is used for roughly rendering cylindrical
  25.         objects such as trees in visual simulation. 
  26.     
  27.         SPRITE_OBJECT_ALIGNED_SGIX: The front of the object is
  28.         rotated about a point to face the eye with the remaining
  29.         rotational degree of freedom specified by aligning the top
  30.         of the object with a specified axis in object coordinates.
  31.         This is used for spherical objects and special effects such
  32.         as smoke which must maintain an alignment in object
  33.         coordinates for realism.
  34.     
  35.         SPRITE_EYE_ALIGNED_SGIX: The front of the object is rotated
  36.         about a point to face the eye with the remaining rotational
  37.         degree of freedom specified by aligning the top of the object
  38.         with a specified axis in eye coordinates. This is used for
  39.         rendering sprites which must maintain an alignment on the
  40.         screen, such as 3D annotations.
  41.     
  42.         The axis of rotation or alignment, SPRITE_AXIS_SGIX, can be 
  43.         an arbitrary direction to support geocentric coordinate frames
  44.         in which "up" is not along X, Y or Z.
  45.     
  46.         Sprite geometry is modeled in a canonical frame: +Z is the up
  47.         vector. -Y is the front vector which is rotated to point towards
  48.         the eye. In the discussion below, the eye vector is the vector to
  49.         the eye from the origin of the model view frame translated by the
  50.         sprite position.
  51.  
  52. The official definition of this extension is available here:
  53.     http://oss.sgi.com/projects/ogl-sample/registry/SGIX/sprite.txt
  54.  
  55. Automatically generated by the get_gl_extensions script, do not edit!
  56. '''
  57. from OpenGL import platform, constants, constant, arrays
  58. from OpenGL import extensions
  59. from OpenGL.GL import glget
  60. import ctypes
  61. EXTENSION_NAME = 'GL_SGIX_sprite'
  62. GL_SPRITE_SGIX = constant.Constant( 'GL_SPRITE_SGIX', 0x8148 )
  63. GL_SPRITE_MODE_SGIX = constant.Constant( 'GL_SPRITE_MODE_SGIX', 0x8149 )
  64. GL_SPRITE_AXIS_SGIX = constant.Constant( 'GL_SPRITE_AXIS_SGIX', 0x814A )
  65. GL_SPRITE_TRANSLATION_SGIX = constant.Constant( 'GL_SPRITE_TRANSLATION_SGIX', 0x814B )
  66. GL_SPRITE_AXIAL_SGIX = constant.Constant( 'GL_SPRITE_AXIAL_SGIX', 0x814C )
  67. GL_SPRITE_OBJECT_ALIGNED_SGIX = constant.Constant( 'GL_SPRITE_OBJECT_ALIGNED_SGIX', 0x814D )
  68. GL_SPRITE_EYE_ALIGNED_SGIX = constant.Constant( 'GL_SPRITE_EYE_ALIGNED_SGIX', 0x814E )
  69. glSpriteParameterfSGIX = platform.createExtensionFunction( 
  70.     'glSpriteParameterfSGIX', dll=platform.GL,
  71.     extension=EXTENSION_NAME,
  72.     resultType=None, 
  73.     argTypes=(constants.GLenum, constants.GLfloat,),
  74.     doc = 'glSpriteParameterfSGIX( GLenum(pname), GLfloat(param) ) -> None',
  75.     argNames = ('pname', 'param',),
  76. )
  77.  
  78. glSpriteParameterfvSGIX = platform.createExtensionFunction( 
  79.     'glSpriteParameterfvSGIX', dll=platform.GL,
  80.     extension=EXTENSION_NAME,
  81.     resultType=None, 
  82.     argTypes=(constants.GLenum, arrays.GLfloatArray,),
  83.     doc = 'glSpriteParameterfvSGIX( GLenum(pname), GLfloatArray(params) ) -> None',
  84.     argNames = ('pname', 'params',),
  85. )
  86.  
  87. glSpriteParameteriSGIX = platform.createExtensionFunction( 
  88.     'glSpriteParameteriSGIX', dll=platform.GL,
  89.     extension=EXTENSION_NAME,
  90.     resultType=None, 
  91.     argTypes=(constants.GLenum, constants.GLint,),
  92.     doc = 'glSpriteParameteriSGIX( GLenum(pname), GLint(param) ) -> None',
  93.     argNames = ('pname', 'param',),
  94. )
  95.  
  96. glSpriteParameterivSGIX = platform.createExtensionFunction( 
  97.     'glSpriteParameterivSGIX', dll=platform.GL,
  98.     extension=EXTENSION_NAME,
  99.     resultType=None, 
  100.     argTypes=(constants.GLenum, arrays.GLintArray,),
  101.     doc = 'glSpriteParameterivSGIX( GLenum(pname), GLintArray(params) ) -> None',
  102.     argNames = ('pname', 'params',),
  103. )
  104.  
  105.  
  106. def glInitSpriteSGIX():
  107.     '''Return boolean indicating whether this extension is available'''
  108.     return extensions.hasGLExtension( EXTENSION_NAME )
  109.