VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/get_components.py@ 20175

Last change on this file since 20175 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1# Copyright (c) 2001, Stanford University
2# All rights reserved.
3#
4# See the file LICENSE.txt for information on redistributing this software.
5
6num_components = {
7 'GL_AMBIENT' : 4,
8 'GL_DIFFUSE' : 4,
9 'GL_SPECULAR' : 4,
10 'GL_POSITION' : 4,
11 'GL_SPOT_DIRECTION' : 3,
12 'GL_SPOT_EXPONENT' : 1,
13 'GL_SPOT_CUTOFF' : 1,
14 'GL_CONSTANT_ATTENUATION' : 1,
15 'GL_LINEAR_ATTENUATION' : 1,
16 'GL_QUADRATIC_ATTENUATION' : 1,
17 'GL_EMISSION' : 4,
18 'GL_SHININESS' : 1,
19 'GL_COLOR_INDEXES' : 3,
20 'GL_TEXTURE_ENV_MODE' : 1,
21 'GL_TEXTURE_ENV_COLOR' : 4,
22 'GL_TEXTURE_GEN_MODE' : 1,
23 'GL_OBJECT_PLANE' : 4,
24 'GL_EYE_PLANE' : 4,
25 'GL_TEXTURE_MAG_FILTER' : 1,
26 'GL_TEXTURE_MIN_FILTER' : 1,
27 'GL_TEXTURE_WRAP_S' : 1,
28 'GL_TEXTURE_WRAP_T' : 1,
29 'GL_TEXTURE_BORDER_COLOR' : 4,
30 'GL_TEXTURE_WIDTH': 1,
31 'GL_TEXTURE_HEIGHT': 1,
32 'GL_TEXTURE_DEPTH': 1,
33 # 'GL_TEXTURE_INTERNAL_FORMAT': 1, THIS CONFLICTS WITH SOMETHING?!
34 'GL_TEXTURE_BORDER': 1,
35 'GL_TEXTURE_RED_SIZE': 1,
36 'GL_TEXTURE_GREEN_SIZE': 1,
37 'GL_TEXTURE_BLUE_SIZE': 1,
38 'GL_TEXTURE_ALPHA_SIZE': 1,
39 'GL_TEXTURE_LUMINANCE_SIZE': 1,
40 'GL_TEXTURE_INTENSITY_SIZE': 1,
41 'GL_TEXTURE_COMPONENTS': 1,
42 'GL_COMPRESSED_TEXTURE_FORMATS': 1,
43 'GL_TEXTURE_RESIDENT': 1
44}
45
46num_extended_components = {
47 'GL_TEXTURE_MAX_ANISOTROPY_EXT': ( 1, 'CR_EXT_texture_filter_anisotropic' ),
48 'GL_TEXTURE_WRAP_R': ( 1, 'CR_OPENGL_VERSION_1_2'),
49 'GL_TEXTURE_PRIORITY': ( 1, 'CR_OPENGL_VERSION_1_2'),
50 'GL_TEXTURE_MIN_LOD': ( 1, 'CR_OPENGL_VERSION_1_2'),
51 'GL_TEXTURE_MAX_LOD': ( 1, 'CR_OPENGL_VERSION_1_2'),
52 'GL_TEXTURE_BASE_LEVEL': ( 1, 'CR_OPENGL_VERSION_1_2'),
53 'GL_TEXTURE_MAX_LEVEL': ( 1, 'CR_OPENGL_VERSION_1_2'),
54 'GL_COMBINER_INPUT_NV': ( 1, 'CR_NV_register_combiners'),
55 'GL_COMBINER_MAPPING_NV': ( 1, 'CR_NV_register_combiners'),
56 'GL_COMBINER_COMPONENT_USAGE_NV': ( 1, 'CR_NV_register_combiners'),
57 'GL_COMBINER_AB_DOT_PRODUCT_NV': ( 1, 'CR_NV_register_combiners'),
58 'GL_COMBINER_CD_DOT_PRODUCT_NV': ( 1, 'CR_NV_register_combiners'),
59 'GL_COMBINER_MUX_SUM_NV': ( 1, 'CR_NV_register_combiners'),
60 'GL_COMBINER_SCALE_NV': ( 1, 'CR_NV_register_combiners'),
61 'GL_COMBINER_BIAS_NV': ( 1, 'CR_NV_register_combiners'),
62 'GL_COMBINER_AB_OUTPUT_NV': ( 1, 'CR_NV_register_combiners'),
63 'GL_COMBINER_CD_OUTPUT_NV': ( 1, 'CR_NV_register_combiners'),
64 'GL_COMBINER_SUM_OUTPUT_NV': ( 1, 'CR_NV_register_combiners'),
65 'GL_COMBINER_INPUT_NV': ( 1, 'CR_NV_register_combiners'),
66 'GL_COMBINER_INPUT_NV': ( 1, 'CR_NV_register_combiners'),
67 'GL_COMBINER_MAPPING_NV': ( 1, 'CR_NV_register_combiners'),
68 'GL_COMBINER_COMPONENT_USAGE_NV': ( 1, 'CR_NV_register_combiners'),
69 'GL_CONSTANT_COLOR0_NV': ( 4, 'CR_NV_register_combiners'),
70 'GL_CONSTANT_COLOR1_NV': ( 4, 'CR_NV_register_combiners'),
71 'GL_COMBINE_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
72 'GL_COMBINE_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
73 'GL_SOURCE0_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
74 'GL_SOURCE1_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
75 'GL_SOURCE2_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
76 'GL_SOURCE0_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
77 'GL_SOURCE1_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
78 'GL_SOURCE2_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
79 'GL_OPERAND0_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
80 'GL_OPERAND1_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
81 'GL_OPERAND2_RGB_ARB': (1, 'CR_ARB_texture_env_combine'),
82 'GL_OPERAND0_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
83 'GL_OPERAND1_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
84 'GL_OPERAND2_ALPHA_ARB': (1, 'CR_ARB_texture_env_combine'),
85 'GL_RGB_SCALE_ARB': (1, 'CR_ARB_texture_env_combine'),
86 'GL_ALPHA_SCALE': (1, 'CR_ARB_texture_env_combine'),
87 'GL_DEPTH_TEXTURE_MODE_ARB': (1, 'CR_ARB_depth_texture'),
88 'GL_TEXTURE_DEPTH_SIZE_ARB': (1, 'CR_ARB_depth_texture'),
89 'GL_TEXTURE_COMPARE_MODE_ARB': (1, 'CR_ARB_shadow'),
90 'GL_TEXTURE_COMPARE_FUNC_ARB': (1, 'CR_ARB_shadow'),
91 'GL_TEXTURE_COMPARE_FAIL_VALUE_ARB': (1, 'CR_ARB_shadow_ambient'),
92 'GL_GENERATE_MIPMAP_SGIS': (1, 'CR_SGIS_generate_mipmap'),
93 'GL_TEXTURE_LOD_BIAS_EXT': (1, 'CR_EXT_texture_lod_bias'),
94 'GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB': (4, 'CR_any_vertex_program'),
95 'GL_CURRENT_VERTEX_ATTRIB_ARB': (4, 'CR_any_vertex_program'),
96 'GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB': (4, 'CR_any_vertex_program'),
97 'GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB': (4, 'CR_any_vertex_program'),
98 'GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB': (4, 'CR_any_vertex_program'),
99 'GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB': (4, 'CR_any_vertex_program'),
100 'GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB': (4, 'CR_any_vertex_program'),
101 'GL_TRACK_MATRIX_NV': (24, 'CR_any_vertex_program'),
102 'GL_TRACK_MATRIX_TRANSFORM_NV': (24, 'CR_any_vertex_program'),
103 'GL_BUFFER_SIZE_ARB': (1, 'CR_ARB_vertex_buffer_object'),
104 'GL_BUFFER_USAGE_ARB': (1, 'CR_ARB_vertex_buffer_object'),
105 'GL_BUFFER_ACCESS_ARB': (1, 'CR_ARB_vertex_buffer_object'),
106 'GL_BUFFER_MAPPED_ARB': (1, 'CR_ARB_vertex_buffer_object'),
107 'GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING': (4, 'CR_ARB_vertex_buffer_object'),
108 'GL_QUERY_COUNTER_BITS_ARB': (1, 'CR_ARB_occlusion_query'),
109 'GL_QUERY_RESULT_AVAILABLE_ARB': (1, 'CR_ARB_occlusion_query'),
110 'GL_QUERY_RESULT_ARB': (1, 'CR_ARB_occlusion_query'),
111 'GL_CURRENT_QUERY_ARB': (1, 'CR_ARB_occlusion_query'),
112 'GL_TEXTURE_COMPRESSED_IMAGE_SIZE': (1, 'CR_ARB_texture_compression'),
113 'GL_POINT_SPRITE_ARB': (1, 'CR_ARB_point_sprite'),
114 'GL_COORD_REPLACE_ARB': (4, 'CR_ARB_point_sprite')
115}
116
117print """static unsigned int lookupComponents( GLenum pname )
118{
119 switch( pname )
120 {
121"""
122comps = num_components.keys();
123comps.sort();
124for comp in comps:
125 print '\t\t\tcase %s: return %d;' % (comp,num_components[comp])
126
127comps = num_extended_components.keys();
128comps.sort();
129for comp in comps:
130 (nc, ifdef) = num_extended_components[comp]
131 print '#ifdef %s' % ifdef
132 print '\t\t\tcase %s: return %d;' % (comp,nc)
133 print '#endif /* %s */' % ifdef
134
135print """
136 default:
137 crError( "Unknown parameter name in lookupComponents: %d", (int) pname );
138 break;
139 }
140 /* NOTREACHED */
141 return 0;
142}
143"""
144
145
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette