| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* GATE PROJECT LICENSE: | ||
| 2 | +----------------------------------------------------------------------------+ | ||
| 3 | | Copyright(c) 2018-2025, Stefan Meislinger | | ||
| 4 | | All rights reserved. | | ||
| 5 | | | | ||
| 6 | | Redistribution and use in source and binary forms, with or without | | ||
| 7 | | modification, are permitted provided that the following conditions are met:| | ||
| 8 | | | | ||
| 9 | | 1. Redistributions of source code must retain the above copyright notice, | | ||
| 10 | | this list of conditions and the following disclaimer. | | ||
| 11 | | 2. Redistributions in binary form must reproduce the above copyright | | ||
| 12 | | notice, this list of conditions and the following disclaimer in the | | ||
| 13 | | documentation and/or other materials provided with the distribution. | | ||
| 14 | | | | ||
| 15 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"| | ||
| 16 | | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | ||
| 17 | | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | ||
| 18 | | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | | ||
| 19 | | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | ||
| 20 | | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | ||
| 21 | | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | ||
| 22 | | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | ||
| 23 | | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | ||
| 24 | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | ||
| 25 | | THE POSSIBILITY OF SUCH DAMAGE. | | ||
| 26 | +----------------------------------------------------------------------------+ | ||
| 27 | */ | ||
| 28 | #include "gate/graphics/gl_apis.h" | ||
| 29 | |||
| 30 | #include "gate/debugging.h" | ||
| 31 | #include "gate/mathematics.h" | ||
| 32 | |||
| 33 | #if (defined(GATE_SYS_WIN) && !defined(GATE_SYS_WINCE) && !defined(GATE_SYS_WINSTORE) && !defined(GATE_SYS_WIN16)) || (defined(GATE_SYS_POSIX) && !defined(GATE_SYS_OPENBSD) && !defined(GATE_SYS_BEOS)) || defined(GATE_SYS_WASM) | ||
| 34 | # define GATE_GRAPHICS_GL_OPENGL | ||
| 35 | #else | ||
| 36 | # define GATE_GARPHICS_GL_NOIMPL | ||
| 37 | #endif | ||
| 38 | |||
| 39 | #if defined(GATE_GRAPHICS_GL_OPENGL) | ||
| 40 | |||
| 41 | #include "gate/graphics/platform/opengl_apis.h" | ||
| 42 | |||
| 43 | #if defined(GATE_GRAPHICS_OPENGL_GLUT) | ||
| 44 | # define GATE_GL_API_GLUT 1 | ||
| 45 | #elif defined(GATE_SYS_WIN) && !defined(GATE_SYS_WINCE) | ||
| 46 | # define GATE_GL_API_WINAPI 1 | ||
| 47 | #elif defined(GATE_SYS_DARWIN) | ||
| 48 | # define GATE_GL_API_GLUT 1 | ||
| 49 | #else | ||
| 50 | # define GATE_GL_API_EGL 1 | ||
| 51 | #endif | ||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | ✗ | gate_result_t gate_gl_api_init() | |
| 56 | { | ||
| 57 | ✗ | return gate_gl_api_load_functions(); | |
| 58 | } | ||
| 59 | |||
| 60 | ✗ | void gate_gl_api_color3(gate_real32_t r, gate_real32_t g, gate_real32_t b) | |
| 61 | { | ||
| 62 | ✗ | gate_gl_api_color4(r, g, b, 1.0f); | |
| 63 | ✗ | } | |
| 64 | ✗ | void gate_gl_api_color4(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | |
| 65 | { | ||
| 66 | ✗ | gate_gl_api.glColor4f(r, g, b, a); | |
| 67 | ✗ | } | |
| 68 | ✗ | void gate_gl_api_color3b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b) | |
| 69 | { | ||
| 70 | ✗ | gate_gl_api_color4b(r, g, b, 255); | |
| 71 | ✗ | } | |
| 72 | ✗ | void gate_gl_api_color4b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b, gate_uint8_t a) | |
| 73 | { | ||
| 74 | ✗ | gate_gl_api.glColor4f((gate_real32_t)r / 255.0f, | |
| 75 | ✗ | (gate_real32_t)g / 255.0f, | |
| 76 | ✗ | (gate_real32_t)b / 255.0f, | |
| 77 | ✗ | (gate_real32_t)a / 255.0f); | |
| 78 | ✗ | } | |
| 79 | |||
| 80 | ✗ | void gate_gl_api_vertexpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | |
| 81 | { | ||
| 82 | ✗ | gate_gl_api.glVertexPointer((GLint)coord_count, GL_FLOAT, 0, ptr_coords); | |
| 83 | ✗ | } | |
| 84 | |||
| 85 | ✗ | void gate_gl_api_texcoordpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | |
| 86 | { | ||
| 87 | ✗ | gate_gl_api.glTexCoordPointer((GLint)coord_count, GL_FLOAT, 0, ptr_coords); | |
| 88 | ✗ | } | |
| 89 | |||
| 90 | ✗ | void gate_gl_api_shademodel(gate_gl_api_shademodel_t model) | |
| 91 | { | ||
| 92 | ✗ | GLenum value = 0; | |
| 93 | ✗ | switch (model) | |
| 94 | { | ||
| 95 | ✗ | case gate_gl_api_shademodel_flat: value = GL_FLAT; break; | |
| 96 | ✗ | case gate_gl_api_shademodel_smooth: value = GL_SMOOTH; break; | |
| 97 | } | ||
| 98 | ✗ | gate_gl_api.glShadeModel(value); | |
| 99 | ✗ | } | |
| 100 | |||
| 101 | ✗ | static GLenum resolve_blend_function(gate_gl_api_blend_t blend_function) | |
| 102 | { | ||
| 103 | ✗ | switch (blend_function) | |
| 104 | { | ||
| 105 | ✗ | case gate_gl_api_blend_zero: return GL_ZERO; | |
| 106 | ✗ | case gate_gl_api_blend_one: return GL_ONE; | |
| 107 | ✗ | case gate_gl_api_blend_src_color: return GL_SRC_COLOR; | |
| 108 | ✗ | case gate_gl_api_blend_one_minus_src_color: return GL_ONE_MINUS_SRC_COLOR; | |
| 109 | ✗ | case gate_gl_api_blend_src_alpha: return GL_SRC_ALPHA; | |
| 110 | ✗ | case gate_gl_api_blend_one_minus_src_alpha: return GL_ONE_MINUS_SRC_ALPHA; | |
| 111 | ✗ | case gate_gl_api_blend_dst_alpha: return GL_DST_ALPHA; | |
| 112 | ✗ | case gate_gl_api_blend_one_minus_dst_alpha: return GL_ONE_MINUS_DST_ALPHA; | |
| 113 | ✗ | case gate_gl_api_blend_dst_color: return GL_DST_COLOR; | |
| 114 | ✗ | case gate_gl_api_blend_one_minus_dst_color: return GL_ONE_MINUS_DST_COLOR; | |
| 115 | ✗ | case gate_gl_api_blend_src_alpha_saturate: return GL_SRC_ALPHA_SATURATE; | |
| 116 | } | ||
| 117 | ✗ | return 0; | |
| 118 | } | ||
| 119 | |||
| 120 | ✗ | void gate_gl_api_blendfunc(gate_gl_api_blend_t blend_func_src, gate_gl_api_blend_t blend_func_dst) | |
| 121 | { | ||
| 122 | ✗ | gate_gl_api.glBlendFunc(resolve_blend_function(blend_func_src), resolve_blend_function(blend_func_dst)); | |
| 123 | ✗ | } | |
| 124 | |||
| 125 | ✗ | void gate_gl_api_clearcolor(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | |
| 126 | { | ||
| 127 | ✗ | gate_gl_api.glClearColor(r, g, b, a); | |
| 128 | ✗ | } | |
| 129 | |||
| 130 | ✗ | void gate_gl_api_cleardepth(gate_real32_t depth) | |
| 131 | { | ||
| 132 | ✗ | gate_gl_api.glClearDepth(depth); | |
| 133 | ✗ | } | |
| 134 | |||
| 135 | ✗ | static GLenum translate_capability(gate_gl_api_capability_t capability) | |
| 136 | { | ||
| 137 | ✗ | switch (capability) | |
| 138 | { | ||
| 139 | ✗ | case gate_gl_api_capability_alpha_test: return GL_ALPHA_TEST; | |
| 140 | #if defined(GL_AUTO_NORMAL) | ||
| 141 | ✗ | case gate_gl_api_capability_auto_normal: return GL_AUTO_NORMAL; | |
| 142 | #endif | ||
| 143 | ✗ | case gate_gl_api_capability_blend: return GL_BLEND; | |
| 144 | //case gate_gl_api_capability_clip_plane: return GL_CLIP_PLANEi; | ||
| 145 | ✗ | case gate_gl_api_capability_color_logic_op: return GL_COLOR_LOGIC_OP; | |
| 146 | ✗ | case gate_gl_api_capability_color_material: return GL_COLOR_MATERIAL; | |
| 147 | ✗ | case gate_gl_api_capability_cull_face: return GL_CULL_FACE; | |
| 148 | ✗ | case gate_gl_api_capability_depth_test: return GL_DEPTH_TEST; | |
| 149 | ✗ | case gate_gl_api_capability_dither: return GL_DITHER; | |
| 150 | ✗ | case gate_gl_api_capability_fog: return GL_FOG; | |
| 151 | #if defined(GL_INDEX_LOGIC_OP) | ||
| 152 | ✗ | case gate_gl_api_capability_index_logic_op: return GL_INDEX_LOGIC_OP; | |
| 153 | #endif | ||
| 154 | //case gate_gl_api_capability_light: return GL_LIGHTi; | ||
| 155 | ✗ | case gate_gl_api_capability_lighting: return GL_LIGHTING; | |
| 156 | ✗ | case gate_gl_api_capability_line_smooth: return GL_LINE_SMOOTH; | |
| 157 | #if defined(GL_LINE_STIPPLE) | ||
| 158 | ✗ | case gate_gl_api_capability_line_stipple: return GL_LINE_STIPPLE; | |
| 159 | #endif | ||
| 160 | #if defined(GL_LOGIC_OP) | ||
| 161 | ✗ | case gate_gl_api_capability_logic_op: return GL_LOGIC_OP; | |
| 162 | #endif | ||
| 163 | #if defined(GL_MAP1_COLOR_4) | ||
| 164 | ✗ | case gate_gl_api_capability_map1_color_4: return GL_MAP1_COLOR_4; | |
| 165 | #endif | ||
| 166 | #if defined(GL_MAP1_INDEX) | ||
| 167 | ✗ | case gate_gl_api_capability_map1_index: return GL_MAP1_INDEX; | |
| 168 | #endif | ||
| 169 | #if defined(GL_MAP1_NORMAL) | ||
| 170 | ✗ | case gate_gl_api_capability_map1_normal: return GL_MAP1_NORMAL; | |
| 171 | #endif | ||
| 172 | #if defined(GL_MAP1_TEXTURE_COORD_1) | ||
| 173 | ✗ | case gate_gl_api_capability_map1_texture_coord_1: return GL_MAP1_TEXTURE_COORD_1; | |
| 174 | #endif | ||
| 175 | #if defined(GL_MAP1_TEXTURE_COORD_2) | ||
| 176 | ✗ | case gate_gl_api_capability_map1_texture_coord_2: return GL_MAP1_TEXTURE_COORD_2; | |
| 177 | #endif | ||
| 178 | #if defined(GL_MAP1_TEXTURE_COORD_3) | ||
| 179 | ✗ | case gate_gl_api_capability_map1_texture_coord_3: return GL_MAP1_TEXTURE_COORD_3; | |
| 180 | #endif | ||
| 181 | #if defined(GL_MAP1_TEXTURE_COORD_4) | ||
| 182 | ✗ | case gate_gl_api_capability_map1_texture_coord_4: return GL_MAP1_TEXTURE_COORD_4; | |
| 183 | #endif | ||
| 184 | #if defined(GL_MAP1_VERTEX_3) | ||
| 185 | ✗ | case gate_gl_api_capability_map1_vertex_3: return GL_MAP1_VERTEX_3; | |
| 186 | #endif | ||
| 187 | #if defined(GL_MAP1_VERTEX_4) | ||
| 188 | ✗ | case gate_gl_api_capability_map1_vertex_4: return GL_MAP1_VERTEX_4; | |
| 189 | #endif | ||
| 190 | #if defined(GL_MAP2_COLOR_4) | ||
| 191 | ✗ | case gate_gl_api_capability_map2_color_4: return GL_MAP2_COLOR_4; | |
| 192 | #endif | ||
| 193 | #if defined(GL_MAP2_INDEX) | ||
| 194 | ✗ | case gate_gl_api_capability_map2_index: return GL_MAP2_INDEX; | |
| 195 | #endif | ||
| 196 | #if defined(GL_MAP2_NORMAL) | ||
| 197 | ✗ | case gate_gl_api_capability_map2_normal: return GL_MAP2_NORMAL; | |
| 198 | #endif | ||
| 199 | #if defined(GL_MAP2_TEXTURE_COORD_1) | ||
| 200 | ✗ | case gate_gl_api_capability_map2_texture_coord_1: return GL_MAP2_TEXTURE_COORD_1; | |
| 201 | #endif | ||
| 202 | #if defined(GL_MAP2_TEXTURE_COORD_2) | ||
| 203 | ✗ | case gate_gl_api_capability_map2_texture_coord_2: return GL_MAP2_TEXTURE_COORD_2; | |
| 204 | #endif | ||
| 205 | #if defined(GL_MAP2_TEXTURE_COORD_3) | ||
| 206 | ✗ | case gate_gl_api_capability_map2_texture_coord_3: return GL_MAP2_TEXTURE_COORD_3; | |
| 207 | #endif | ||
| 208 | #if defined(GL_MAP2_TEXTURE_COORD_4) | ||
| 209 | ✗ | case gate_gl_api_capability_map2_texture_coord_4: return GL_MAP2_TEXTURE_COORD_4; | |
| 210 | #endif | ||
| 211 | #if defined(GL_MAP2_VERTEX_3) | ||
| 212 | ✗ | case gate_gl_api_capability_map2_vertex_3: return GL_MAP2_VERTEX_3; | |
| 213 | #endif | ||
| 214 | #if defined(GL_MAP2_VERTEX_4) | ||
| 215 | ✗ | case gate_gl_api_capability_map2_vertex_4: return GL_MAP2_VERTEX_4; | |
| 216 | #endif | ||
| 217 | ✗ | case gate_gl_api_capability_normalize: return GL_NORMALIZE; | |
| 218 | ✗ | case gate_gl_api_capability_point_smooth: return GL_POINT_SMOOTH; | |
| 219 | ✗ | case gate_gl_api_capability_polygon_offset_fill: return GL_POLYGON_OFFSET_FILL; | |
| 220 | #if defined(GL_POLYGON_OFFSET_LINE) | ||
| 221 | ✗ | case gate_gl_api_capability_polygon_offset_line: return GL_POLYGON_OFFSET_LINE; | |
| 222 | #endif | ||
| 223 | #if defined(GL_POLYGON_OFFSET_POINT) | ||
| 224 | ✗ | case gate_gl_api_capability_polygon_offset_point: return GL_POLYGON_OFFSET_POINT; | |
| 225 | #endif | ||
| 226 | #if defined(GL_POLYGON_SMOOTH) | ||
| 227 | ✗ | case gate_gl_api_capability_polygon_smooth: return GL_POLYGON_SMOOTH; | |
| 228 | #endif | ||
| 229 | #if defined(GL_POLYGON_STIPPLE) | ||
| 230 | ✗ | case gate_gl_api_capability_polygon_stipple: return GL_POLYGON_STIPPLE; | |
| 231 | #endif | ||
| 232 | ✗ | case gate_gl_api_capability_scissor_test: return GL_SCISSOR_TEST; | |
| 233 | ✗ | case gate_gl_api_capability_stencil_test: return GL_STENCIL_TEST; | |
| 234 | #if defined(GL_TEXTURE_1D) | ||
| 235 | ✗ | case gate_gl_api_capability_texture_1d: return GL_TEXTURE_1D; | |
| 236 | #endif | ||
| 237 | ✗ | case gate_gl_api_capability_texture_2d: return GL_TEXTURE_2D; | |
| 238 | #if defined(GL_TEXTURE_GEN_Q) | ||
| 239 | ✗ | case gate_gl_api_capability_texture_gen_q: return GL_TEXTURE_GEN_Q; | |
| 240 | #endif | ||
| 241 | #if defined(GL_TEXTURE_GEN_R) | ||
| 242 | ✗ | case gate_gl_api_capability_texture_gen_r: return GL_TEXTURE_GEN_R; | |
| 243 | #endif | ||
| 244 | #if defined(GL_TEXTURE_GEN_S) | ||
| 245 | ✗ | case gate_gl_api_capability_texture_gen_s: return GL_TEXTURE_GEN_S; | |
| 246 | #endif | ||
| 247 | #if defined(GL_TEXTURE_GEN_T) | ||
| 248 | ✗ | case gate_gl_api_capability_texture_gen_t: return GL_TEXTURE_GEN_T; | |
| 249 | #endif | ||
| 250 | ✗ | default: return 0; | |
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | |||
| 255 | ✗ | void gate_gl_api_enable(gate_gl_api_capability_t capability) | |
| 256 | { | ||
| 257 | ✗ | gate_gl_api.glEnable(translate_capability(capability)); | |
| 258 | ✗ | } | |
| 259 | |||
| 260 | ✗ | void gate_gl_api_disable(gate_gl_api_capability_t capability) | |
| 261 | { | ||
| 262 | ✗ | gate_gl_api.glDisable(translate_capability(capability)); | |
| 263 | ✗ | } | |
| 264 | |||
| 265 | ✗ | void gate_gl_api_depthfunc(gate_gl_api_depth_t depth_function) | |
| 266 | { | ||
| 267 | ✗ | GLenum value = 0; | |
| 268 | ✗ | switch (depth_function) | |
| 269 | { | ||
| 270 | ✗ | case gate_gl_api_depth_never: value = GL_NEVER; break; | |
| 271 | ✗ | case gate_gl_api_depth_less: value = GL_LESS; break; | |
| 272 | ✗ | case gate_gl_api_depth_lequal: value = GL_LEQUAL; break; | |
| 273 | ✗ | case gate_gl_api_depth_equal: value = GL_EQUAL; break; | |
| 274 | ✗ | case gate_gl_api_depth_greater: value = GL_GREATER; break; | |
| 275 | ✗ | case gate_gl_api_depth_notequal:value = GL_NOTEQUAL;break; | |
| 276 | ✗ | case gate_gl_api_depth_gequal: value = GL_GEQUAL; break; | |
| 277 | ✗ | case gate_gl_api_depth_always: value = GL_ALWAYS; break; | |
| 278 | } | ||
| 279 | ✗ | gate_gl_api.glDepthFunc(value); | |
| 280 | ✗ | } | |
| 281 | |||
| 282 | ✗ | void gate_gl_api_depthmask(gate_bool_t enabled) | |
| 283 | { | ||
| 284 | ✗ | gate_gl_api.glDepthMask(enabled ? GL_TRUE : GL_FALSE); | |
| 285 | ✗ | } | |
| 286 | |||
| 287 | ✗ | void gate_gl_api_hint(gate_gl_api_hint_t hint_type, gate_gl_api_hintmode_t hint_mode) | |
| 288 | { | ||
| 289 | ✗ | GLenum ht = 0, hm = 0; | |
| 290 | ✗ | switch (hint_type) | |
| 291 | { | ||
| 292 | ✗ | case gate_gl_api_hint_fog_hint: ht = GL_FOG_HINT; break; | |
| 293 | ✗ | case gate_gl_api_hint_line_smooth_hint: ht = GL_LINE_SMOOTH_HINT; break; | |
| 294 | ✗ | case gate_gl_api_hint_perspective_correction_hint: ht = GL_PERSPECTIVE_CORRECTION_HINT;break; | |
| 295 | ✗ | case gate_gl_api_hint_point_smooth_hint: ht = GL_POINT_SMOOTH_HINT; break; | |
| 296 | #if defined(GL_POLYGON_SMOOTH_HINT) | ||
| 297 | ✗ | case gate_gl_api_hint_polygon_smooth_hint: ht = GL_POLYGON_SMOOTH_HINT; break; | |
| 298 | #endif | ||
| 299 | ✗ | default: ht = 0; break; | |
| 300 | } | ||
| 301 | |||
| 302 | ✗ | switch (hint_mode) | |
| 303 | { | ||
| 304 | ✗ | case gate_gl_api_hintmode_fastest: hm = GL_FASTEST; break; | |
| 305 | ✗ | case gate_gl_api_hintmode_nicest: hm = GL_NICEST; break; | |
| 306 | ✗ | case gate_gl_api_hintmode_dont_care: hm = GL_DONT_CARE; break; | |
| 307 | } | ||
| 308 | |||
| 309 | ✗ | gate_gl_api.glHint(ht, hm); | |
| 310 | ✗ | } | |
| 311 | |||
| 312 | ✗ | void gate_gl_api_viewport(gate_int32_t x, gate_int32_t y, gate_int32_t width, gate_int32_t height) | |
| 313 | { | ||
| 314 | ✗ | gate_gl_api.glViewport(x, y, width, height); | |
| 315 | ✗ | } | |
| 316 | |||
| 317 | ✗ | void gate_gl_api_matrixmode(gate_gl_api_matrixmode_t matrix_mode) | |
| 318 | { | ||
| 319 | ✗ | GLenum mm = 0; | |
| 320 | ✗ | switch (matrix_mode) | |
| 321 | { | ||
| 322 | ✗ | case gate_gl_api_matrixmode_modelview: mm = GL_MODELVIEW; break; | |
| 323 | ✗ | case gate_gl_api_matrixmode_projection: mm = GL_PROJECTION; break; | |
| 324 | ✗ | case gate_gl_api_matrixmode_texture: mm = GL_TEXTURE; break; | |
| 325 | } | ||
| 326 | ✗ | gate_gl_api.glMatrixMode(mm); | |
| 327 | ✗ | } | |
| 328 | |||
| 329 | ✗ | void gate_gl_api_loadidentity() | |
| 330 | { | ||
| 331 | ✗ | gate_gl_api.glLoadIdentity(); | |
| 332 | ✗ | } | |
| 333 | |||
| 334 | ✗ | void gate_gl_api_multmatrix(gate_real32_t const matrix[16]) | |
| 335 | { | ||
| 336 | ✗ | gate_gl_api.glMultMatrixf(matrix); | |
| 337 | ✗ | } | |
| 338 | |||
| 339 | ✗ | void gate_gl_api_translate(gate_real32_t x, gate_real32_t y, gate_real32_t z) | |
| 340 | { | ||
| 341 | ✗ | gate_gl_api.glTranslatef(x, y, z); | |
| 342 | ✗ | } | |
| 343 | |||
| 344 | ✗ | void gate_gl_api_rotate(gate_real32_t angle, gate_real32_t x, gate_real32_t y, gate_real32_t z) | |
| 345 | { | ||
| 346 | ✗ | gate_gl_api.glRotatef(angle, x, y, z); | |
| 347 | ✗ | } | |
| 348 | |||
| 349 | |||
| 350 | ✗ | void gate_gl_api_flush() | |
| 351 | { | ||
| 352 | ✗ | gate_gl_api.glFlush(); | |
| 353 | ✗ | } | |
| 354 | |||
| 355 | ✗ | void gate_gl_api_finish() | |
| 356 | { | ||
| 357 | ✗ | gate_gl_api.glFinish(); | |
| 358 | ✗ | } | |
| 359 | |||
| 360 | ✗ | void gate_gl_api_clear(unsigned clear_bits) | |
| 361 | { | ||
| 362 | ✗ | GLbitfield bf = 0; | |
| 363 | |||
| 364 | ✗ | if (clear_bits & gate_gl_api_clearbit_color_buffer_bit) | |
| 365 | { | ||
| 366 | ✗ | bf |= GL_COLOR_BUFFER_BIT; | |
| 367 | } | ||
| 368 | ✗ | if (clear_bits & gate_gl_api_clearbit_depth_buffer_bit) | |
| 369 | { | ||
| 370 | ✗ | bf |= GL_DEPTH_BUFFER_BIT; | |
| 371 | } | ||
| 372 | ✗ | if (clear_bits & gate_gl_api_clearbit_accum_buffer_bit) | |
| 373 | { | ||
| 374 | #if defined(GL_ACCUM_BUFFER_BIT) | ||
| 375 | ✗ | bf |= GL_ACCUM_BUFFER_BIT; | |
| 376 | #endif | ||
| 377 | } | ||
| 378 | ✗ | if (clear_bits & gate_gl_api_clearbit_stencil_buffer_bit) | |
| 379 | { | ||
| 380 | ✗ | bf |= GL_STENCIL_BUFFER_BIT; | |
| 381 | } | ||
| 382 | ✗ | gate_gl_api.glClear(bf); | |
| 383 | ✗ | } | |
| 384 | |||
| 385 | ✗ | void gate_gl_api_perspective(gate_real32_t fovy, gate_real32_t aspect, gate_real32_t znear, gate_real32_t zfar) | |
| 386 | { | ||
| 387 | ✗ | gate_real32_t f = (gate_real32_t)(1.0 / gate_math_tan(gate_math_deg2rad(fovy) / 2.0)); | |
| 388 | ✗ | GLfloat a = f / aspect; | |
| 389 | GLfloat m[16]; | ||
| 390 | ✗ | m[0] = a; m[1] = 0; m[2] = 0; m[3] = 0; | |
| 391 | ✗ | m[4] = 0; m[5] = f; m[6] = 0; m[7] = 0; | |
| 392 | ✗ | m[8] = 0; m[9] = 0; m[10] = (zfar + znear) / (znear - zfar); m[11] = -1.0f; | |
| 393 | ✗ | m[12] = 0; m[13] = 0; m[14] = (2.0f * zfar * znear) / (znear - zfar); m[15] = 0; | |
| 394 | ✗ | gate_gl_api.glMultMatrixf(m); | |
| 395 | ✗ | } | |
| 396 | |||
| 397 | |||
| 398 | ✗ | static void math_cross_prod(float x1, float y1, float z1, float x2, float y2, float z2, float res[3]) | |
| 399 | { | ||
| 400 | ✗ | res[0] = y1 * z2 - y2 * z1; | |
| 401 | ✗ | res[1] = x2 * z1 - x1 * z2; | |
| 402 | ✗ | res[2] = x1 * y2 - x2 * y1; | |
| 403 | ✗ | } | |
| 404 | |||
| 405 | /* https://www.khronos.org/message_boards/showthread.php/4991-The-Solution-for-gluLookAt%28%29-Function!!!! */ | ||
| 406 | /* https://community.khronos.org/t/the-solution-for-glulookat-function/521 */ | ||
| 407 | |||
| 408 | ✗ | static double square(double const arg) | |
| 409 | { | ||
| 410 | ✗ | return arg * arg; | |
| 411 | } | ||
| 412 | |||
| 413 | |||
| 414 | ✗ | void gate_gl_api_lookat(gate_real32_t eyeX, gate_real32_t eyeY, gate_real32_t eyeZ, | |
| 415 | gate_real32_t lookX, gate_real32_t lookY, gate_real32_t lookZ, | ||
| 416 | gate_real32_t upX, gate_real32_t upY, gate_real32_t upZ) | ||
| 417 | { | ||
| 418 | float f[3]; | ||
| 419 | float fMag; | ||
| 420 | float upMag; | ||
| 421 | float s[3], u[3]; | ||
| 422 | float M[16]; | ||
| 423 | |||
| 424 | |||
| 425 | ✗ | f[0] = lookX - eyeX; | |
| 426 | ✗ | f[1] = lookY - eyeY; | |
| 427 | ✗ | f[2] = lookZ - eyeZ; | |
| 428 | |||
| 429 | ✗ | fMag = (float)gate_math_sqrt(square(f[0]) + square(f[1]) + square(f[2])); | |
| 430 | ✗ | upMag = (float)gate_math_sqrt(square(upX) + square(upY) + square(upZ)); | |
| 431 | |||
| 432 | ✗ | if (fMag != 0) | |
| 433 | { | ||
| 434 | ✗ | f[0] = f[0] / fMag; | |
| 435 | ✗ | f[1] = f[1] / fMag; | |
| 436 | ✗ | f[2] = f[2] / fMag; | |
| 437 | } | ||
| 438 | |||
| 439 | ✗ | if (upMag != 0) | |
| 440 | { | ||
| 441 | ✗ | upX = upX / upMag; | |
| 442 | ✗ | upY = upY / upMag; | |
| 443 | ✗ | upZ = upZ / upMag; | |
| 444 | } | ||
| 445 | |||
| 446 | ✗ | math_cross_prod(f[0], f[1], f[2], upX, upY, upZ, s); | |
| 447 | ✗ | math_cross_prod(s[0], s[1], s[2], f[0], f[1], f[2], u); | |
| 448 | |||
| 449 | ✗ | M[0] = s[0]; M[1] = u[0]; M[2] = -f[0]; M[3] = 0; | |
| 450 | ✗ | M[4] = s[1]; M[5] = u[1]; M[6] = -f[1]; M[7] = 0; | |
| 451 | ✗ | M[8] = s[2]; M[9] = u[2]; M[10] = -f[2]; M[11] = 0; | |
| 452 | ✗ | M[12] = 0; M[13] = 0; M[14] = 0; M[15] = 1; | |
| 453 | |||
| 454 | ✗ | gate_gl_api.glMultMatrixf(M); | |
| 455 | ✗ | gate_gl_api.glTranslatef(-eyeX, -eyeY, -eyeZ); | |
| 456 | ✗ | } | |
| 457 | |||
| 458 | ✗ | void gate_gl_api_ortho(gate_real32_t left, gate_real32_t right, gate_real32_t bottom, gate_real32_t top, gate_real32_t near_val, gate_real32_t far_val) | |
| 459 | { | ||
| 460 | ✗ | gate_gl_api.glOrtho(left, right, bottom, top, near_val, far_val); | |
| 461 | ✗ | } | |
| 462 | |||
| 463 | |||
| 464 | ✗ | static GLenum translate_clientstate(gate_gl_api_clientstate_t client_state) | |
| 465 | { | ||
| 466 | ✗ | switch (client_state) | |
| 467 | { | ||
| 468 | ✗ | case gate_gl_api_clientstate_color_array: return GL_COLOR_ARRAY; | |
| 469 | #if defined(GL_EDGE_FLAG_ARRAY) | ||
| 470 | ✗ | case gate_gl_api_clientstate_edge_flag_array: return GL_EDGE_FLAG_ARRAY; | |
| 471 | #endif | ||
| 472 | #if defined(GL_INDEX_ARRAY) | ||
| 473 | ✗ | case gate_gl_api_clientstate_index_array: return GL_INDEX_ARRAY; | |
| 474 | #endif | ||
| 475 | ✗ | case gate_gl_api_clientstate_normal_array: return GL_NORMAL_ARRAY; | |
| 476 | ✗ | case gate_gl_api_clientstate_texture_coord_array: return GL_TEXTURE_COORD_ARRAY; | |
| 477 | ✗ | case gate_gl_api_clientstate_vertex_array: return GL_VERTEX_ARRAY; | |
| 478 | ✗ | default: return 0; | |
| 479 | } | ||
| 480 | } | ||
| 481 | |||
| 482 | ✗ | void gate_gl_api_enableclientstate(gate_gl_api_clientstate_t state) | |
| 483 | { | ||
| 484 | ✗ | gate_gl_api.glEnableClientState(translate_clientstate(state)); | |
| 485 | ✗ | } | |
| 486 | |||
| 487 | ✗ | void gate_gl_api_disableclientstate(gate_gl_api_clientstate_t state) | |
| 488 | { | ||
| 489 | ✗ | gate_gl_api.glDisableClientState(translate_clientstate(state)); | |
| 490 | ✗ | } | |
| 491 | |||
| 492 | ✗ | static GLenum translate_draw_mode(gate_gl_api_drawmode_t draw_mode) | |
| 493 | { | ||
| 494 | ✗ | GLenum ret = 0; | |
| 495 | ✗ | switch (draw_mode) | |
| 496 | { | ||
| 497 | ✗ | case gate_gl_api_drawmode_points: ret = GL_POINTS; break; | |
| 498 | ✗ | case gate_gl_api_drawmode_lines: ret = GL_LINES; break; | |
| 499 | ✗ | case gate_gl_api_drawmode_line_loop: ret = GL_LINE_LOOP; break; | |
| 500 | ✗ | case gate_gl_api_drawmode_line_strip: ret = GL_LINE_STRIP; break; | |
| 501 | ✗ | case gate_gl_api_drawmode_triangles: ret = GL_TRIANGLES; break; | |
| 502 | ✗ | case gate_gl_api_drawmode_triangle_strip: ret = GL_TRIANGLE_STRIP; break; | |
| 503 | ✗ | case gate_gl_api_drawmode_triangle_fan: ret = GL_TRIANGLE_FAN; break; | |
| 504 | #if defined(GL_QUADS) | ||
| 505 | ✗ | case gate_gl_api_drawmode_quads: ret = GL_QUADS; break; | |
| 506 | #endif | ||
| 507 | #if defined(GL_QUAD_STRIP) | ||
| 508 | ✗ | case gate_gl_api_drawmode_quad_strip: ret = GL_QUAD_STRIP; break; | |
| 509 | #endif | ||
| 510 | #if defined(GL_POLYGON) | ||
| 511 | ✗ | case gate_gl_api_drawmode_polygon: ret = GL_POLYGON; break; | |
| 512 | #endif | ||
| 513 | ✗ | default: ret = 0; break; | |
| 514 | } | ||
| 515 | ✗ | return ret; | |
| 516 | } | ||
| 517 | |||
| 518 | ✗ | void gate_gl_api_drawarrays(gate_gl_api_drawmode_t draw_mode, int index, size_t count) | |
| 519 | { | ||
| 520 | ✗ | gate_gl_api.glDrawArrays(translate_draw_mode(draw_mode), (GLint)index, (GLsizei)count); | |
| 521 | ✗ | } | |
| 522 | |||
| 523 | ✗ | void* gate_gl_api_createtexture(gate_gl_api_pixelformat_t pixel_format, | |
| 524 | gate_uint32_t width, gate_uint32_t height, void const* data) | ||
| 525 | { | ||
| 526 | GLenum format; | ||
| 527 | GLenum datatype; | ||
| 528 | GLuint tex; | ||
| 529 | ✗ | GLenum paramFilter = GL_LINEAR; | |
| 530 | ✗ | GLint internalFormat = | |
| 531 | #if defined(GL_RGBA8) | ||
| 532 | GL_RGBA8; | ||
| 533 | #elif defined(GL_RGB8) | ||
| 534 | GL_RGB8; | ||
| 535 | #else | ||
| 536 | GL_RGBA; | ||
| 537 | #endif | ||
| 538 | |||
| 539 | ✗ | switch (pixel_format) | |
| 540 | { | ||
| 541 | ✗ | case gate_gl_api_pixelformat_rgb: | |
| 542 | { | ||
| 543 | ✗ | format = GL_RGB; | |
| 544 | ✗ | datatype = GL_UNSIGNED_BYTE; | |
| 545 | ✗ | break; | |
| 546 | } | ||
| 547 | ✗ | case gate_gl_api_pixelformat_rgba: | |
| 548 | { | ||
| 549 | ✗ | format = GL_RGBA; | |
| 550 | ✗ | datatype = GL_UNSIGNED_BYTE; | |
| 551 | ✗ | break; | |
| 552 | } | ||
| 553 | ✗ | default: | |
| 554 | { | ||
| 555 | /* not supported */ | ||
| 556 | ✗ | return 0; | |
| 557 | } | ||
| 558 | } | ||
| 559 | |||
| 560 | ✗ | gate_gl_api.glEnable(GL_TEXTURE_2D); | |
| 561 | ✗ | gate_gl_api.glGenTextures(1, &tex); | |
| 562 | ✗ | gate_gl_api.glBindTexture(GL_TEXTURE_2D, tex); | |
| 563 | |||
| 564 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, paramFilter); | |
| 565 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, paramFilter); | |
| 566 | |||
| 567 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); | |
| 568 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); | |
| 569 | |||
| 570 | ✗ | gate_gl_api.glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, datatype, data); | |
| 571 | ✗ | gate_gl_api.glDisable(GL_TEXTURE_2D); | |
| 572 | |||
| 573 | ✗ | return (void*)(gate_uintptr_t)(tex); | |
| 574 | } | ||
| 575 | |||
| 576 | ✗ | void gate_gl_api_deletetexture(void* texture_id) | |
| 577 | { | ||
| 578 | ✗ | GLuint tex = (GLuint)(gate_uintptr_t)(texture_id); | |
| 579 | ✗ | gate_gl_api.glDeleteTextures(1, &tex); | |
| 580 | ✗ | } | |
| 581 | |||
| 582 | ✗ | void gate_gl_api_bindtexture(void* texture_id) | |
| 583 | { | ||
| 584 | ✗ | GLuint tex = (GLuint)(gate_uintptr_t)texture_id; | |
| 585 | ✗ | gate_gl_api.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); | |
| 586 | ✗ | gate_gl_api.glBindTexture(GL_TEXTURE_2D, tex); | |
| 587 | ✗ | } | |
| 588 | |||
| 589 | ✗ | void gate_gl_api_cullface(gate_gl_api_cullface_t mode) | |
| 590 | { | ||
| 591 | ✗ | GLenum value = GL_FRONT_AND_BACK; | |
| 592 | ✗ | switch (mode) | |
| 593 | { | ||
| 594 | ✗ | case gate_gl_api_cullface_front: value = GL_FRONT; break; | |
| 595 | ✗ | case gate_gl_api_cullface_back: value = GL_BACK; break; | |
| 596 | ✗ | case gate_gl_api_cullface_front_and_back: value = GL_FRONT_AND_BACK; break; | |
| 597 | } | ||
| 598 | ✗ | gate_gl_api.glCullFace(value); | |
| 599 | ✗ | } | |
| 600 | |||
| 601 | |||
| 602 | |||
| 603 | #if defined(GATE_GRAPHICS_OPENGL2_SUPPORT) | ||
| 604 | |||
| 605 | gate_uintptr_t gate_gl2_api_create_shader(gate_gl2_api_shader_type_t type) | ||
| 606 | { | ||
| 607 | GLenum itype = GL_VERTEX_SHADER; | ||
| 608 | switch(type) | ||
| 609 | { | ||
| 610 | case gate_gl2_api_shader_type_compute: itype = GL_COMPUTE_SHADER; break; | ||
| 611 | case gate_gl2_api_shader_type_vertex: itype = GL_VERTEX_SHADER; break; | ||
| 612 | case gate_gl2_api_shader_type_tess_control: itype = GL_TESS_CONTROL_SHADER; break; | ||
| 613 | case gate_gl2_api_shader_type_tess_evaluation: itype = GL_TESS_EVALUATION_SHADER; break; | ||
| 614 | case gate_gl2_api_shader_type_geometry: itype = GL_GEOMETRY_SHADER; break; | ||
| 615 | case gate_gl2_api_shader_type_fragment: itype = GL_FRAGMENT_SHADER; break; | ||
| 616 | } | ||
| 617 | return gate_gl2_api.glCreateShader(itype); | ||
| 618 | } | ||
| 619 | void gate_gl2_api_shader_source(gate_uintptr_t shader, gate_size_t count, char const * const * code, gate_size_t const* length) | ||
| 620 | { | ||
| 621 | GLint const iLength = length ? (GLint)*length : 0; | ||
| 622 | gate_gl2_api.glShaderSource((GLuint)shader, (GLsizei)count, code, length ? &iLength : NULL); | ||
| 623 | } | ||
| 624 | void gate_gl2_api_compile_shader(gate_uintptr_t shader) | ||
| 625 | { | ||
| 626 | gate_gl2_api.glCompileShader((GLuint)shader); | ||
| 627 | } | ||
| 628 | void gate_gl2_api_get_shader_iv(gate_uintptr_t shader, gate_gl2_api_shader_param_t param_name, gate_intptr_t* params) | ||
| 629 | { | ||
| 630 | GLenum pname = GL_SHADER_TYPE; | ||
| 631 | GLint iparam = (GLint)*params; | ||
| 632 | switch(param_name) | ||
| 633 | { | ||
| 634 | case gate_gl2_api_shader_param_type: pname = GL_SHADER_TYPE; break; | ||
| 635 | case gate_gl2_api_shader_param_delete_status: pname = GL_DELETE_STATUS; break; | ||
| 636 | case gate_gl2_api_shader_param_compile_status: pname = GL_COMPILE_STATUS; break; | ||
| 637 | case gate_gl2_api_shader_param_info_log_length: pname = GL_INFO_LOG_LENGTH; break; | ||
| 638 | case gate_gl2_api_shader_param_source_length: pname = GL_SHADER_SOURCE_LENGTH; break; | ||
| 639 | } | ||
| 640 | gate_gl2_api.glGetShaderiv(shader, pname, &iparam); | ||
| 641 | *params = (gate_intptr_t)iparam; | ||
| 642 | } | ||
| 643 | void gate_gl2_api_get_shader_info_log(gate_uintptr_t shader, gate_size_t maxLength, gate_size_t* length, char* infoLog) | ||
| 644 | { | ||
| 645 | GLsizei max_length = (GLsizei)maxLength; | ||
| 646 | GLsizei len = max_length; | ||
| 647 | GLchar* ptr_info = (GLchar*)infoLog; | ||
| 648 | gate_gl2_api.glGetShaderInfoLog((GLuint)shader, max_length, &len, ptr_info); | ||
| 649 | } | ||
| 650 | void gate_gl2_api_delete_shader(gate_uintptr_t shader) | ||
| 651 | { | ||
| 652 | gate_gl2_api.glDeleteShader((GLuint)shader); | ||
| 653 | } | ||
| 654 | |||
| 655 | |||
| 656 | gate_uintptr_t gate_gl2_api_create_program(void) | ||
| 657 | { | ||
| 658 | return gate_gl2_api.glCreateProgram(); | ||
| 659 | } | ||
| 660 | void gate_gl2_api_link_program(gate_uintptr_t program) | ||
| 661 | { | ||
| 662 | gate_gl2_api.glLinkProgram((GLuint)program); | ||
| 663 | } | ||
| 664 | void gate_gl2_api_get_program_iv(gate_uintptr_t program, gate_gl2_api_program_param_t param_name, gate_intptr_t* params) | ||
| 665 | { | ||
| 666 | GLenum pname = GL_LINK_STATUS; | ||
| 667 | GLint iparams = (GLint)*params; | ||
| 668 | switch(param_name) | ||
| 669 | { | ||
| 670 | case gate_gl2_api_program_param_active_attributes: pname = GL_ACTIVE_ATTRIBUTES; break; | ||
| 671 | case gate_gl2_api_program_param_active_attribute_max_length: pname = GL_ACTIVE_ATTRIBUTE_MAX_LENGTH; break; | ||
| 672 | case gate_gl2_api_program_param_active_uniforms: pname = GL_ACTIVE_UNIFORMS; break; | ||
| 673 | case gate_gl2_api_program_param_active_uniform_blocks: pname = GL_ACTIVE_UNIFORM_BLOCKS; break; | ||
| 674 | case gate_gl2_api_program_param_active_uniform_block_max_name_length: pname = GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH; break; | ||
| 675 | case gate_gl2_api_program_param_active_uniform_max_length: pname = GL_ACTIVE_UNIFORM_MAX_LENGTH; break; | ||
| 676 | case gate_gl2_api_program_param_attached_shaders: pname = GL_ATTACHED_SHADERS; break; | ||
| 677 | case gate_gl2_api_program_param_delete_status: pname = GL_DELETE_STATUS; break; | ||
| 678 | case gate_gl2_api_program_param_info_log_length: pname = GL_INFO_LOG_LENGTH; break; | ||
| 679 | case gate_gl2_api_program_param_link_status: pname = GL_LINK_STATUS; break; | ||
| 680 | case gate_gl2_api_program_param_program_binary_retrievable_hint: pname = GL_PROGRAM_BINARY_RETRIEVABLE_HINT; break; | ||
| 681 | case gate_gl2_api_program_param_transform_feedback_buffer_mode: pname = GL_TRANSFORM_FEEDBACK_BUFFER_MODE; break; | ||
| 682 | case gate_gl2_api_program_param_transform_feedback_varyings: pname = GL_TRANSFORM_FEEDBACK_VARYINGS; break; | ||
| 683 | case gate_gl2_api_program_param_transform_feedback_varying_max_length: pname = GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH; break; | ||
| 684 | case gate_gl2_api_program_param_validate_status: pname = GL_VALIDATE_STATUS; break; | ||
| 685 | } | ||
| 686 | gate_gl2_api.glGetProgramiv(program, pname, &iparams); | ||
| 687 | *params = (gate_intptr_t)iparams; | ||
| 688 | } | ||
| 689 | void gate_gl2_api_get_program_info_log(gate_uintptr_t program, gate_size_t bufSize, gate_size_t* length, char* infoLog) | ||
| 690 | { | ||
| 691 | GLsizei len = *length; | ||
| 692 | gate_gl2_api.glGetProgramInfoLog((GLuint)program, (GLsizei)bufSize, &len, infoLog); | ||
| 693 | *length = len; | ||
| 694 | } | ||
| 695 | |||
| 696 | void gate_gl2_api_use_program(gate_uintptr_t program) | ||
| 697 | { | ||
| 698 | gate_gl2_api.glUseProgram((GLuint)program); | ||
| 699 | } | ||
| 700 | void gate_gl2_api_attach_shader(gate_uintptr_t program, gate_uintptr_t shader) | ||
| 701 | { | ||
| 702 | gate_gl2_api.glAttachShader((GLuint)program, (GLuint)shader); | ||
| 703 | } | ||
| 704 | void gate_gl2_api_delete_program(gate_uintptr_t program) | ||
| 705 | { | ||
| 706 | gate_gl2_api.glDeleteProgram((GLuint)program); | ||
| 707 | } | ||
| 708 | void gate_gl2_api_bind_attrib_location(gate_uintptr_t program, gate_size_t index, char const* name) | ||
| 709 | { | ||
| 710 | gate_gl2_api.glBindAttribLocation((GLuint)program, (GLuint)index, name); | ||
| 711 | } | ||
| 712 | gate_intptr_t gate_gl2_api_get_attrib_location(gate_uintptr_t program, char const* name) | ||
| 713 | { | ||
| 714 | return gate_gl2_api.glGetAttribLocation((GLuint)program, name); | ||
| 715 | } | ||
| 716 | gate_intptr_t gate_gl2_api_get_uniform_location(gate_uintptr_t program, char const* name) | ||
| 717 | { | ||
| 718 | return gate_gl2_api.glGetUniformLocation((GLuint)program, name); | ||
| 719 | } | ||
| 720 | |||
| 721 | |||
| 722 | void gate_gl2_api_gen_buffers(gate_size_t n, unsigned int* buffers) | ||
| 723 | { | ||
| 724 | gate_gl2_api.glGenBuffers((GLsizei)n, buffers); | ||
| 725 | } | ||
| 726 | void gate_gl2_api_delete_buffers(gate_size_t n, unsigned int const * buffers) | ||
| 727 | { | ||
| 728 | gate_gl2_api.glDeleteBuffers((GLsizei)n, buffers); | ||
| 729 | } | ||
| 730 | |||
| 731 | static GLenum convert_target(gate_gl2_api_buffer_type_t target_type) | ||
| 732 | { | ||
| 733 | switch(target_type) | ||
| 734 | { | ||
| 735 | default: | ||
| 736 | case gate_gl2_api_buffer_type_array: return GL_ARRAY_BUFFER; | ||
| 737 | case gate_gl2_api_buffer_type_atomic_counter: return GL_ATOMIC_COUNTER_BUFFER; | ||
| 738 | case gate_gl2_api_buffer_type_copy_read: return GL_COPY_READ_BUFFER; | ||
| 739 | case gate_gl2_api_buffer_type_copy_write: return GL_COPY_WRITE_BUFFER; | ||
| 740 | case gate_gl2_api_buffer_type_dispatch_indirect: return GL_DISPATCH_INDIRECT_BUFFER; | ||
| 741 | case gate_gl2_api_buffer_type_draw_indirect: return GL_DRAW_INDIRECT_BUFFER; | ||
| 742 | case gate_gl2_api_buffer_type_element_array: return GL_ELEMENT_ARRAY_BUFFER; | ||
| 743 | case gate_gl2_api_buffer_type_pixel_pack: return GL_PIXEL_PACK_BUFFER; | ||
| 744 | case gate_gl2_api_buffer_type_pixel_unpack: return GL_PIXEL_UNPACK_BUFFER; | ||
| 745 | case gate_gl2_api_buffer_type_query: return GL_QUERY_BUFFER; | ||
| 746 | case gate_gl2_api_buffer_type_shader_storage: return GL_SHADER_STORAGE_BUFFER; | ||
| 747 | case gate_gl2_api_buffer_type_texture: return GL_TEXTURE_BUFFER; | ||
| 748 | case gate_gl2_api_buffer_type_transform_feedback: return GL_TRANSFORM_FEEDBACK_BUFFER; | ||
| 749 | case gate_gl2_api_buffer_type_uniform: return GL_UNIFORM_BUFFER; | ||
| 750 | } | ||
| 751 | } | ||
| 752 | void gate_gl2_api_bind_buffers(gate_gl2_api_buffer_type_t target_type, unsigned int buffer) | ||
| 753 | { | ||
| 754 | GLenum target = convert_target(target_type); | ||
| 755 | return gate_gl2_api.glBindBuffer(target, buffer); | ||
| 756 | } | ||
| 757 | static GLenum convert_usage(gate_gl2_api_usage_type_t usage_value) | ||
| 758 | { | ||
| 759 | switch(usage_value) | ||
| 760 | { | ||
| 761 | default: | ||
| 762 | case gate_gl2_api_usage_type_stream_draw: return GL_STREAM_DRAW; | ||
| 763 | case gate_gl2_api_usage_type_stream_read: return GL_STREAM_READ; | ||
| 764 | case gate_gl2_api_usage_type_stream_copy: return GL_STREAM_COPY; | ||
| 765 | case gate_gl2_api_usage_type_static_draw: return GL_STATIC_DRAW; | ||
| 766 | case gate_gl2_api_usage_type_static_read: return GL_STATIC_READ; | ||
| 767 | case gate_gl2_api_usage_type_static_copy: return GL_STATIC_COPY; | ||
| 768 | case gate_gl2_api_usage_type_dynamic_draw: return GL_DYNAMIC_DRAW; | ||
| 769 | case gate_gl2_api_usage_type_dynamic_read: return GL_DYNAMIC_READ; | ||
| 770 | case gate_gl2_api_usage_type_dynamic_copy: return GL_DYNAMIC_COPY; | ||
| 771 | } | ||
| 772 | } | ||
| 773 | void gate_gl2_api_buffer_data(gate_gl2_api_buffer_type_t target_type, gate_size_t size, void const* data, gate_gl2_api_usage_type_t usage_value) | ||
| 774 | { | ||
| 775 | GLenum target = convert_target(target_type); | ||
| 776 | GLenum usage = convert_usage(usage_value); | ||
| 777 | return gate_gl2_api.glBufferData(target, size, data, usage); | ||
| 778 | } | ||
| 779 | /* | ||
| 780 | void gate_gl2_api_named_buffer_data(unsigned int buffer, gate_size_t size, void const* data, gate_gl2_api_usage_type_t usage_value) | ||
| 781 | { | ||
| 782 | GLenum usage = convert_usage(usage_value); | ||
| 783 | gate_gl2_api.glNamedBufferData(buffer, size, data, usage); | ||
| 784 | } | ||
| 785 | */ | ||
| 786 | void gate_gl2_api_vertex_attrib_pointer(gate_uintptr_t index, gate_size_t size, gate_gl2_api_vertex_attrib_type_t type, gate_bool_t normalized, gate_size_t stride, void const* pointer) | ||
| 787 | { | ||
| 788 | GLenum vtype = GL_INT; | ||
| 789 | GLboolean bnorm = normalized ? GL_TRUE : GL_FALSE; | ||
| 790 | switch(type) | ||
| 791 | { | ||
| 792 | case gate_gl2_api_vertex_attrib_byte: vtype = GL_BYTE; break; | ||
| 793 | case gate_gl2_api_vertex_attrib_unsigned_byte: vtype = GL_UNSIGNED_BYTE; break; | ||
| 794 | case gate_gl2_api_vertex_attrib_short: vtype = GL_SHORT; break; | ||
| 795 | case gate_gl2_api_vertex_attrib_unsigned_short: vtype = GL_UNSIGNED_SHORT; break; | ||
| 796 | case gate_gl2_api_vertex_attrib_int: vtype = GL_INT; break; | ||
| 797 | case gate_gl2_api_vertex_attrib_half_float: vtype = GL_HALF_FLOAT; break; | ||
| 798 | case gate_gl2_api_vertex_attrib_float: vtype = GL_FLOAT; break; | ||
| 799 | case gate_gl2_api_vertex_attrib_double: vtype = GL_DOUBLE; break; | ||
| 800 | case gate_gl2_api_vertex_attrib_fixed: vtype = GL_FIXED; break; | ||
| 801 | case gate_gl2_api_vertex_attrib_int_2_10_10_10_rev: vtype = GL_INT_2_10_10_10_REV; break; | ||
| 802 | case gate_gl2_api_vertex_attrib_unsigned_int_2_10_10_10_rev: vtype = GL_UNSIGNED_INT_2_10_10_10_REV; break; | ||
| 803 | case gate_gl2_api_vertex_attrib_unsigned_int_10F_11F_11F_rev: vtype = GL_UNSIGNED_INT_10F_11F_11F_REV; break; | ||
| 804 | } | ||
| 805 | |||
| 806 | gate_gl2_api.glVertexAttribPointer((GLuint)index, (GLint)size, vtype, bnorm, (GLsizei)stride, pointer); | ||
| 807 | } | ||
| 808 | |||
| 809 | void gate_gl2_api_enable_vertex_attrib_array(gate_uintptr_t index) | ||
| 810 | { | ||
| 811 | gate_gl2_api.glEnableVertexAttribArray((GLuint)index); | ||
| 812 | } | ||
| 813 | void gate_gl2_api_disable_vertex_attrib_array(gate_uintptr_t index) | ||
| 814 | { | ||
| 815 | gate_gl2_api.glDisableVertexAttribArray((GLuint)index); | ||
| 816 | } | ||
| 817 | void gate_gl2_api_active_texture(gate_uintptr_t texture_index) | ||
| 818 | { | ||
| 819 | GLenum param = GL_TEXTURE0 + texture_index; | ||
| 820 | gate_gl2_api.glActiveTexture(param); | ||
| 821 | } | ||
| 822 | |||
| 823 | |||
| 824 | void gate_gl2_api_uniform1f(gate_intptr_t location, gate_real32_t v0) | ||
| 825 | { | ||
| 826 | gate_gl2_api.glUniform1f(location, v0); | ||
| 827 | } | ||
| 828 | void gate_gl2_api_uniform2f(gate_intptr_t location, gate_real32_t v0, gate_real32_t v1) | ||
| 829 | { | ||
| 830 | gate_gl2_api.glUniform2f(location, v0, v1); | ||
| 831 | } | ||
| 832 | void gate_gl2_api_uniform3f(gate_intptr_t location, gate_real32_t v0, gate_real32_t v1, gate_real32_t v2) | ||
| 833 | { | ||
| 834 | gate_gl2_api.glUniform3f(location, v0, v1, v2); | ||
| 835 | } | ||
| 836 | void gate_gl2_api_uniform4f(gate_intptr_t location, gate_real32_t v0, gate_real32_t v1, gate_real32_t v2, gate_real32_t v3) | ||
| 837 | { | ||
| 838 | gate_gl2_api.glUniform4f(location, v0, v1, v2, v3); | ||
| 839 | } | ||
| 840 | void gate_gl2_api_uniform1fv(gate_intptr_t location, gate_size_t count,const gate_real32_t *value) | ||
| 841 | { | ||
| 842 | gate_gl2_api.glUniform1fv(location, count, value); | ||
| 843 | } | ||
| 844 | void gate_gl2_api_uniform2fv(gate_intptr_t location, gate_size_t count, const gate_real32_t *value) | ||
| 845 | { | ||
| 846 | gate_gl2_api.glUniform2fv(location, count, value); | ||
| 847 | } | ||
| 848 | void gate_gl2_api_uniform3fv(gate_intptr_t location, gate_size_t count, const gate_real32_t *value) | ||
| 849 | { | ||
| 850 | gate_gl2_api.glUniform3fv(location, count, value); | ||
| 851 | } | ||
| 852 | void gate_gl2_api_uniform4fv(gate_intptr_t location, gate_size_t count, const gate_real32_t *value) | ||
| 853 | { | ||
| 854 | gate_gl2_api.glUniform4fv(location, count, value); | ||
| 855 | } | ||
| 856 | void gate_gl2_api_uniform1i(gate_intptr_t location, int v0) | ||
| 857 | { | ||
| 858 | gate_gl2_api.glUniform1i(location, v0); | ||
| 859 | } | ||
| 860 | void gate_gl2_api_uniform2i(gate_intptr_t location, int v0, int v1) | ||
| 861 | { | ||
| 862 | gate_gl2_api.glUniform2i(location, v0, v1); | ||
| 863 | } | ||
| 864 | void gate_gl2_api_uniform3i(gate_intptr_t location, int v0, int v1, int v2) | ||
| 865 | { | ||
| 866 | gate_gl2_api.glUniform3i(location, v0, v1, v2); | ||
| 867 | } | ||
| 868 | void gate_gl2_api_uniform4i(gate_intptr_t location, int v0, int v1, int v2, int v3) | ||
| 869 | { | ||
| 870 | gate_gl2_api.glUniform4i(location, v0, v1, v2, v3); | ||
| 871 | } | ||
| 872 | void gate_gl2_api_uniform1iv(gate_intptr_t location, gate_size_t count, const int *value) | ||
| 873 | { | ||
| 874 | gate_gl2_api.glUniform1iv(location, count, value); | ||
| 875 | } | ||
| 876 | void gate_gl2_api_uniform2iv(gate_intptr_t location, gate_size_t count, const int *value) | ||
| 877 | { | ||
| 878 | gate_gl2_api.glUniform2iv(location, count, value); | ||
| 879 | } | ||
| 880 | void gate_gl2_api_uniform3iv(gate_intptr_t location, gate_size_t count, const int *value) | ||
| 881 | { | ||
| 882 | gate_gl2_api.glUniform3iv(location, count, value); | ||
| 883 | } | ||
| 884 | void gate_gl2_api_uniform4iv(gate_intptr_t location, gate_size_t count, const int *value) | ||
| 885 | { | ||
| 886 | gate_gl2_api.glUniform4iv(location, count, value); | ||
| 887 | } | ||
| 888 | |||
| 889 | |||
| 890 | void gate_gl2_api_uniform_matrix2fv(gate_intptr_t location, gate_size_t count, gate_bool_t transpose, const gate_real32_t *value) | ||
| 891 | { | ||
| 892 | gate_gl2_api.glUniformMatrix2fv(location, count, transpose, value); | ||
| 893 | } | ||
| 894 | void gate_gl2_api_uniform_matrix3fv(gate_intptr_t location, gate_size_t count, gate_bool_t transpose, const gate_real32_t *value) | ||
| 895 | { | ||
| 896 | gate_gl2_api.glUniformMatrix3fv(location, count, transpose, value); | ||
| 897 | } | ||
| 898 | void gate_gl2_api_uniform_matrix4fv(gate_intptr_t location, gate_size_t count, gate_bool_t transpose, const gate_real32_t *value) | ||
| 899 | { | ||
| 900 | gate_gl2_api.glUniformMatrix4fv(location, count, transpose, value); | ||
| 901 | } | ||
| 902 | |||
| 903 | |||
| 904 | |||
| 905 | #endif /* GATE_GRAPHICS_OPENGL2_SUPPORT */ | ||
| 906 | |||
| 907 | |||
| 908 | |||
| 909 | #if defined(GATE_GL_API_WINAPI) | ||
| 910 | |||
| 911 | #include "gate/graphics/platform/opengl_winapi_impl.h" | ||
| 912 | |||
| 913 | #endif /* GATE_GL_API_WINAPI */ | ||
| 914 | |||
| 915 | |||
| 916 | |||
| 917 | #if defined(GATE_GL_API_GLUT) | ||
| 918 | |||
| 919 | #include "gate/graphics/platform/opengl_glut_impl.h" | ||
| 920 | |||
| 921 | #endif /* GATE_GL_API_GLUT */ | ||
| 922 | |||
| 923 | |||
| 924 | |||
| 925 | #if defined(GATE_GL_API_EGL) | ||
| 926 | |||
| 927 | # include "gate/graphics/platform/opengl_egl_apis.h" | ||
| 928 | |||
| 929 | # if defined(GATE_SYS_WINCE) | ||
| 930 | # elif defined(GATE_SYS_WASM) | ||
| 931 | # include "gate/graphics/platform/opengl_emscripten_impl.h" | ||
| 932 | # elif defined(GATE_SYS_ANDROID) | ||
| 933 | # include "gate/graphics/platform/opengl_android_impl.h" | ||
| 934 | # else | ||
| 935 | # include "gate/graphics/platform/opengl_xlib_impl.h" | ||
| 936 | # endif | ||
| 937 | |||
| 938 | #endif /* GATE_GL_API_EGL */ | ||
| 939 | |||
| 940 | |||
| 941 | #endif /* GATE_GRAPHICS_GL_OPENGL */ | ||
| 942 | |||
| 943 | |||
| 944 | |||
| 945 | #if defined(GATE_GARPHICS_GL_NOIMPL) | ||
| 946 | |||
| 947 | |||
| 948 | gate_result_t gate_gl_surface_init(gate_gl_surface_t* surface) | ||
| 949 | { | ||
| 950 | (void)surface; | ||
| 951 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 952 | } | ||
| 953 | gate_result_t gate_gl_surface_uninit(gate_gl_surface_t* surface) | ||
| 954 | { | ||
| 955 | (void)surface; | ||
| 956 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 957 | } | ||
| 958 | gate_result_t gate_gl_surface_open(gate_gl_surface_t* surface, gate_gl_surface_type_t type, | ||
| 959 | gate_uint32_t width, gate_uint32_t height, gate_enumint_t flags) | ||
| 960 | { | ||
| 961 | (void)surface; | ||
| 962 | (void)type; | ||
| 963 | (void)width; | ||
| 964 | (void)height; | ||
| 965 | (void)flags; | ||
| 966 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 967 | } | ||
| 968 | gate_result_t gate_gl_surface_close(gate_gl_surface_t* surface) | ||
| 969 | { | ||
| 970 | (void)surface; | ||
| 971 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 972 | } | ||
| 973 | gate_result_t gate_gl_surface_resize(gate_gl_surface_t* surface, gate_uint32_t width, gate_uint32_t height) | ||
| 974 | { | ||
| 975 | (void)surface; | ||
| 976 | (void)width; | ||
| 977 | (void)height; | ||
| 978 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 979 | } | ||
| 980 | gate_result_t gate_gl_surface_get_size(gate_gl_surface_t* surface, gate_uint32_t* width, gate_uint32_t* height) | ||
| 981 | { | ||
| 982 | (void)surface; | ||
| 983 | (void)width; | ||
| 984 | (void)height; | ||
| 985 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 986 | } | ||
| 987 | gate_result_t gate_gl_surface_print_image(gate_gl_surface_t* surface, gate_rasterimage_t* target_image) | ||
| 988 | { | ||
| 989 | (void)surface; | ||
| 990 | (void)target_image; | ||
| 991 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 992 | } | ||
| 993 | gate_result_t gate_gl_surface_run_event_loop(gate_gl_surface_t* surface, | ||
| 994 | gate_gl_surface_events_t* event_callbacks, void* user_param) | ||
| 995 | { | ||
| 996 | (void)surface; | ||
| 997 | (void)event_callbacks; | ||
| 998 | (void)user_param; | ||
| 999 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 1000 | } | ||
| 1001 | gate_result_t gate_gl_surface_exit_event_loop(gate_gl_surface_t* surface) | ||
| 1002 | { | ||
| 1003 | (void)surface; | ||
| 1004 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 1005 | } | ||
| 1006 | gate_result_t gate_gl_surface_swap_buffers(gate_gl_surface_t* surface) | ||
| 1007 | { | ||
| 1008 | (void)surface; | ||
| 1009 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | |||
| 1013 | |||
| 1014 | gate_result_t gate_gl_api_init() | ||
| 1015 | { | ||
| 1016 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | void gate_gl_api_color3(gate_real32_t r, gate_real32_t g, gate_real32_t b) | ||
| 1020 | { | ||
| 1021 | (void)r; | ||
| 1022 | (void)g; | ||
| 1023 | (void)b; | ||
| 1024 | } | ||
| 1025 | void gate_gl_api_color4(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | ||
| 1026 | { | ||
| 1027 | (void)r; | ||
| 1028 | (void)g; | ||
| 1029 | (void)b; | ||
| 1030 | (void)a; | ||
| 1031 | } | ||
| 1032 | void gate_gl_api_color3b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b) | ||
| 1033 | { | ||
| 1034 | (void)r; | ||
| 1035 | (void)g; | ||
| 1036 | (void)b; | ||
| 1037 | } | ||
| 1038 | void gate_gl_api_color4b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b, gate_uint8_t a) | ||
| 1039 | { | ||
| 1040 | (void)r; | ||
| 1041 | (void)g; | ||
| 1042 | (void)b; | ||
| 1043 | (void)a; | ||
| 1044 | } | ||
| 1045 | void gate_gl_api_vertexpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | ||
| 1046 | { | ||
| 1047 | (void)coord_count; | ||
| 1048 | (void)ptr_coords; | ||
| 1049 | } | ||
| 1050 | void gate_gl_api_texcoordpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | ||
| 1051 | { | ||
| 1052 | (void)coord_count; | ||
| 1053 | (void)ptr_coords; | ||
| 1054 | } | ||
| 1055 | void gate_gl_api_shademodel(gate_gl_api_shademodel_t model) | ||
| 1056 | { | ||
| 1057 | (void)model; | ||
| 1058 | } | ||
| 1059 | void gate_gl_api_blendfunc(gate_gl_api_blend_t blend_func_src, gate_gl_api_blend_t blend_func_dst) | ||
| 1060 | { | ||
| 1061 | (void)blend_func_src; | ||
| 1062 | (void)blend_func_dst; | ||
| 1063 | } | ||
| 1064 | void gate_gl_api_clearcolor(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | ||
| 1065 | { | ||
| 1066 | (void)r; | ||
| 1067 | (void)g; | ||
| 1068 | (void)b; | ||
| 1069 | (void)a; | ||
| 1070 | } | ||
| 1071 | void gate_gl_api_cleardepth(gate_real32_t depth) | ||
| 1072 | { | ||
| 1073 | (void)depth; | ||
| 1074 | } | ||
| 1075 | void gate_gl_api_enable(gate_gl_api_capability_t capability) | ||
| 1076 | { | ||
| 1077 | (void)capability; | ||
| 1078 | } | ||
| 1079 | void gate_gl_api_disable(gate_gl_api_capability_t capability) | ||
| 1080 | { | ||
| 1081 | (void)capability; | ||
| 1082 | } | ||
| 1083 | void gate_gl_api_depthfunc(gate_gl_api_depth_t depth_function) | ||
| 1084 | { | ||
| 1085 | (void)depth_function; | ||
| 1086 | } | ||
| 1087 | void gate_gl_api_depthmask(gate_bool_t enabled) | ||
| 1088 | { | ||
| 1089 | (void)enabled; | ||
| 1090 | } | ||
| 1091 | void gate_gl_api_hint(gate_gl_api_hint_t hint_type, gate_gl_api_hintmode_t hint_mode) | ||
| 1092 | { | ||
| 1093 | (void)hint_type; | ||
| 1094 | (void)hint_mode; | ||
| 1095 | } | ||
| 1096 | void gate_gl_api_viewport(gate_int32_t x, gate_int32_t y, gate_int32_t width, gate_int32_t height) | ||
| 1097 | { | ||
| 1098 | (void)x; | ||
| 1099 | (void)y; | ||
| 1100 | (void)width; | ||
| 1101 | (void)height; | ||
| 1102 | } | ||
| 1103 | void gate_gl_api_matrixmode(gate_gl_api_matrixmode_t matrix_mode) | ||
| 1104 | { | ||
| 1105 | (void)matrix_mode; | ||
| 1106 | } | ||
| 1107 | void gate_gl_api_loadidentity() | ||
| 1108 | { | ||
| 1109 | } | ||
| 1110 | void gate_gl_api_multmatrix(gate_real32_t const matrix[16]) | ||
| 1111 | { | ||
| 1112 | (void)matrix; | ||
| 1113 | } | ||
| 1114 | void gate_gl_api_translate(gate_real32_t x, gate_real32_t y, gate_real32_t z) | ||
| 1115 | { | ||
| 1116 | (void)x; | ||
| 1117 | (void)y; | ||
| 1118 | (void)z; | ||
| 1119 | } | ||
| 1120 | void gate_gl_api_rotate(gate_real32_t angle, gate_real32_t x, gate_real32_t y, gate_real32_t z) | ||
| 1121 | { | ||
| 1122 | (void)angle; | ||
| 1123 | (void)x; | ||
| 1124 | (void)y; | ||
| 1125 | (void)z; | ||
| 1126 | } | ||
| 1127 | void gate_gl_api_flush() | ||
| 1128 | { | ||
| 1129 | |||
| 1130 | } | ||
| 1131 | void gate_gl_api_finish() | ||
| 1132 | { | ||
| 1133 | |||
| 1134 | } | ||
| 1135 | void gate_gl_api_clear(unsigned clear_bits) | ||
| 1136 | { | ||
| 1137 | (void)clear_bits; | ||
| 1138 | } | ||
| 1139 | void gate_gl_api_perspective(gate_real32_t fovy, gate_real32_t aspect, gate_real32_t znear, gate_real32_t zfar) | ||
| 1140 | { | ||
| 1141 | (void)fovy; | ||
| 1142 | (void)aspect; | ||
| 1143 | (void)znear; | ||
| 1144 | (void)zfar; | ||
| 1145 | } | ||
| 1146 | void gate_gl_api_lookat(gate_real32_t eyeX, gate_real32_t eyeY, gate_real32_t eyeZ, | ||
| 1147 | gate_real32_t lookX, gate_real32_t lookY, gate_real32_t lookZ, | ||
| 1148 | gate_real32_t upX, gate_real32_t upY, gate_real32_t upZ) | ||
| 1149 | { | ||
| 1150 | (void)eyeX; | ||
| 1151 | (void)eyeY; | ||
| 1152 | (void)eyeZ; | ||
| 1153 | (void)lookX; | ||
| 1154 | (void)lookY; | ||
| 1155 | (void)lookZ; | ||
| 1156 | (void)upX; | ||
| 1157 | (void)upY; | ||
| 1158 | (void)upZ; | ||
| 1159 | } | ||
| 1160 | void gate_gl_api_ortho(gate_real32_t left, gate_real32_t right, gate_real32_t bottom, gate_real32_t top, | ||
| 1161 | gate_real32_t near_val, gate_real32_t far_val) | ||
| 1162 | { | ||
| 1163 | (void)left; | ||
| 1164 | (void)right; | ||
| 1165 | (void)bottom; | ||
| 1166 | (void)top; | ||
| 1167 | (void)near_val; | ||
| 1168 | (void)far_val; | ||
| 1169 | } | ||
| 1170 | void gate_gl_api_enableclientstate(gate_gl_api_clientstate_t state) | ||
| 1171 | { | ||
| 1172 | (void)state; | ||
| 1173 | } | ||
| 1174 | void gate_gl_api_disableclientstate(gate_gl_api_clientstate_t state) | ||
| 1175 | { | ||
| 1176 | (void)state; | ||
| 1177 | } | ||
| 1178 | void gate_gl_api_drawarrays(gate_gl_api_drawmode_t draw_mode, int index, size_t count) | ||
| 1179 | { | ||
| 1180 | (void)draw_mode; | ||
| 1181 | (void)index; | ||
| 1182 | (void)count; | ||
| 1183 | } | ||
| 1184 | void* gate_gl_api_createtexture(gate_gl_api_pixelformat_t pixel_format, gate_uint32_t width, gate_uint32_t height, | ||
| 1185 | void const* data) | ||
| 1186 | { | ||
| 1187 | (void)pixel_format; | ||
| 1188 | (void)width; | ||
| 1189 | (void)height; | ||
| 1190 | (void)data; | ||
| 1191 | return NULL; | ||
| 1192 | } | ||
| 1193 | void gate_gl_api_deletetexture(void* texture_id) | ||
| 1194 | { | ||
| 1195 | (void)texture_id; | ||
| 1196 | } | ||
| 1197 | void gate_gl_api_bindtexture(void* texture_id) | ||
| 1198 | { | ||
| 1199 | (void)texture_id; | ||
| 1200 | } | ||
| 1201 | void gate_gl_api_cullface(gate_gl_api_cullface_t mode) | ||
| 1202 | { | ||
| 1203 | (void)mode; | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | #endif /* GATE_GRAPHICS_GL_OPENGL */ | ||
| 1207 | |||
| 1208 |