glget.py :  » Game-2D-3D » PyOpenGL » PyOpenGL-3.0.1 » OpenGL » GL » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Game 2D 3D » PyOpenGL 
PyOpenGL » PyOpenGL 3.0.1 » OpenGL » GL » glget.py
"""Implementation of the special "glGet" functions

For comparison, here's what a straightforward implementation looks like:

    def glGetDoublev( pname ):
        "Natural writing of glGetDoublev using standard ctypes"
        output = c_double*sizes.get( pname )
        result = output()
        result = platform.OpenGL.glGetDoublev( pname, byref(result) )
        return Numeric.array( result )
"""
from OpenGL import platform,arrays,error,wrapper,converters
from OpenGL.raw import GL
import ctypes
GLenum = ctypes.c_uint
GLsize = GLsizei = ctypes.c_int

__all__ = (
    'glGetBoolean','glGetBooleanv','glGetInteger','glGetIntegerv',
    'glGetFloat','glGetFloatv','glGetDouble','glGetDoublev',
    'glGetString',
    'glGetLightfv','glGetLightiv',
    'glGetMaterialfv','glGetMaterialiv',
    'glGetPixelMapfv','glGetPixelMapusv','glGetPixelMapuiv',
    'glGetPolygonStipple', 'glGetPolygonStippleub',
    'glGetTexEnviv','glGetTexEnvfv',
    'glGetTexGenfv','glGetTexGeniv','glGetTexGendv',
    'glGetTexLevelParameteriv',
    'glGetTexLevelParameterfv',
    'glGetTexParameterfv',
    'glGetTexParameteriv',
)

glGetString = platform.OpenGL.glGetString
glGetString.restype = ctypes.c_char_p
glGetString.__doc__ = """glGetString( constant ) -> Current string value"""

