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

  1. '''OpenGL extension ARB.fragment_program
  2.  
  3. Overview (from the spec)
  4.     
  5.     Unextended OpenGL mandates a certain set of configurable per-
  6.     fragment computations defining texture application, texture 
  7.     environment, color sum, and fog operations.  Several extensions have 
  8.     added further per-fragment computations to OpenGL.  For example, 
  9.     extensions have defined new texture environment capabilities 
  10.     (ARB_texture_env_add, ARB_texture_env_combine, ARB_texture_env_dot3,
  11.     ARB_texture_env_crossbar), per-fragment depth comparisons 
  12.     (ARB_depth_texture, ARB_shadow, ARB_shadow_ambient, 
  13.     EXT_shadow_funcs), per-fragment lighting (EXT_fragment_lighting, 
  14.     EXT_light_texture), and environment mapped bump mapping 
  15.     (ATI_envmap_bumpmap).  
  16.     
  17.     Each such extension adds a small set of relatively inflexible per-
  18.     fragment computations.
  19.     
  20.     This inflexibility is in contrast to the typical flexibility 
  21.     provided by the underlying programmable floating point engines 
  22.     (whether micro-coded fragment engines, DSPs, or CPUs) that are 
  23.     traditionally used to implement OpenGL's texturing computations.  
  24.     The purpose of this extension is to expose to the OpenGL application 
  25.     writer a significant degree of per-fragment programmability for 
  26.     computing fragment parameters.
  27.     
  28.     For the purposes of discussing this extension, a fragment program is 
  29.     a sequence of floating-point 4-component vector operations that 
  30.     determines how a set of program parameters (not specific to an
  31.     individual fragment) and an input set of per-fragment parameters are 
  32.     transformed to a set of per-fragment result parameters.
  33.     
  34.     The per-fragment computations for standard OpenGL given a particular 
  35.     set of texture and fog application modes (along with any state for 
  36.     extensions defining per-fragment computations) is, in essence, a 
  37.     fragment program.  However, the sequence of operations is defined 
  38.     implicitly by the current OpenGL state settings rather than defined 
  39.     explicitly as a sequence of instructions.
  40.     
  41.     This extension provides an explicit mechanism for defining fragment 
  42.     program instruction sequences for application-defined fragment 
  43.     programs.  In order to define such fragment programs, this extension 
  44.     defines a fragment programming model including a floating-point
  45.     4-component vector instruction set and a relatively large set of 
  46.     floating-point 4-component registers.
  47.     
  48.     The extension's fragment programming model is designed for efficient
  49.     hardware implementation and to support a wide variety of fragment 
  50.     programs.  By design, the entire set of existing fragment programs 
  51.     defined by existing OpenGL per-fragment computation extensions can 
  52.     be implemented using the extension's fragment programming model.
  53.  
  54. The official definition of this extension is available here:
  55.     http://oss.sgi.com/projects/ogl-sample/registry/ARB/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_ARB_fragment_program'
  64. GL_FRAGMENT_PROGRAM_ARB = constant.Constant( 'GL_FRAGMENT_PROGRAM_ARB', 0x8804 )
  65. glget.addGLGetConstant( GL_FRAGMENT_PROGRAM_ARB, (1,) )
  66. GL_PROGRAM_ALU_INSTRUCTIONS_ARB = constant.Constant( 'GL_PROGRAM_ALU_INSTRUCTIONS_ARB', 0x8805 )
  67. GL_PROGRAM_TEX_INSTRUCTIONS_ARB = constant.Constant( 'GL_PROGRAM_TEX_INSTRUCTIONS_ARB', 0x8806 )
  68. GL_PROGRAM_TEX_INDIRECTIONS_ARB = constant.Constant( 'GL_PROGRAM_TEX_INDIRECTIONS_ARB', 0x8807 )
  69. GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = constant.Constant( 'GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB', 0x8808 )
  70. GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = constant.Constant( 'GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB', 0x8809 )
  71. GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = constant.Constant( 'GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB', 0x880A )
  72. GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB = constant.Constant( 'GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB', 0x880B )
  73. GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB = constant.Constant( 'GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB', 0x880C )
  74. GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB = constant.Constant( 'GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB', 0x880D )
  75. GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB = constant.Constant( 'GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB', 0x880E )
  76. GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB = constant.Constant( 'GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB', 0x880F )
  77. GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB = constant.Constant( 'GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB', 0x8810 )
  78. GL_MAX_TEXTURE_COORDS_ARB = constant.Constant( 'GL_MAX_TEXTURE_COORDS_ARB', 0x8871 )
  79. glget.addGLGetConstant( GL_MAX_TEXTURE_COORDS_ARB, (1,) )
  80. GL_MAX_TEXTURE_IMAGE_UNITS_ARB = constant.Constant( 'GL_MAX_TEXTURE_IMAGE_UNITS_ARB', 0x8872 )
  81. glget.addGLGetConstant( GL_MAX_TEXTURE_IMAGE_UNITS_ARB, (1,) )
  82.  
  83.  
  84. def glInitFragmentProgramARB():
  85.     '''Return boolean indicating whether this extension is available'''
  86.     return extensions.hasGLExtension( EXTENSION_NAME )
  87.