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 / NV / evaluators.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  10.2 KB  |  199 lines

  1. '''OpenGL extension NV.evaluators
  2.  
  3. Overview (from the spec)
  4.     
  5.     OpenGL evaluators provide applications with the capability to
  6.     specify polynomial or rational curves and surfaces using control
  7.     points relative to the Bezier basis.  The curves and surfaces are
  8.     then drawn by evaluating the polynomials provided at various values
  9.     for the u parameter of a curve or the (u,v) parameters of a surface.
  10.     A tensor product formulation is used for the surfaces.
  11.     
  12.     For various historical reasons, evaluators have not been
  13.     particularly popular as an interface for drawing curves and surfaces.
  14.     This extension proposes a new interface for surfaces that provides a
  15.     number of significant enhancements to the functionality provided by
  16.     the original OpenGL evaluators.
  17.     
  18.     Many implementations never optimized evaluators, so applications
  19.     often implemented their own algorithms instead.  This extension
  20.     relaxes some restrictions that make it difficult to optimize
  21.     evaluators.
  22.     
  23.     Also, new vertex attributes have been added to OpenGL through
  24.     extensions, including multiple sets of texture coordinates, a
  25.     secondary color, a fog coordinate, a vertex weight, and others.
  26.     The extensions which added these vertex attributes never bothered
  27.     to update the functionality of evaluators, since they were used so
  28.     little in the first place.  In turn, evaluators have become more and
  29.     more out of date, making it even less likely that developers will
  30.     want to use them.  Most of the attributes are not a big loss, but
  31.     support for multiple sets of texture coordinates would be absolutely
  32.     essential to developers considering the use of evaluators.
  33.     
  34.     OpenGL evaluators only support rectangular patches, not triangular
  35.     patches.  Although triangular patches can be converted into
  36.     rectangular patches, direct support for triangular patches is likely
  37.     to be more efficient.
  38.     
  39.     The tessellation algorithm used is too inflexible for most purposes;
  40.     only the number of rows and columns can be specified.  Adjacent
  41.     patches must then have identical numbers of rows and columns, or
  42.     severe cracking will occur.  Ideally, a number of subdivisions could
  43.     be specified for all four sides of a rectangular patch and for all
  44.     three of a triangular patch.  This extension goes one step further
  45.     and allows those numbers to be specified in floating-point, providing
  46.     a mechanism for smoothly changing the level of detail of the surface.
  47.     
  48.     Meshes evaluated with EvalMesh are required to match up exactly
  49.     with equivalent meshes evaluated with EvalCoord or EvalPoint.
  50.     This makes it difficult or impossible to use optimizations such as
  51.     forward differencing.
  52.     
  53.     Finally, little attention is given to some of the difficult problems
  54.     that can arise when multiple patches are drawn.  Depending on the
  55.     way evaluators are implemented, and depending on the orientation of
  56.     edges, numerical accuracy problems can cause cracks to appear between
  57.     patches with the same boundary control points.  This extension makes
  58.     guarantees that an edge shared between two patches will match up
  59.     exactly under certain conditions.
  60.  
  61. The official definition of this extension is available here:
  62.     http://oss.sgi.com/projects/ogl-sample/registry/NV/evaluators.txt
  63.  
  64. Automatically generated by the get_gl_extensions script, do not edit!
  65. '''
  66. from OpenGL import platform, constants, constant, arrays
  67. from OpenGL import extensions
  68. from OpenGL.GL import glget
  69. import ctypes
  70. EXTENSION_NAME = 'GL_NV_evaluators'
  71. GL_EVAL_2D_NV = constant.Constant( 'GL_EVAL_2D_NV', 0x86C0 )
  72. GL_EVAL_TRIANGULAR_2D_NV = constant.Constant( 'GL_EVAL_TRIANGULAR_2D_NV', 0x86C1 )
  73. GL_MAP_TESSELLATION_NV = constant.Constant( 'GL_MAP_TESSELLATION_NV', 0x86C2 )
  74. GL_MAP_ATTRIB_U_ORDER_NV = constant.Constant( 'GL_MAP_ATTRIB_U_ORDER_NV', 0x86C3 )
  75. GL_MAP_ATTRIB_V_ORDER_NV = constant.Constant( 'GL_MAP_ATTRIB_V_ORDER_NV', 0x86C4 )
  76. GL_EVAL_FRACTIONAL_TESSELLATION_NV = constant.Constant( 'GL_EVAL_FRACTIONAL_TESSELLATION_NV', 0x86C5 )
  77. glget.addGLGetConstant( GL_EVAL_FRACTIONAL_TESSELLATION_NV, (1,) )
  78. GL_EVAL_VERTEX_ATTRIB0_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB0_NV', 0x86C6 )
  79. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB0_NV, (1,) )
  80. GL_EVAL_VERTEX_ATTRIB1_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB1_NV', 0x86C7 )
  81. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB1_NV, (1,) )
  82. GL_EVAL_VERTEX_ATTRIB2_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB2_NV', 0x86C8 )
  83. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB2_NV, (1,) )
  84. GL_EVAL_VERTEX_ATTRIB3_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB3_NV', 0x86C9 )
  85. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB3_NV, (1,) )
  86. GL_EVAL_VERTEX_ATTRIB4_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB4_NV', 0x86CA )
  87. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB4_NV, (1,) )
  88. GL_EVAL_VERTEX_ATTRIB5_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB5_NV', 0x86CB )
  89. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB5_NV, (1,) )
  90. GL_EVAL_VERTEX_ATTRIB6_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB6_NV', 0x86CC )
  91. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB6_NV, (1,) )
  92. GL_EVAL_VERTEX_ATTRIB7_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB7_NV', 0x86CD )
  93. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB7_NV, (1,) )
  94. GL_EVAL_VERTEX_ATTRIB8_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB8_NV', 0x86CE )
  95. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB8_NV, (1,) )
  96. GL_EVAL_VERTEX_ATTRIB9_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB9_NV', 0x86CF )
  97. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB9_NV, (1,) )
  98. GL_EVAL_VERTEX_ATTRIB10_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB10_NV', 0x86D0 )
  99. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB10_NV, (1,) )
  100. GL_EVAL_VERTEX_ATTRIB11_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB11_NV', 0x86D1 )
  101. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB11_NV, (1,) )
  102. GL_EVAL_VERTEX_ATTRIB12_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB12_NV', 0x86D2 )
  103. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB12_NV, (1,) )
  104. GL_EVAL_VERTEX_ATTRIB13_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB13_NV', 0x86D3 )
  105. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB13_NV, (1,) )
  106. GL_EVAL_VERTEX_ATTRIB14_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB14_NV', 0x86D4 )
  107. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB14_NV, (1,) )
  108. GL_EVAL_VERTEX_ATTRIB15_NV = constant.Constant( 'GL_EVAL_VERTEX_ATTRIB15_NV', 0x86D5 )
  109. glget.addGLGetConstant( GL_EVAL_VERTEX_ATTRIB15_NV, (1,) )
  110. GL_MAX_MAP_TESSELLATION_NV = constant.Constant( 'GL_MAX_MAP_TESSELLATION_NV', 0x86D6 )
  111. glget.addGLGetConstant( GL_MAX_MAP_TESSELLATION_NV, (1,) )
  112. GL_MAX_RATIONAL_EVAL_ORDER_NV = constant.Constant( 'GL_MAX_RATIONAL_EVAL_ORDER_NV', 0x86D7 )
  113. glget.addGLGetConstant( GL_MAX_RATIONAL_EVAL_ORDER_NV, (1,) )
  114. glMapControlPointsNV = platform.createExtensionFunction( 
  115.     'glMapControlPointsNV', dll=platform.GL,
  116.     extension=EXTENSION_NAME,
  117.     resultType=None, 
  118.     argTypes=(constants.GLenum, constants.GLuint, constants.GLenum, constants.GLsizei, constants.GLsizei, constants.GLint, constants.GLint, constants.GLboolean, ctypes.c_void_p,),
  119.     doc = 'glMapControlPointsNV( GLenum(target), GLuint(index), GLenum(type), GLsizei(ustride), GLsizei(vstride), GLint(uorder), GLint(vorder), GLboolean(packed), c_void_p(points) ) -> None',
  120.     argNames = ('target', 'index', 'type', 'ustride', 'vstride', 'uorder', 'vorder', 'packed', 'points',),
  121. )
  122.  
  123. glMapParameterivNV = platform.createExtensionFunction( 
  124.     'glMapParameterivNV', dll=platform.GL,
  125.     extension=EXTENSION_NAME,
  126.     resultType=None, 
  127.     argTypes=(constants.GLenum, constants.GLenum, arrays.GLintArray,),
  128.     doc = 'glMapParameterivNV( GLenum(target), GLenum(pname), GLintArray(params) ) -> None',
  129.     argNames = ('target', 'pname', 'params',),
  130. )
  131.  
  132. glMapParameterfvNV = platform.createExtensionFunction( 
  133.     'glMapParameterfvNV', dll=platform.GL,
  134.     extension=EXTENSION_NAME,
  135.     resultType=None, 
  136.     argTypes=(constants.GLenum, constants.GLenum, arrays.GLfloatArray,),
  137.     doc = 'glMapParameterfvNV( GLenum(target), GLenum(pname), GLfloatArray(params) ) -> None',
  138.     argNames = ('target', 'pname', 'params',),
  139. )
  140.  
  141. glGetMapControlPointsNV = platform.createExtensionFunction( 
  142.     'glGetMapControlPointsNV', dll=platform.GL,
  143.     extension=EXTENSION_NAME,
  144.     resultType=None, 
  145.     argTypes=(constants.GLenum, constants.GLuint, constants.GLenum, constants.GLsizei, constants.GLsizei, constants.GLboolean, ctypes.c_void_p,),
  146.     doc = 'glGetMapControlPointsNV( GLenum(target), GLuint(index), GLenum(type), GLsizei(ustride), GLsizei(vstride), GLboolean(packed), c_void_p(points) ) -> None',
  147.     argNames = ('target', 'index', 'type', 'ustride', 'vstride', 'packed', 'points',),
  148. )
  149.  
  150. glGetMapParameterivNV = platform.createExtensionFunction( 
  151.     'glGetMapParameterivNV', dll=platform.GL,
  152.     extension=EXTENSION_NAME,
  153.     resultType=None, 
  154.     argTypes=(constants.GLenum, constants.GLenum, arrays.GLintArray,),
  155.     doc = 'glGetMapParameterivNV( GLenum(target), GLenum(pname), GLintArray(params) ) -> None',
  156.     argNames = ('target', 'pname', 'params',),
  157. )
  158.  
  159. glGetMapParameterfvNV = platform.createExtensionFunction( 
  160.     'glGetMapParameterfvNV', dll=platform.GL,
  161.     extension=EXTENSION_NAME,
  162.     resultType=None, 
  163.     argTypes=(constants.GLenum, constants.GLenum, arrays.GLfloatArray,),
  164.     doc = 'glGetMapParameterfvNV( GLenum(target), GLenum(pname), GLfloatArray(params) ) -> None',
  165.     argNames = ('target', 'pname', 'params',),
  166. )
  167.  
  168. glGetMapAttribParameterivNV = platform.createExtensionFunction( 
  169.     'glGetMapAttribParameterivNV', dll=platform.GL,
  170.     extension=EXTENSION_NAME,
  171.     resultType=None, 
  172.     argTypes=(constants.GLenum, constants.GLuint, constants.GLenum, arrays.GLintArray,),
  173.     doc = 'glGetMapAttribParameterivNV( GLenum(target), GLuint(index), GLenum(pname), GLintArray(params) ) -> None',
  174.     argNames = ('target', 'index', 'pname', 'params',),
  175. )
  176.  
  177. glGetMapAttribParameterfvNV = platform.createExtensionFunction( 
  178.     'glGetMapAttribParameterfvNV', dll=platform.GL,
  179.     extension=EXTENSION_NAME,
  180.     resultType=None, 
  181.     argTypes=(constants.GLenum, constants.GLuint, constants.GLenum, arrays.GLfloatArray,),
  182.     doc = 'glGetMapAttribParameterfvNV( GLenum(target), GLuint(index), GLenum(pname), GLfloatArray(params) ) -> None',
  183.     argNames = ('target', 'index', 'pname', 'params',),
  184. )
  185.  
  186. glEvalMapsNV = platform.createExtensionFunction( 
  187.     'glEvalMapsNV', dll=platform.GL,
  188.     extension=EXTENSION_NAME,
  189.     resultType=None, 
  190.     argTypes=(constants.GLenum, constants.GLenum,),
  191.     doc = 'glEvalMapsNV( GLenum(target), GLenum(mode) ) -> None',
  192.     argNames = ('target', 'mode',),
  193. )
  194.  
  195.  
  196. def glInitEvaluatorsNV():
  197.     '''Return boolean indicating whether this extension is available'''
  198.     return extensions.hasGLExtension( EXTENSION_NAME )
  199.