GL_GET_SIZES = {
    simple.GL_ACCUM_ALPHA_BITS                      : (1,),                
    simple.GL_ACCUM_BLUE_BITS                       : (1,),                
    simple.GL_ACCUM_CLEAR_VALUE                     : (4,),                
    simple.GL_ACCUM_GREEN_BITS                      : (1,),                
    simple.GL_ACCUM_RED_BITS                        : (1,),                
    simple.GL_ACTIVE_TEXTURE                        : (1,),
    simple.GL_ACTIVE_TEXTURE_ARB                    : (1,),                
    simple.GL_ALIASED_LINE_WIDTH_RANGE              : (2,),                
    simple.GL_ALIASED_POINT_SIZE_RANGE              : (2,),                
    simple.GL_ALPHA_BIAS                            : (1,),                
    simple.GL_ALPHA_BITS                            : (1,),                
    simple.GL_ALPHA_SCALE                           : (1,),                
    simple.GL_ALPHA_TEST                            : (1,),                
    simple.GL_ALPHA_TEST_FUNC                       : (1,),                
    simple.GL_ALPHA_TEST_REF                        : (1,),                
    simple.GL_ARRAY_BUFFER_BINDING                  : (1,),
    simple.GL_ATTRIB_STACK_DEPTH                    : (1,),                
    simple.GL_AUTO_NORMAL                           : (1,),                
    simple.GL_AUX_BUFFERS                           : (1,),                
    simple.GL_BLEND                                 : (1,),                
    simple.GL_BLEND_COLOR                           : (4,),                
    simple.GL_BLEND_DST_ALPHA                       : (1,),                
    simple.GL_BLEND_DST_RGB                         : (1,),                
    simple.GL_BLEND_EQUATION_RGB                    : (1,),                
    simple.GL_BLEND_EQUATION_ALPHA                  : (1,),                
    simple.GL_BLEND_SRC_RGB                         : (1,),                
    simple.GL_BLEND_SRC_ALPHA                       : (1,),                
    simple.GL_BLUE_BIAS                             : (1,),                
    simple.GL_BLUE_BITS                             : (1,),                
    simple.GL_BLUE_SCALE                            : (1,),                
    simple.GL_CLIENT_ACTIVE_TEXTURE                 : (1,),                
    simple.GL_CLIENT_ACTIVE_TEXTURE_ARB             : (1,),                
    simple.GL_CLIENT_ATTRIB_STACK_DEPTH             : (1,),                
    simple.GL_CLIP_PLANE0                           : (1,),                
    simple.GL_CLIP_PLANE1                           : (1,),                
    simple.GL_CLIP_PLANE2                           : (1,),                
    simple.GL_CLIP_PLANE3                           : (1,),                
    simple.GL_CLIP_PLANE4                           : (1,),                
    simple.GL_CLIP_PLANE5                           : (1,),                
    simple.GL_COLOR_ARRAY                           : (1,),                
    simple.GL_COLOR_ARRAY_BUFFER_BINDING            : (1,),                
    simple.GL_COLOR_ARRAY_SIZE                      : (1,),                
    simple.GL_COLOR_ARRAY_STRIDE                    : (1,),                
    simple.GL_COLOR_ARRAY_TYPE                      : (1,),                
    simple.GL_COLOR_CLEAR_VALUE                     : (4,),                
    simple.GL_COLOR_LOGIC_OP                        : (1,),                
    simple.GL_COLOR_MATERIAL                        : (1,),                
    simple.GL_COLOR_MATERIAL_FACE                   : (1,),                
    simple.GL_COLOR_MATERIAL_PARAMETER              : (1,),                
    simple.GL_COLOR_MATRIX                          : (4, 4),              
    simple.GL_COLOR_MATRIX_STACK_DEPTH              : (1,),                
    simple.GL_COLOR_SUM                             : (1,),                
    simple.GL_COLOR_TABLE                           : (1,),                
    simple.GL_COLOR_WRITEMASK                       : (4,),                
    # TODO: this *requires* a lookup to determine how many will be returned...
    #simple.GL_COMPRESSED_TEXTURE_FORMATS            : (4,),
    simple.GL_CONVOLUTION_1D                        : (1,),                
    simple.GL_CONVOLUTION_2D                        : (1,),                
    simple.GL_CULL_FACE                             : (1,),                
    simple.GL_CULL_FACE_MODE                        : (1,),                
    simple.GL_CURRENT_COLOR                         : (4,),                
    simple.GL_CURRENT_INDEX                         : (1,),                
    simple.GL_CURRENT_NORMAL                        : (3,),                
    simple.GL_CURRENT_RASTER_COLOR                  : (4,),                
    simple.GL_CURRENT_RASTER_DISTANCE               : (1,),                
    simple.GL_CURRENT_RASTER_INDEX                  : (1,),                
    simple.GL_CURRENT_RASTER_POSITION               : (4,),                
    simple.GL_CURRENT_RASTER_POSITION_VALID         : (1,),                
    simple.GL_CURRENT_RASTER_TEXTURE_COORDS         : (4,),                
    simple.GL_CURRENT_SECONDARY_COLOR               : (4,),                
    simple.GL_CURRENT_TEXTURE_COORDS                : (4,),                
    simple.GL_DEPTH_BIAS                            : (1,),                
    simple.GL_DEPTH_BITS                            : (1,),                
    simple.GL_DEPTH_CLEAR_VALUE                     : (1,),                
    simple.GL_DEPTH_FUNC                            : (1,),                
    simple.GL_DEPTH_RANGE                           : (2,),                
    simple.GL_DEPTH_SCALE                           : (1,),                
    simple.GL_DEPTH_TEST                            : (1,),                
    simple.GL_DEPTH_WRITEMASK                       : (1,),                
    simple.GL_DITHER                                : (1,),                
    simple.GL_DOUBLEBUFFER                          : (1,),                
    simple.GL_DRAW_BUFFER                           : (1,),                
    simple.GL_EDGE_FLAG                             : (1,),                
    simple.GL_EDGE_FLAG_ARRAY                       : (1,),                
    simple.GL_EDGE_FLAG_ARRAY_BUFFER_BINDING        : (1,),
    simple.GL_EDGE_FLAG_ARRAY_STRIDE                : (1,),
    simple.GL_ELEMENT_ARRAY_BUFFER_BINDING          : (1,),
    simple.GL_FEEDBACK_BUFFER_SIZE                  : (1,),                
    simple.GL_FEEDBACK_BUFFER_TYPE                  : (1,),                
    simple.GL_FOG                                   : (1,),                
    simple.GL_FOG_COORD_ARRAY                       : (1,),
    simple.GL_FOG_COORD_ARRAY_BUFFER_BINDING        : (1,),
    simple.GL_FOG_COORD_ARRAY_STRIDE                : (1,),
    simple.GL_FOG_COORD_ARRAY_TYPE                  : (1,),
    simple.GL_FOG_COORD_SRC                         : (1,),
    simple.GL_FOG_COLOR                             : (4,),                
    simple.GL_FOG_DENSITY                           : (1,),                
    simple.GL_FOG_END                               : (1,),                
    simple.GL_FOG_HINT                              : (1,),                
    simple.GL_FOG_INDEX                             : (1,),                
    simple.GL_FOG_MODE                              : (1,),                
    simple.GL_FOG_START                             : (1,),
    simple.GL_FRAGMENT_SHADER_DERIVATIVE_HINT       : (1,),
    simple.GL_FRONT_FACE                            : (1,),                
    simple.GL_GENERATE_MIPMAP_HINT                  : (1,),
    simple.GL_GREEN_BIAS                            : (1,),                
    simple.GL_GREEN_BITS                            : (1,),                
    simple.GL_GREEN_SCALE                           : (1,),                
    simple.GL_HISTOGRAM                             : (1,),                
    simple.GL_INDEX_ARRAY                           : (1,),  
    simple.GL_INDEX_ARRAY_BUFFER_BINDING            : (1,),
    simple.GL_INDEX_ARRAY_STRIDE                    : (1,),                
    simple.GL_INDEX_ARRAY_TYPE                      : (1,),                
    simple.GL_INDEX_BITS                            : (1,),                
    simple.GL_INDEX_CLEAR_VALUE                     : (1,),                
    simple.GL_INDEX_LOGIC_OP                        : (1,),                
    simple.GL_INDEX_MODE                            : (1,),                
    simple.GL_INDEX_OFFSET                          : (1,),                
    simple.GL_INDEX_SHIFT                           : (1,),                
    simple.GL_INDEX_WRITEMASK                       : (1,),                
    simple.GL_LIGHT0                                : (1,),                
    simple.GL_LIGHT1                                : (1,),                
    simple.GL_LIGHT2                                : (1,),                
    simple.GL_LIGHT3                                : (1,),                
    simple.GL_LIGHT4                                : (1,),                
    simple.GL_LIGHT5                                : (1,),                
    simple.GL_LIGHT6                                : (1,),                
    simple.GL_LIGHT7                                : (1,),                
    simple.GL_LIGHTING                              : (1,),                
    simple.GL_LIGHT_MODEL_AMBIENT                   : (4,),                
    simple.GL_LIGHT_MODEL_COLOR_CONTROL             : (1,),                
    simple.GL_LIGHT_MODEL_LOCAL_VIEWER              : (1,),                
    simple.GL_LIGHT_MODEL_TWO_SIDE                  : (1,),                
    simple.GL_LINE_SMOOTH                           : (1,),                
    simple.GL_LINE_SMOOTH_HINT                      : (1,),                
    simple.GL_LINE_STIPPLE                          : (1,),                
    simple.GL_LINE_STIPPLE_PATTERN                  : (1,),                
    simple.GL_LINE_STIPPLE_REPEAT                   : (1,),                
    simple.GL_LINE_WIDTH                            : (1,),                
    simple.GL_LINE_WIDTH_GRANULARITY                : (1,),                
    simple.GL_LINE_WIDTH_RANGE                      : (2,),                
    simple.GL_LIST_BASE                             : (1,),                
    simple.GL_LIST_INDEX                            : (1,),                
    simple.GL_LIST_MODE                             : (1,),                
    simple.GL_LOGIC_OP_MODE                         : (1,),                
    simple.GL_MAP1_COLOR_4                          : (1,),                
    simple.GL_MAP1_GRID_DOMAIN                      : (2,),                
    simple.GL_MAP1_GRID_SEGMENTS                    : (1,),                
    simple.GL_MAP1_INDEX                            : (1,),                
    simple.GL_MAP1_NORMAL                           : (1,),                
    simple.GL_MAP1_TEXTURE_COORD_1                  : (1,),                
    simple.GL_MAP1_TEXTURE_COORD_2                  : (1,),                
    simple.GL_MAP1_TEXTURE_COORD_3                  : (1,),                
    simple.GL_MAP1_TEXTURE_COORD_4                  : (1,),                
    simple.GL_MAP1_VERTEX_3                         : (1,),                
    simple.GL_MAP1_VERTEX_4                         : (1,),                
    simple.GL_MAP2_COLOR_4                          : (1,),                
    simple.GL_MAP2_GRID_DOMAIN                      : (4,),                
    simple.GL_MAP2_GRID_SEGMENTS                    : (2,),                
    simple.GL_MAP2_INDEX                            : (1,),                
    simple.GL_MAP2_NORMAL                           : (1,),                
    simple.GL_MAP2_TEXTURE_COORD_1                  : (1,),                
    simple.GL_MAP2_TEXTURE_COORD_2                  : (1,),                
    simple.GL_MAP2_TEXTURE_COORD_3                  : (1,),                
    simple.GL_MAP2_TEXTURE_COORD_4                  : (1,),                
    simple.GL_MAP2_VERTEX_3                         : (1,),                
    simple.GL_MAP2_VERTEX_4                         : (1,),                
    simple.GL_MAP_COLOR                             : (1,),                
    simple.GL_MAP_STENCIL                           : (1,),                
    simple.GL_MATRIX_MODE                           : (1,),                
    simple.GL_MAX_3D_TEXTURE_SIZE                   : (1,),                
    simple.GL_MAX_ATTRIB_STACK_DEPTH                : (1,),                
    simple.GL_MAX_CLIENT_ATTRIB_STACK_DEPTH         : (1,),                
    simple.GL_MAX_CLIP_PLANES                       : (1,),                
    simple.GL_MAX_COLOR_MATRIX_STACK_DEPTH          : (1,),                
    simple.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS      : (1,),
    simple.GL_MAX_CUBE_MAP_TEXTURE_SIZE             : (1,),
    simple.GL_MAX_DRAW_BUFFERS                      : (1,),
    simple.GL_MAX_ELEMENTS_INDICES                  : (1,),                
    simple.GL_MAX_ELEMENTS_VERTICES                 : (1,),                
    simple.GL_MAX_EVAL_ORDER                        : (1,),                
    simple.GL_MAX_LIGHTS                            : (1,),                
    simple.GL_MAX_LIST_NESTING                      : (1,),                
    simple.GL_MAX_MODELVIEW_STACK_DEPTH             : (1,),                
    simple.GL_MAX_NAME_STACK_DEPTH                  : (1,),                
    simple.GL_MAX_PIXEL_MAP_TABLE                   : (1,),                
    simple.GL_MAX_PROJECTION_STACK_DEPTH            : (1,),                
    simple.GL_MAX_TEXTURE_IMAGE_UNITS               : (1,),                
    simple.GL_MAX_TEXTURE_LOD_BIAS                  : (1,),
    simple.GL_MAX_TEXTURE_SIZE                      : (1,),                
    simple.GL_MAX_TEXTURE_STACK_DEPTH               : (1,),                
    simple.GL_MAX_TEXTURE_UNITS                     : (1,),                
    simple.GL_MAX_TEXTURE_UNITS_ARB                 : (1,),                
    simple.GL_MAX_VARYING_FLOATS                    : (1,),
    simple.GL_MAX_VERTEX_ATTRIBS                    : (1,),
    simple.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS        : (1,),
    simple.GL_MAX_VERTEX_UNIFORM_COMPONENTS         : (1,),
    simple.GL_MAX_VIEWPORT_DIMS                     : (2,),                
    simple.GL_MINMAX                                : (1,),                
    simple.GL_MODELVIEW_MATRIX                      : (4, 4),              
    simple.GL_MODELVIEW_STACK_DEPTH                 : (1,),                
    simple.GL_NAME_STACK_DEPTH                      : (1,),                
    simple.GL_NORMALIZE                             : (1,),                
    simple.GL_NORMAL_ARRAY                          : (1,),                
    simple.GL_NORMAL_ARRAY_BUFFER_BINDING           : (1,),
    simple.GL_NORMAL_ARRAY_STRIDE                   : (1,),                
    simple.GL_NORMAL_ARRAY_TYPE                     : (1,),
    simple.GL_NORMALIZE                             : (1,),
    simple.GL_NUM_COMPRESSED_TEXTURE_FORMATS        : (1,),
    simple.GL_PACK_ALIGNMENT                        : (1,),                
    simple.GL_PACK_IMAGE_HEIGHT                     : (1,),                
    simple.GL_PACK_LSB_FIRST                        : (1,),                
    simple.GL_PACK_ROW_LENGTH                       : (1,),                
    simple.GL_PACK_SKIP_IMAGES                      : (1,),                
    simple.GL_PACK_SKIP_PIXELS                      : (1,),                
    simple.GL_PACK_SKIP_ROWS                        : (1,),                
    simple.GL_PACK_SWAP_BYTES                       : (1,),                
    simple.GL_PERSPECTIVE_CORRECTION_HINT           : (1,),                
    simple.GL_PIXEL_MAP_A_TO_A_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_B_TO_B_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_G_TO_G_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_I_TO_A_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_I_TO_B_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_I_TO_G_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_I_TO_I_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_I_TO_R_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_R_TO_R_SIZE                 : (1,),                
    simple.GL_PIXEL_MAP_S_TO_S_SIZE                 : (1,),                
    simple.GL_PIXEL_PACK_BUFFER_BINDING_ARB         : (1,),
    simple.GL_PIXEL_UNPACK_BUFFER_BINDING_ARB       : (1,),
    simple.GL_POINT_DISTANCE_ATTENUATION            : (3,),
    simple.GL_POINT_FADE_THRESHOLD_SIZE             : (1,),
    simple.GL_POINT_SIZE                            : (1,),                
    simple.GL_POINT_SIZE_GRANULARITY                : (1,),                
    simple.GL_POINT_SIZE_MAX                        : (1,),
    simple.GL_POINT_SIZE_MIN                        : (1,),
    simple.GL_POINT_SIZE_RANGE                      : (2,),                
    simple.GL_POINT_SMOOTH                          : (1,),                
    simple.GL_POINT_SMOOTH_HINT                     : (1,),                
    simple.GL_POLYGON_MODE                          : (2,),                
    simple.GL_POLYGON_OFFSET_FACTOR                 : (1,),                
    simple.GL_POLYGON_OFFSET_FILL                   : (1,),                
    simple.GL_POLYGON_OFFSET_LINE                   : (1,),                
    simple.GL_POLYGON_OFFSET_POINT                  : (1,),                
    simple.GL_POLYGON_OFFSET_UNITS                  : (1,),                
    simple.GL_POLYGON_SMOOTH                        : (1,),                
    simple.GL_POLYGON_SMOOTH_HINT                   : (1,),                
    simple.GL_POLYGON_STIPPLE                       : (1,),
    simple.GL_POST_COLOR_MATRIX_ALPHA_BIAS          : (1,),                
    simple.GL_POST_COLOR_MATRIX_ALPHA_SCALE         : (1,),                
    simple.GL_POST_COLOR_MATRIX_BLUE_BIAS           : (1,),                
    simple.GL_POST_COLOR_MATRIX_BLUE_SCALE          : (1,),                
    simple.GL_POST_COLOR_MATRIX_COLOR_TABLE         : (1,),                
    simple.GL_POST_COLOR_MATRIX_GREEN_BIAS          : (1,),                
    simple.GL_POST_COLOR_MATRIX_GREEN_SCALE         : (1,),                
    simple.GL_POST_COLOR_MATRIX_RED_BIAS            : (1,),                
    simple.GL_POST_COLOR_MATRIX_RED_SCALE           : (1,),                
    simple.GL_POST_CONVOLUTION_ALPHA_BIAS           : (1,),                
    simple.GL_POST_CONVOLUTION_ALPHA_SCALE          : (1,),                
    simple.GL_POST_CONVOLUTION_BLUE_BIAS            : (1,),                
    simple.GL_POST_CONVOLUTION_BLUE_SCALE           : (1,),                
    simple.GL_POST_CONVOLUTION_COLOR_TABLE          : (1,),                
    simple.GL_POST_CONVOLUTION_GREEN_BIAS           : (1,),                
    simple.GL_POST_CONVOLUTION_GREEN_SCALE          : (1,),                
    simple.GL_POST_CONVOLUTION_RED_BIAS             : (1,),                
    simple.GL_POST_CONVOLUTION_RED_SCALE            : (1,),                
    simple.GL_PROJECTION_MATRIX                     : (4, 4),              
    simple.GL_PROJECTION_STACK_DEPTH                : (1,),                
    simple.GL_READ_BUFFER                           : (1,),                
    simple.GL_RED_BIAS                              : (1,),                
    simple.GL_RED_BITS                              : (1,),                
    simple.GL_RED_SCALE                             : (1,),                
    simple.GL_RENDER_MODE                           : (1,),                
    simple.GL_RESCALE_NORMAL                        : (1,),                
    simple.GL_RGBA_MODE                             : (1,),                
    simple.GL_SAMPLE_BUFFERS                        : (1,),
    simple.GL_SAMPLE_COVERAGE_VALUE                 : (1,),
    simple.GL_SAMPLE_COVERAGE_INVERT                : (1,),
    simple.GL_SAMPLES                               : (1,),
    simple.GL_SCISSOR_BOX                           : (4,),                
    simple.GL_SCISSOR_TEST                          : (1,),                
    simple.GL_SECONDARY_COLOR_ARRAY                 : (1,),
    simple.GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING  : (1,),
    simple.GL_SECONDARY_COLOR_ARRAY_SIZE            : (1,),
    simple.GL_SECONDARY_COLOR_ARRAY_STRIDE          : (1,),
    simple.GL_SECONDARY_COLOR_ARRAY_TYPE            : (1,),
    simple.GL_SELECTION_BUFFER_SIZE                 : (1,),                
    simple.GL_SEPARABLE_2D                          : (1,),                
    simple.GL_SHADE_MODEL                           : (1,),
    simple.GL_SMOOTH_LINE_WIDTH_RANGE               : (1,),
    simple.GL_SMOOTH_LINE_WIDTH_GRANULARITY         : (1,),
    simple.GL_SMOOTH_POINT_SIZE_RANGE               : (2,),
    simple.GL_SMOOTH_POINT_SIZE_GRANULARITY         : (1,),
    simple.GL_STENCIL_BACK_FAIL                     : (1,),
    simple.GL_STENCIL_BACK_FUNC                     : (1,),
    simple.GL_STENCIL_BACK_PASS_DEPTH_FAIL          : (1,),
    simple.GL_STENCIL_BACK_PASS_DEPTH_PASS          : (1,),
    simple.GL_STENCIL_BACK_REF                      : (1,),
    simple.GL_STENCIL_BACK_VALUE_MASK               : (1,),
    simple.GL_STENCIL_BACK_WRITEMASK                : (1,),
    simple.GL_STENCIL_BITS                          : (1,),                
    simple.GL_STENCIL_CLEAR_VALUE                   : (1,),                
    simple.GL_STENCIL_FAIL                          : (1,),                
    simple.GL_STENCIL_FUNC                          : (1,),                
    simple.GL_STENCIL_PASS_DEPTH_FAIL               : (1,),                
    simple.GL_STENCIL_PASS_DEPTH_PASS               : (1,),                
    simple.GL_STENCIL_REF                           : (1,),                
    simple.GL_STENCIL_TEST                          : (1,),                
    simple.GL_STENCIL_VALUE_MASK                    : (1,),                
    simple.GL_STENCIL_WRITEMASK                     : (1,),                
    simple.GL_STEREO                                : (1,),                
    simple.GL_SUBPIXEL_BITS                         : (1,),
    simple.GL_TEXTURE_1D                            : (1,),
    simple.GL_TEXTURE_2D                            : (1,),
    simple.GL_TEXTURE_3D                            : (1,),
    simple.GL_TEXTURE_CUBE_MAP                      : (1,),
    simple.GL_TEXTURE_BINDING_1D                    : (1,),
    simple.GL_TEXTURE_BINDING_2D                    : (1,),
    simple.GL_TEXTURE_BINDING_3D                    : (1,),
    simple.GL_TEXTURE_BINDING_CUBE_MAP              : (1,),
    simple.GL_TEXTURE_COMPRESSION_HINT              : (1,),
    simple.GL_TEXTURE_COORD_ARRAY                   : (1,),
    simple.GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING    : (1,),
    simple.GL_TEXTURE_COORD_ARRAY_SIZE              : (1,),
    simple.GL_TEXTURE_COORD_ARRAY_STRIDE            : (1,),
    simple.GL_TEXTURE_COORD_ARRAY_TYPE              : (1,),
    simple.GL_TEXTURE_GEN_Q                         : (1,),
    simple.GL_TEXTURE_GEN_R                         : (1,),
    simple.GL_TEXTURE_GEN_S                         : (1,),
    simple.GL_TEXTURE_GEN_T                         : (1,),
    simple.GL_TEXTURE_MATRIX                        : (4, 4),
    simple.GL_TEXTURE_STACK_DEPTH                   : (1,),
    simple.GL_TRANSPOSE_COLOR_MATRIX                : (4,4),
    simple.GL_TRANSPOSE_MODELVIEW_MATRIX            : (4,4),
    simple.GL_TRANSPOSE_PROJECTION_MATRIX           : (4,4),
    simple.GL_TRANSPOSE_TEXTURE_MATRIX              : (4,4),
    simple.GL_UNPACK_ALIGNMENT                      : (1,),
    simple.GL_UNPACK_IMAGE_HEIGHT                   : (1,),
    simple.GL_UNPACK_LSB_FIRST                      : (1,),
    simple.GL_UNPACK_ROW_LENGTH                     : (1,),
    simple.GL_UNPACK_SKIP_IMAGES                    : (1,),
    simple.GL_UNPACK_SKIP_PIXELS                    : (1,),
    simple.GL_UNPACK_SKIP_ROWS                      : (1,),
    simple.GL_UNPACK_SWAP_BYTES                     : (1,),
    simple.GL_VERTEX_ARRAY                          : (1,),
    simple.GL_VERTEX_ARRAY_BUFFER_BINDING           : (1,),
    simple.GL_VERTEX_ARRAY_SIZE                     : (1,),
    simple.GL_VERTEX_ARRAY_STRIDE                   : (1,),
    simple.GL_VERTEX_ARRAY_TYPE                     : (1,),
    simple.GL_VERTEX_PROGRAM_POINT_SIZE             : (1,),
    simple.GL_VERTEX_PROGRAM_TWO_SIDE               : (1,),
    simple.GL_VIEWPORT                              : (4,),
    simple.GL_ZOOM_X                                : (1,),
    simple.GL_ZOOM_Y                                : (1,),
    
    # Constants beyond OpenGL 2.1 (see src/find_glget_constants.py)...
    # Note: there are more, this is just what *my* hardware can find...
    simple.GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: (1,),
    simple.GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: (1,),
    simple.GL_BLEND_DST: (1,),
    simple.GL_BLEND_SRC: (1,),
    simple.GL_CLAMP_FRAGMENT_COLOR_ARB: (1,),
    simple.GL_CLAMP_READ_COLOR_ARB: (1,),
    simple.GL_CLAMP_VERTEX_COLOR_ARB: (1,),
    simple.GL_COLOR_ALPHA_PAIRING_ATI: (1,),
    simple.GL_COLOR_ARRAY_COUNT_EXT: (1,),
    simple.GL_COMPRESSED_TEXTURE_FORMATS: (1,),
    simple.GL_COMPRESSED_TEXTURE_FORMATS_ARB: (1,),
    simple.GL_CURRENT_FOG_COORDINATE: (1,),
    simple.GL_CURRENT_FOG_COORDINATE: (1,),
    simple.GL_CURRENT_FOG_COORDINATE_EXT: (1,),
    simple.GL_CURRENT_MATRIX_ARB: (4, 4),
    simple.GL_CURRENT_MATRIX_NV: (4, 4),
    simple.GL_CURRENT_MATRIX_STACK_DEPTH_ARB: (1,),
    simple.GL_CURRENT_MATRIX_STACK_DEPTH_NV: (1,),
    simple.GL_CURRENT_PROGRAM: (1,),
    simple.GL_DRAW_BUFFER0: (1,),
    simple.GL_DRAW_BUFFER0_ARB: (1,),
    simple.GL_DRAW_BUFFER0_ATI: (1,),
    simple.GL_DRAW_BUFFER1: (1,),
    simple.GL_DRAW_BUFFER10: (1,),
    simple.GL_DRAW_BUFFER10_ARB: (1,),
    simple.GL_DRAW_BUFFER10_ATI: (1,),
    simple.GL_DRAW_BUFFER11: (1,),
    simple.GL_DRAW_BUFFER11_ARB: (1,),
    simple.GL_DRAW_BUFFER11_ATI: (1,),
    simple.GL_DRAW_BUFFER12: (1,),
    simple.GL_DRAW_BUFFER12_ARB: (1,),
    simple.GL_DRAW_BUFFER12_ATI: (1,),
    simple.GL_DRAW_BUFFER13: (1,),
    simple.GL_DRAW_BUFFER13_ARB: (1,),
    simple.GL_DRAW_BUFFER13_ATI: (1,),
    simple.GL_DRAW_BUFFER14: (1,),
    simple.GL_DRAW_BUFFER14_ARB: (1,),
    simple.GL_DRAW_BUFFER14_ATI: (1,),
    simple.GL_DRAW_BUFFER15: (1,),
    simple.GL_DRAW_BUFFER15_ARB: (1,),
    simple.GL_DRAW_BUFFER15_ATI: (1,),
    simple.GL_DRAW_BUFFER1_ARB: (1,),
    simple.GL_DRAW_BUFFER1_ATI: (1,),
    simple.GL_DRAW_BUFFER2: (1,),
    simple.GL_DRAW_BUFFER2_ARB: (1,),
    simple.GL_DRAW_BUFFER2_ATI: (1,),
    simple.GL_DRAW_BUFFER3: (1,),
    simple.GL_DRAW_BUFFER3_ARB: (1,),
    simple.GL_DRAW_BUFFER3_ATI: (1,),
    simple.GL_DRAW_BUFFER4: (1,),
    simple.GL_DRAW_BUFFER4_ARB: (1,),
    simple.GL_DRAW_BUFFER4_ATI: (1,),
    simple.GL_DRAW_BUFFER5: (1,),
    simple.GL_DRAW_BUFFER5_ARB: (1,),
    simple.GL_DRAW_BUFFER5_ATI: (1,),
    simple.GL_DRAW_BUFFER6: (1,),
    simple.GL_DRAW_BUFFER6_ARB: (1,),
    simple.GL_DRAW_BUFFER6_ATI: (1,),
    simple.GL_DRAW_BUFFER7: (1,),
    simple.GL_DRAW_BUFFER7_ARB: (1,),
    simple.GL_DRAW_BUFFER7_ATI: (1,),
    simple.GL_DRAW_BUFFER8: (1,),
    simple.GL_DRAW_BUFFER8_ARB: (1,),
    simple.GL_DRAW_BUFFER8_ATI: (1,),
    simple.GL_DRAW_BUFFER9: (1,),
    simple.GL_DRAW_BUFFER9_ARB: (1,),
    simple.GL_DRAW_BUFFER9_ATI: (1,),
    simple.GL_EDGE_FLAG_ARRAY_COUNT_EXT: (1,),
    simple.GL_FRAGMENT_PROGRAM_ARB: (1,),
    simple.GL_FRAGMENT_SHADER_ATI: (1,),
    simple.GL_FRAMEBUFFER_BINDING_EXT: (1,),
    simple.GL_INDEX_ARRAY_COUNT_EXT: (1,),
    simple.GL_MAX_COLOR_ATTACHMENTS_EXT: (1,),
    simple.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: (1,),
    simple.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: (1,),
    simple.GL_MAX_PROGRAM_MATRICES_ARB: (1,),
    simple.GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: (1,),
    simple.GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB: (1,),
    simple.GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: (1,),
    simple.GL_MAX_RENDERBUFFER_SIZE_EXT: (1,),
    simple.GL_MAX_TEXTURE_COORDS: (1,),
    simple.GL_MAX_TEXTURE_COORDS_ARB: (1,),
    simple.GL_MAX_TEXTURE_COORDS_NV: (1,),
    simple.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: (1,),
    simple.GL_MAX_TRACK_MATRICES_NV: (1,),
    simple.GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV: (1,),
    simple.GL_MULTISAMPLE: (1,),
    simple.GL_MULTISAMPLE_ARB: (1,),
    simple.GL_MULTISAMPLE_EXT: (1,),
    simple.GL_MULTISAMPLE_SGIS: (1,),
    simple.GL_NORMAL_ARRAY_COUNT_EXT: (1,),
    simple.GL_NUM_FRAGMENT_CONSTANTS_ATI: (1,),
    simple.GL_NUM_FRAGMENT_REGISTERS_ATI: (1,),
    simple.GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: (1,),
    simple.GL_NUM_INSTRUCTIONS_PER_PASS_ATI: (1,),
    simple.GL_NUM_INSTRUCTIONS_TOTAL_ATI: (1,),
    simple.GL_NUM_LOOPBACK_COMPONENTS_ATI: (1,),
    simple.GL_NUM_PASSES_ATI: (1,),
    simple.GL_PIXEL_COUNTER_BITS_NV: (1,),
    simple.GL_POINT_SPRITE: (1,),
    simple.GL_POINT_SPRITE_ARB: (1,),
    simple.GL_POINT_SPRITE_COORD_ORIGIN: (1,),
    simple.GL_POINT_SPRITE_NV: (1,),
    simple.GL_PRIMITIVE_RESTART_INDEX_NV: (1,),
    simple.GL_PRIMITIVE_RESTART_NV: (1,),
    simple.GL_PROGRAM_ERROR_POSITION_ARB: (1,),
    simple.GL_PROGRAM_ERROR_POSITION_NV: (1,),
    simple.GL_QUERY_COUNTER_BITS: (1,),
    simple.GL_QUERY_COUNTER_BITS_ARB: (1,),
    simple.GL_RENDERBUFFER_BINDING_EXT: (1,),
    simple.GL_RGBA_FLOAT_MODE_ARB: (1,),
    simple.GL_SAMPLE_ALPHA_TO_COVERAGE: (1,),
    simple.GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: (1,),
    simple.GL_SAMPLE_ALPHA_TO_MASK_EXT: (1,),
    simple.GL_SAMPLE_ALPHA_TO_MASK_SGIS: (1,),
    simple.GL_SAMPLE_ALPHA_TO_ONE: (1,),
    simple.GL_SAMPLE_ALPHA_TO_ONE_ARB: (1,),
    simple.GL_SAMPLE_ALPHA_TO_ONE_EXT: (1,),
    simple.GL_SAMPLE_ALPHA_TO_ONE_SGIS: (1,),
    simple.GL_SAMPLE_COVERAGE: (1,),
    simple.GL_SAMPLE_COVERAGE_ARB: (1,),
    simple.GL_SAMPLE_MASK_EXT: (1,),
    simple.GL_SAMPLE_MASK_SGIS: (1,),
    simple.GL_TEXTURE_BINDING_RECTANGLE_ARB: (1,),
    simple.GL_TEXTURE_BINDING_RECTANGLE_NV: (1,),
    simple.GL_TEXTURE_COORD_ARRAY_COUNT_EXT: (1,),
    simple.GL_TEXTURE_RECTANGLE_ARB: (1,),
    simple.GL_TEXTURE_RECTANGLE_NV: (1,),
    simple.GL_TRANSPOSE_CURRENT_MATRIX_ARB: (4, 4),
    simple.GL_TYPE_RGBA_FLOAT_ATI: (1,),
    simple.GL_UNPACK_CLIENT_STORAGE_APPLE: (1,),
    simple.GL_VERTEX_ARRAY_BINDING_APPLE: (1,),
    simple.GL_VERTEX_ARRAY_COUNT_EXT: (1,),
    simple.GL_VERTEX_PROGRAM_ARB: (1,),
    simple.GL_VERTEX_PROGRAM_NV: (1,),
    simple.GL_VERTEX_SHADER_EXT: (1,),
}
def addGLGetConstant( constant, arraySize ):
    """Add a glGet* constant to return an output array of correct size"""
    GL_GET_SIZES[ constant ] = arraySize
