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 / fragment_program.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  7.0 KB  |  133 lines

  1. '''OpenGL extension NV.fragment_program
  2.  
  3. Overview (from the spec)
  4.     
  5.     OpenGL mandates a certain set of configurable per-fragment computations
  6.     defining texture lookup, texture environment, color sum, and fog
  7.     operations.  Each of these areas provide a useful but limited set of fixed
  8.     operations.  For example, unextended OpenGL 1.2.1 provides only four
  9.     texture environment modes, color sum, and three fog modes.  Many OpenGL
  10.     extensions have either improved existing functionality or introduced new
  11.     configurable fragment operations.  While these extensions have enabled new
  12.     and interesting rendering effects, the set of effects is limited by the
  13.     set of special modes introduced by the extension.  This lack of
  14.     flexibility is in contrast to the high-level of programmability of
  15.     general-purpose CPUs and other (frequently software-based) shading
  16.     languages.  The purpose of this extension is to expose to the OpenGL
  17.     application writer an unprecedented degree of programmability in the
  18.     computation of final fragment colors and depth values.
  19.     
  20.     This extension provides a mechanism for defining fragment program
  21.     instruction sequences for application-defined fragment programs.  When in
  22.     fragment program mode, a program is executed each time a fragment is
  23.     produced by rasterization.  The inputs for the program are the attributes
  24.     (position, colors, texture coordinates) associated with the fragment and a
  25.     set of constant registers.  A fragment program can perform mathematical
  26.     computations and texture lookups using arbitrary texture coordinates.  The
  27.     results of a fragment program are new color and depth values for the
  28.     fragment.
  29.     
  30.     This extension defines a programming model including a 4-component vector
  31.     instruction set, 16- and 32-bit floating-point data types, and a
  32.     relatively large set of temporary registers.  The programming model also
  33.     includes a condition code vector which can be used to mask register writes
  34.     at run-time or kill fragments altogether.  The syntax, program
  35.     instructions, and general semantics are similar to those in the
  36.     NV_vertex_program and NV_vertex_program2 extensions, which provide for the
  37.     execution of an arbitrary program each time the GL receives a vertex.
  38.     
  39.     The fragment program execution environment is designed for efficient
  40.     hardware implementation and to support a wide variety of programs.  By
  41.     design, the entire set of existing fragment programs defined by existing
  42.     OpenGL per-fragment computation extensions can be implemented using the
  43.     extension's programming model.
  44.     
  45.     The fragment program execution environment accesses textures via
  46.     arbitrarily computed texture coordinates.  As such, there is no necessary
  47.     correspondence between the texture coordinates and texture maps previously
  48.     lumped into a single "texture unit".  This extension separates the notion
  49.     of "texture coordinate sets" and "texture image units" (texture maps and
  50.     associated parameters), allowing implementations with a different number
  51.     of each.  The initial implementation of this extension will support 8
  52.     texture coordinate sets and 16 texture image units.
  53.  
  54. The official definition of this extension is available here:
  55.     http://oss.sgi.com/projects/ogl-sample/registry/NV/fragment_program.txt
  56.  
  57. Automatically generated by the get_gl_extensions script, do not edit!
  58. '''
  59. from OpenGL import platform, constants, constant, arrays
  60. from OpenGL import extensions
  61. from OpenGL.GL import glget
  62. import ctypes
  63. EXTENSION_NAME = 'GL_NV_fragment_program'
  64. GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV = constant.Constant( 'GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV', 0x8868 )
  65. glget.addGLGetConstant( GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV, (1,) )
  66. GL_FRAGMENT_PROGRAM_NV = constant.Constant( 'GL_FRAGMENT_PROGRAM_NV', 0x8870 )
  67. glget.addGLGetConstant( GL_FRAGMENT_PROGRAM_NV, (1,) )
  68. GL_MAX_TEXTURE_COORDS_NV = constant.Constant( 'GL_MAX_TEXTURE_COORDS_NV', 0x8871 )
  69. glget.addGLGetConstant( GL_MAX_TEXTURE_COORDS_NV, (1,) )
  70. GL_MAX_TEXTURE_IMAGE_UNITS_NV = constant.Constant( 'GL_MAX_TEXTURE_IMAGE_UNITS_NV', 0x8872 )
  71. glget.addGLGetConstant( GL_MAX_TEXTURE_IMAGE_UNITS_NV, (1,) )
  72. GL_FRAGMENT_PROGRAM_BINDING_NV = constant.Constant( 'GL_FRAGMENT_PROGRAM_BINDING_NV', 0x8873 )
  73. glget.addGLGetConstant( GL_FRAGMENT_PROGRAM_BINDING_NV, (1,) )
  74. GL_PROGRAM_ERROR_STRING_NV = constant.Constant( 'GL_PROGRAM_ERROR_STRING_NV', 0x8874 )
  75. glProgramNamedParameter4fNV = platform.createExtensionFunction( 
  76.     'glProgramNamedParameter4fNV', dll=platform.GL,
  77.     extension=EXTENSION_NAME,
  78.     resultType=None, 
  79.     argTypes=(constants.GLuint, constants.GLsizei, arrays.GLubyteArray, constants.GLfloat, constants.GLfloat, constants.GLfloat, constants.GLfloat,),
  80.     doc = 'glProgramNamedParameter4fNV( GLuint(id), GLsizei(len), GLubyteArray(name), GLfloat(x), GLfloat(y), GLfloat(z), GLfloat(w) ) -> None',
  81.     argNames = ('id', 'len', 'name', 'x', 'y', 'z', 'w',),
  82. )
  83.  
  84. glProgramNamedParameter4dNV = platform.createExtensionFunction( 
  85.     'glProgramNamedParameter4dNV', dll=platform.GL,
  86.     extension=EXTENSION_NAME,
  87.     resultType=None, 
  88.     argTypes=(constants.GLuint, constants.GLsizei, arrays.GLubyteArray, constants.GLdouble, constants.GLdouble, constants.GLdouble, constants.GLdouble,),
  89.     doc = 'glProgramNamedParameter4dNV( GLuint(id), GLsizei(len), GLubyteArray(name), GLdouble(x), GLdouble(y), GLdouble(z), GLdouble(w) ) -> None',
  90.     argNames = ('id', 'len', 'name', 'x', 'y', 'z', 'w',),
  91. )
  92.  
  93. glProgramNamedParameter4fvNV = platform.createExtensionFunction( 
  94.     'glProgramNamedParameter4fvNV', dll=platform.GL,
  95.     extension=EXTENSION_NAME,
  96.     resultType=None, 
  97.     argTypes=(constants.GLuint, constants.GLsizei, arrays.GLubyteArray, arrays.GLfloatArray,),
  98.     doc = 'glProgramNamedParameter4fvNV( GLuint(id), GLsizei(len), GLubyteArray(name), GLfloatArray(v) ) -> None',
  99.     argNames = ('id', 'len', 'name', 'v',),
  100. )
  101.  
  102. glProgramNamedParameter4dvNV = platform.createExtensionFunction( 
  103.     'glProgramNamedParameter4dvNV', dll=platform.GL,
  104.     extension=EXTENSION_NAME,
  105.     resultType=None, 
  106.     argTypes=(constants.GLuint, constants.GLsizei, arrays.GLubyteArray, arrays.GLdoubleArray,),
  107.     doc = 'glProgramNamedParameter4dvNV( GLuint(id), GLsizei(len), GLubyteArray(name), GLdoubleArray(v) ) -> None',
  108.     argNames = ('id', 'len', 'name', 'v',),
  109. )
  110.  
  111. glGetProgramNamedParameterfvNV = platform.createExtensionFunction( 
  112.     'glGetProgramNamedParameterfvNV', dll=platform.GL,
  113.     extension=EXTENSION_NAME,
  114.     resultType=None, 
  115.     argTypes=(constants.GLuint, constants.GLsizei, arrays.GLubyteArray, arrays.GLfloatArray,),
  116.     doc = 'glGetProgramNamedParameterfvNV( GLuint(id), GLsizei(len), GLubyteArray(name), GLfloatArray(params) ) -> None',
  117.     argNames = ('id', 'len', 'name', 'params',),
  118. )
  119.  
  120. glGetProgramNamedParameterdvNV = platform.createExtensionFunction( 
  121.     'glGetProgramNamedParameterdvNV', dll=platform.GL,
  122.     extension=EXTENSION_NAME,
  123.     resultType=None, 
  124.     argTypes=(constants.GLuint, constants.GLsizei, arrays.GLubyteArray, arrays.GLdoubleArray,),
  125.     doc = 'glGetProgramNamedParameterdvNV( GLuint(id), GLsizei(len), GLubyteArray(name), GLdoubleArray(params) ) -> None',
  126.     argNames = ('id', 'len', 'name', 'params',),
  127. )
  128.  
  129.  
  130. def glInitFragmentProgramNV():
  131.     '''Return boolean indicating whether this extension is available'''
  132.     return extensions.hasGLExtension( EXTENSION_NAME )
  133.