1 /* Copyright © 2013, Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 #define GL_GLEXT_PROTOTYPES
32 glenv_num_extensions (void)
39 glenv_major_version (void)
41 const char *version = getenv ("GLENV_GL_VERSION");
45 return atoi (version);
49 glenv_minor_version (void)
51 const char *version = getenv ("GLENV_GL_VERSION");
57 decimal = strchr (version, '.');
62 return atoi (decimal + 1);
66 glGetDoublev (GLenum pname, GLdouble *params)
69 case GL_NUM_EXTENSIONS:
70 *params = glenv_num_extensions();
72 case GL_MAJOR_VERSION:
73 if (getenv ("GLENV_GL_VERSION")) {
74 *params = glenv_major_version();
78 case GL_MINOR_VERSION:
79 if (getenv ("GLENV_GL_VERSION")) {
80 *params = glenv_minor_version();
86 GLAZE_DEFER (glGetDoublev, pname, params);
90 glGetFloatv (GLenum pname, GLfloat *params)
93 case GL_NUM_EXTENSIONS:
94 *params = glenv_num_extensions();
96 case GL_MAJOR_VERSION:
97 if (getenv ("GLENV_GL_VERSION")) {
98 *params = glenv_major_version();
102 case GL_MINOR_VERSION:
103 if (getenv ("GLENV_GL_VERSION")) {
104 *params = glenv_minor_version();
110 GLAZE_DEFER (glGetFloatv, pname, params);
114 glGetIntegerv (GLenum pname, GLint *params)
117 case GL_NUM_EXTENSIONS:
118 *params = glenv_num_extensions();
120 case GL_MAJOR_VERSION:
121 if (getenv ("GLENV_GL_VERSION")) {
122 *params = glenv_major_version();
126 case GL_MINOR_VERSION:
127 if (getenv ("GLENV_GL_VERSION")) {
128 *params = glenv_minor_version();
134 GLAZE_DEFER (glGetIntegerv, pname, params);
138 glGetInteger64v (GLenum pname, GLint64 * params)
141 case GL_NUM_EXTENSIONS:
142 *params = glenv_num_extensions();
144 case GL_MAJOR_VERSION:
145 if (getenv ("GLENV_GL_VERSION")) {
146 *params = glenv_major_version();
150 case GL_MINOR_VERSION:
151 if (getenv ("GLENV_GL_VERSION")) {
152 *params = glenv_minor_version();
158 GLAZE_DEFER (glGetInteger64v, pname, params);
162 glGetString (GLenum name)
168 ret = (GLubyte *) getenv ("GLENV_GL_VENDOR");
173 ret = (GLubyte *) getenv ("GLENV_GL_RENDERER");
178 ret = (GLubyte *) getenv ("GLENV_GL_VERSION");
182 case GL_SHADING_LANGUAGE_VERSION:
183 ret = (GLubyte *) getenv ("GLENV_GL_SHADING_LANGUAGE_VERSION");
188 ret = (GLubyte *) getenv ("GLENV_GL_EXTENSIONS");
194 GLAZE_DEFER_WITH_RETURN (ret, glGetString, name);
200 glGetStringi (GLenum name, GLuint index)
208 case GL_SHADING_LANGUAGE_VERSION:
210 ret = (GLubyte *) getenv ("GLENV_GL_SHADING_LANGUAGE_VERSION");
217 GLAZE_DEFER_WITH_RETURN (ret, glGetStringi, name, index);