glGetDouble = glGetDoublev = wrapper.wrapper(simple.glGetDoublev).setOutput(
    "params",GL_GET_SIZES, "pname", 
)
glGetFloat = glGetFloatv = wrapper.wrapper(simple.glGetFloatv).setOutput(
    "params",GL_GET_SIZES, "pname", 
)
glGetBoolean = glGetBooleanv = glGetInteger = glGetIntegerv = wrapper.wrapper(simple.glGetIntegerv).setOutput(
    "params",GL_GET_SIZES, "pname", 
)

GL_GET_LIGHT_SIZES = {
    # glGetLightXv
    simple.GL_AMBIENT                               : (4,),
    simple.GL_DIFFUSE                               : (4,),
    simple.GL_SPECULAR                              : (4,),
    simple.GL_POSITION                              : (4,),
    simple.GL_SPOT_DIRECTION                        : (3,),
    simple.GL_SPOT_EXPONENT                         : (1,),
    simple.GL_SPOT_CUTOFF                           : (1,),
    simple.GL_CONSTANT_ATTENUATION                  : (1,),
    simple.GL_LINEAR_ATTENUATION                    : (1,),
    simple.GL_QUADRATIC_ATTENUATION                 : (1,),
} # end of sizes
glGetLightfv = wrapper.wrapper(simple.glGetLightfv).setOutput(
    "params",GL_GET_LIGHT_SIZES, "pname", 
)
glGetLightiv = wrapper.wrapper(simple.glGetLightiv).setOutput(
    "params",GL_GET_LIGHT_SIZES, "pname", 
)

GL_GET_MATERIAL_SIZES = {
    simple.GL_AMBIENT: (4,),
    simple.GL_DIFFUSE: (4,),
    simple.GL_SPECULAR: (4,),
    simple.GL_EMISSION: (4,),
    simple.GL_SHININESS: (1,),
    simple.GL_COLOR_INDEXES: (3,)
}
glGetMaterialfv = wrapper.wrapper(simple.glGetMaterialfv).setOutput(
    "params",GL_GET_MATERIAL_SIZES, "pname", 
)
glGetMaterialiv = wrapper.wrapper(simple.glGetMaterialiv).setOutput(
    "params",GL_GET_MATERIAL_SIZES, "pname", 
)
PIXEL_MAP_SIZE_CONSTANT_MAP = {
    simple.GL_PIXEL_MAP_A_TO_A: simple.GL_PIXEL_MAP_A_TO_A_SIZE,
    simple.GL_PIXEL_MAP_B_TO_B: simple.GL_PIXEL_MAP_B_TO_B_SIZE,
    simple.GL_PIXEL_MAP_G_TO_G: simple.GL_PIXEL_MAP_G_TO_G_SIZE,
    simple.GL_PIXEL_MAP_I_TO_A: simple.GL_PIXEL_MAP_I_TO_A_SIZE,
    simple.GL_PIXEL_MAP_I_TO_B: simple.GL_PIXEL_MAP_I_TO_B_SIZE,
    simple.GL_PIXEL_MAP_I_TO_G: simple.GL_PIXEL_MAP_I_TO_G_SIZE,
    simple.GL_PIXEL_MAP_I_TO_I: simple.GL_PIXEL_MAP_I_TO_I_SIZE,
    simple.GL_PIXEL_MAP_I_TO_R: simple.GL_PIXEL_MAP_I_TO_R_SIZE,
    simple.GL_PIXEL_MAP_R_TO_R: simple.GL_PIXEL_MAP_R_TO_R_SIZE,
    simple.GL_PIXEL_MAP_S_TO_S: simple.GL_PIXEL_MAP_S_TO_S_SIZE,
}
def GL_GET_PIXEL_MAP_SIZE( pname ):
    """Given a pname, lookup the size using a glGet query..."""
    constant = PIXEL_MAP_SIZE_CONSTANT_MAP[ pname ]
    return glGetIntegerv( constant )
