summaryrefslogtreecommitdiff
path: root/es_1_1/60get.c
blob: fba2f28b278d4f15eb512f495db0521006cb65d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/* 
 * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 * 
 * Contact:
 * DongKyun Yun <dk77.yun@samsung.com>
 * SangJin Kim <sangjin3.kim@samsung.com>
 * HyunGoo Kang <hyungoo1.kang@samsung.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do
 * so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 * 
 * Contributors:
 * - S-Core Co., Ltd
 *
 */

#include "gl_imp.h"
#include <GLES/glext.h>
#include <string.h>


#ifdef ALEXGL_PROVIDE_1_1
GL_API void GL_APIENTRY EXTFN(GetBooleanv)(GLenum pname, GLboolean* params) {
#define clamprv2params	clamprv2boolv
#define	rv2params		rv2boolv
#define	enum2param		enum2bool
#define	i2param			i2bool
#include "6ZgetCore.inl"
#undef	clamprv2params
#undef	rv2params
#undef	enum2param
#undef	i2param
	FNPTR(GetBooleanv)(pname, params);
}
#endif

GL_API void GL_APIENTRY EXTFN(GetIntegerv)(GLenum pname, GLint* params) {
#define clamprv2params	clamprv2iv
#define	rv2params		rv2iv
#define	enum2param		enum2i
#define	i2param			i2i
#include "6ZgetCore.inl"
#undef	clamprv2params
#undef	rv2params
#undef	enum2param
#undef	i2param
	GLfloat f[4];
	switch (pname) {
	case GL_ALPHA_TEST_REF:
		FNPTR(GetFloatv)(pname, f);
		clampfv2iv(f, params, 1);
		break;
	default:
		FNPTR(GetIntegerv)(pname, params);
		break;
	}
}

#ifdef ALEXGL_PROVIDE_1_1
GL_API void GL_APIENTRY EXTFN(GetFixedv)(GLenum pname, GLfixed* params) {
#define clamprv2params	clamprv2xv
#define	rv2params		rv2xv
#define	enum2param		enum2x
#define	i2param			i2x
#include "6ZgetCore.inl"
#undef	clamprv2params
#undef	rv2params
#undef	enum2param
#undef	i2param
	{
		static GLfloat f[16];
		FNPTR(GetFloatv)(pname, f);
		switch (pname) {
		default:
			fv2xv(f, params, 1);
			break;
		case GL_CURRENT_NORMAL:		
			fv2xv(f, params, 3);
			break;
		case GL_ALIASED_POINT_SIZE_RANGE:
		case GL_ALIASED_LINE_WIDTH_RANGE:
		case GL_DEPTH_RANGE:
		case GL_MAX_VIEWPORT_DIMS:
		case GL_SMOOTH_LINE_WIDTH_RANGE:
		case GL_SMOOTH_POINT_SIZE_RANGE:
			fv2xv(f, params, 2);
			break;
		case GL_CURRENT_COLOR:	
		case GL_CURRENT_TEXTURE_COORDS:	
		case GL_COLOR_CLEAR_VALUE:
		case GL_COLOR_WRITEMASK:
		case GL_FOG_COLOR:
		case GL_LIGHT_MODEL_AMBIENT:
		case GL_SCISSOR_BOX:
		case GL_VIEWPORT:
			fv2xv(f, params, 4);
			break;
		case GL_MODELVIEW_MATRIX:
		case GL_PROJECTION_MATRIX:
		case GL_TEXTURE_MATRIX:
			fv2xv(f, params, 16);
			break;
#if defined(PROVIDING_OES_matrix_get)
		case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES:
		case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES:
		case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES:
			memcpy(params, f, 16 * sizeof(params[0]));
			break;
#endif
		}
	}
}
#endif

#ifdef ALEXGL_PROVIDE_COMMON
#ifdef ALEXGL_PROVIDE_1_1
GL_API void GL_APIENTRY EXTFN(GetFloatv)(GLenum pname, GLfloat* params) {
#define clamprv2params	clamprv2fv
#define	rv2params		rv2fv
#define	enum2param		enum2f
#define	i2param			i2f
#include "6ZgetCore.inl"
#undef	clamprv2params
#undef	rv2params
#undef	enum2param
#undef	i2param
	FNPTR(GetFloatv)(pname, params);
}
#endif
#endif

GL_API const GLubyte* GL_APIENTRY EXTFN(GetString)(GLenum name) {
	switch (name) {
	case GL_VENDOR:
		return (GLubyte*)"Huone Inc.";
		break;
	case GL_RENDERER:
#if defined(__pic__)
		return (GLubyte*)"AlexGL ES 1.1 dynamic on OpenGL (" __DATE__ " " __TIME__ ")";
#else
		return (GLubyte*)"AlexGL ES 1.1 on OpenGL (" __DATE__ " " __TIME__ ")";
#endif
		break;
	case GL_VERSION:
		return (GLubyte*)"OpenGL ES-CM 1.1";
		break;
	case GL_EXTENSIONS:
		return (GLubyte*)
#if defined(PROVIDING_OES_blend_func_separate)
		        "GL_OES_blend_func_separate "
#endif
#if defined(PROVIDING_OES_blend_subtract)
		        "GL_OES_blend_subtract "
#endif
#if defined(PROVIDING_OES_byte_coordinates)	
		        "GL_OES_byte_coordinates "
#endif
#if defined(PROVIDING_OES_fixed_point)	
		        "GL_OES_fixed_point "
#endif
#if defined(PROVIDING_OES_matrix_get)	
		        "GL_OES_matrix_get "
#endif
#if defined(PROVIDING_OES_point_size_array)
		        "GL_OES_point_size_array "
#endif
#if defined(PROVIDING_OES_point_sprite)
		        "GL_OES_point_sprite "
#endif
#if defined(PROVIDING_OES_query_matrix)
		        "GL_OES_query_matrix "
#endif
#if defined(PROVIDING_OES_single_precision)	
		        "GL_OES_single_precision "
#endif
#if defined(PROVIDING_OES_stencil_wrap)
		        "GL_OES_stencil_wrap "
#endif
#if defined(PROVIDING_OES_texture_cube_map)
		        "GL_OES_texture_cube_map "
#endif
#if defined(PROVIDING_OES_texture_env_crossbar)
		        "GL_OES_texture_env_crossbar "
#endif
#if defined(PROVIDING_OES_texture_mirrored_repeat)
		        "GL_OES_texture_mirrored_repeat "
#endif
#if defined(PROVIDING_OES_element_index_uint)
		        "GL_OES_element_index_uint "
#endif
		        "";
		break;
	default:
		return (GLubyte*)FNPTR(GetString)(name);
		break;
	}
}