1'''OpenGL extension ARB.fragment_program 2 3This module customises the behaviour of the 4OpenGL.raw.GL.ARB.fragment_program to provide a more 5Python-friendly API 6 7Overview (from the spec) 8 9 Unextended OpenGL mandates a certain set of configurable per- 10 fragment computations defining texture application, texture 11 environment, color sum, and fog operations. Several extensions have 12 added further per-fragment computations to OpenGL. For example, 13 extensions have defined new texture environment capabilities 14 (ARB_texture_env_add, ARB_texture_env_combine, ARB_texture_env_dot3, 15 ARB_texture_env_crossbar), per-fragment depth comparisons 16 (ARB_depth_texture, ARB_shadow, ARB_shadow_ambient, 17 EXT_shadow_funcs), per-fragment lighting (EXT_fragment_lighting, 18 EXT_light_texture), and environment mapped bump mapping 19 (ATI_envmap_bumpmap). 20 21 Each such extension adds a small set of relatively inflexible per- 22 fragment computations. 23 24 This inflexibility is in contrast to the typical flexibility 25 provided by the underlying programmable floating point engines 26 (whether micro-coded fragment engines, DSPs, or CPUs) that are 27 traditionally used to implement OpenGL's texturing computations. 28 The purpose of this extension is to expose to the OpenGL application 29 writer a significant degree of per-fragment programmability for 30 computing fragment parameters. 31 32 For the purposes of discussing this extension, a fragment program is 33 a sequence of floating-point 4-component vector operations that 34 determines how a set of program parameters (not specific to an 35 individual fragment) and an input set of per-fragment parameters are 36 transformed to a set of per-fragment result parameters. 37 38 The per-fragment computations for standard OpenGL given a particular 39 set of texture and fog application modes (along with any state for 40 extensions defining per-fragment computations) is, in essence, a 41 fragment program. However, the sequence of operations is defined 42 implicitly by the current OpenGL state settings rather than defined 43 explicitly as a sequence of instructions. 44 45 This extension provides an explicit mechanism for defining fragment 46 program instruction sequences for application-defined fragment 47 programs. In order to define such fragment programs, this extension 48 defines a fragment programming model including a floating-point 49 4-component vector instruction set and a relatively large set of 50 floating-point 4-component registers. 51 52 The extension's fragment programming model is designed for efficient 53 hardware implementation and to support a wide variety of fragment 54 programs. By design, the entire set of existing fragment programs 55 defined by existing OpenGL per-fragment computation extensions can 56 be implemented using the extension's fragment programming model. 57 58The official definition of this extension is available here: 59http://www.opengl.org/registry/specs/ARB/fragment_program.txt 60''' 61from OpenGL import platform, constant, arrays 62from OpenGL import extensions, wrapper 63import ctypes 64from OpenGL.raw.GL import _types, _glgets 65from OpenGL.raw.GL.ARB.fragment_program import * 66from OpenGL.raw.GL.ARB.fragment_program import _EXTENSION_NAME 67 68def glInitFragmentProgramARB(): 69 '''Return boolean indicating whether this extension is available''' 70 from OpenGL import extensions 71 return extensions.hasGLExtension( _EXTENSION_NAME ) 72 73# INPUT glProgramStringARB.string size not checked against len 74glProgramStringARB=wrapper.wrapper(glProgramStringARB).setInputArraySize( 75 'string', None 76) 77# INPUT glDeleteProgramsARB.programs size not checked against n 78glDeleteProgramsARB=wrapper.wrapper(glDeleteProgramsARB).setInputArraySize( 79 'programs', None 80) 81glGenProgramsARB=wrapper.wrapper(glGenProgramsARB).setOutput( 82 'programs',size=lambda x:(x,),pnameArg='n',orPassIn=True 83) 84glProgramEnvParameter4dvARB=wrapper.wrapper(glProgramEnvParameter4dvARB).setInputArraySize( 85 'params', 4 86) 87glProgramEnvParameter4fvARB=wrapper.wrapper(glProgramEnvParameter4fvARB).setInputArraySize( 88 'params', 4 89) 90glProgramLocalParameter4dvARB=wrapper.wrapper(glProgramLocalParameter4dvARB).setInputArraySize( 91 'params', 4 92) 93glProgramLocalParameter4fvARB=wrapper.wrapper(glProgramLocalParameter4fvARB).setInputArraySize( 94 'params', 4 95) 96glGetProgramEnvParameterdvARB=wrapper.wrapper(glGetProgramEnvParameterdvARB).setOutput( 97 'params',size=(4,),orPassIn=True 98) 99glGetProgramEnvParameterfvARB=wrapper.wrapper(glGetProgramEnvParameterfvARB).setOutput( 100 'params',size=(4,),orPassIn=True 101) 102glGetProgramLocalParameterdvARB=wrapper.wrapper(glGetProgramLocalParameterdvARB).setOutput( 103 'params',size=(4,),orPassIn=True 104) 105glGetProgramLocalParameterfvARB=wrapper.wrapper(glGetProgramLocalParameterfvARB).setOutput( 106 'params',size=(4,),orPassIn=True 107) 108glGetProgramivARB=wrapper.wrapper(glGetProgramivARB).setOutput( 109 'params',size=(1,),orPassIn=True 110) 111# OUTPUT glGetProgramStringARB.string COMPSIZE(target, pname) 112### END AUTOGENERATED SECTION 113