glGetPixelMapfv = wrapper.wrapper(simple.glGetPixelMapfv).setOutput(
    "values",GL_GET_PIXEL_MAP_SIZE, "map", 
)
glGetPixelMapuiv = wrapper.wrapper(simple.glGetPixelMapuiv).setOutput(
    "values",GL_GET_PIXEL_MAP_SIZE, "map", 
)
glGetPixelMapusv = wrapper.wrapper(simple.glGetPixelMapusv).setOutput(
    "values",GL_GET_PIXEL_MAP_SIZE, "map", 
)

# 32 * 32 bits
POLYGON_STIPPLE_SIZE = (32*32//8,)
glGetPolygonStipple = glGetPolygonStippleub = wrapper.wrapper(simple.glGetPolygonStipple).setOutput(
    "mask",POLYGON_STIPPLE_SIZE, 
)
GL_GET_TEX_ENV_SIZES = {
    simple.GL_TEXTURE_ENV_MODE: (1,),
    simple.GL_TEXTURE_ENV_COLOR: (4,),
}
glGetTexEnvfv = wrapper.wrapper(simple.glGetTexEnvfv).setOutput(
    "params",GL_GET_TEX_ENV_SIZES, 'pname',  
)
glGetTexEnviv = wrapper.wrapper(simple.glGetTexEnviv).setOutput(
    "params",GL_GET_TEX_ENV_SIZES, 'pname',  
)
GL_GET_TEX_GEN_SIZES = {
    simple.GL_TEXTURE_GEN_MODE: (1,),
    simple.GL_OBJECT_PLANE: (4,),
    simple.GL_EYE_PLANE: (4,),
}
glGetTexGendv = wrapper.wrapper(simple.glGetTexGendv).setOutput(
    "params",GL_GET_TEX_GEN_SIZES, 'pname',  
)
glGetTexGenfv = wrapper.wrapper(simple.glGetTexGenfv).setOutput(
    "params",GL_GET_TEX_GEN_SIZES, 'pname',  
)
glGetTexGeniv = wrapper.wrapper(simple.glGetTexGeniv).setOutput(
    "params",GL_GET_TEX_GEN_SIZES, 'pname',  
)

glGetTexLevelParameterfv = wrapper.wrapper(simple.glGetTexLevelParameterfv).setOutput(
    "params",(1,)
)
glGetTexLevelParameteriv = wrapper.wrapper(simple.glGetTexLevelParameteriv).setOutput(
    "params",(1,)
)
TEX_PARAMETER_SIZES = {
    simple.GL_TEXTURE_MAG_FILTER: (1,),
    simple.GL_TEXTURE_MIN_FILTER: (1,), 
    simple.GL_TEXTURE_MIN_LOD: (1,),
    simple.GL_TEXTURE_MAX_LOD: (1,),
    simple.GL_TEXTURE_BASE_LEVEL: (1,),
    simple.GL_TEXTURE_MAX_LEVEL: (1,),
    simple.GL_TEXTURE_WRAP_S: (1,),
    simple.GL_TEXTURE_WRAP_T: (1,),
    simple.GL_TEXTURE_WRAP_R: (1,),
    simple.GL_TEXTURE_BORDER_COLOR: (4,), 
    simple.GL_TEXTURE_PRIORITY: (1,),
    simple.GL_TEXTURE_RESIDENT: (1,)
}

glGetTexParameterfv = wrapper.wrapper(simple.glGetTexParameterfv).setOutput(
    "params",TEX_PARAMETER_SIZES, 'pname',
)
glGetTexParameteriv = wrapper.wrapper(simple.glGetTexParameteriv).setOutput(
    "params",TEX_PARAMETER_SIZES, 'pname',
)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.