| 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 | |||
| 44 | #if defined(GATE_SYS_WIN) && !defined(GATE_SYS_WINCE) | ||
| 45 | # define GATE_GL_API_WINAPI 1 | ||
| 46 | #elif defined(GATE_SYS_DARWIN) | ||
| 47 | # define GATE_GL_API_GLUT 1 | ||
| 48 | #else | ||
| 49 | # define GATE_GL_API_EGL 1 | ||
| 50 | #endif | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | ✗ | gate_result_t gate_gl_api_init() | |
| 55 | { | ||
| 56 | ✗ | return gate_gl_api_load_functions(); | |
| 57 | } | ||
| 58 | |||
| 59 | ✗ | void gate_gl_api_color3(gate_real32_t r, gate_real32_t g, gate_real32_t b) | |
| 60 | { | ||
| 61 | ✗ | gate_gl_api_color4(r, g, b, 1.0f); | |
| 62 | ✗ | } | |
| 63 | ✗ | void gate_gl_api_color4(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | |
| 64 | { | ||
| 65 | ✗ | gate_gl_api.glColor4f(r, g, b, a); | |
| 66 | ✗ | } | |
| 67 | ✗ | void gate_gl_api_color3b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b) | |
| 68 | { | ||
| 69 | ✗ | gate_gl_api_color4b(r, g, b, 255); | |
| 70 | ✗ | } | |
| 71 | ✗ | void gate_gl_api_color4b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b, gate_uint8_t a) | |
| 72 | { | ||
| 73 | ✗ | gate_gl_api.glColor4f((gate_real32_t)r / 255.0f, | |
| 74 | ✗ | (gate_real32_t)g / 255.0f, | |
| 75 | ✗ | (gate_real32_t)b / 255.0f, | |
| 76 | ✗ | (gate_real32_t)a / 255.0f); | |
| 77 | ✗ | } | |
| 78 | |||
| 79 | ✗ | void gate_gl_api_vertexpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | |
| 80 | { | ||
| 81 | ✗ | gate_gl_api.glVertexPointer((GLint)coord_count, GL_FLOAT, 0, ptr_coords); | |
| 82 | ✗ | } | |
| 83 | |||
| 84 | ✗ | void gate_gl_api_texcoordpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | |
| 85 | { | ||
| 86 | ✗ | gate_gl_api.glTexCoordPointer((GLint)coord_count, GL_FLOAT, 0, ptr_coords); | |
| 87 | ✗ | } | |
| 88 | |||
| 89 | ✗ | void gate_gl_api_shademodel(gate_gl_api_shademodel_t model) | |
| 90 | { | ||
| 91 | ✗ | GLenum value = 0; | |
| 92 | ✗ | switch (model) | |
| 93 | { | ||
| 94 | ✗ | case gate_gl_api_shademodel_flat: value = GL_FLAT; break; | |
| 95 | ✗ | case gate_gl_api_shademodel_smooth: value = GL_SMOOTH; break; | |
| 96 | } | ||
| 97 | ✗ | gate_gl_api.glShadeModel(value); | |
| 98 | ✗ | } | |
| 99 | |||
| 100 | ✗ | static GLenum resolve_blend_function(gate_gl_api_blend_t blend_function) | |
| 101 | { | ||
| 102 | ✗ | switch (blend_function) | |
| 103 | { | ||
| 104 | ✗ | case gate_gl_api_blend_zero: return GL_ZERO; | |
| 105 | ✗ | case gate_gl_api_blend_one: return GL_ONE; | |
| 106 | ✗ | case gate_gl_api_blend_src_color: return GL_SRC_COLOR; | |
| 107 | ✗ | case gate_gl_api_blend_one_minus_src_color: return GL_ONE_MINUS_SRC_COLOR; | |
| 108 | ✗ | case gate_gl_api_blend_src_alpha: return GL_SRC_ALPHA; | |
| 109 | ✗ | case gate_gl_api_blend_one_minus_src_alpha: return GL_ONE_MINUS_SRC_ALPHA; | |
| 110 | ✗ | case gate_gl_api_blend_dst_alpha: return GL_DST_ALPHA; | |
| 111 | ✗ | case gate_gl_api_blend_one_minus_dst_alpha: return GL_ONE_MINUS_DST_ALPHA; | |
| 112 | ✗ | case gate_gl_api_blend_dst_color: return GL_DST_COLOR; | |
| 113 | ✗ | case gate_gl_api_blend_one_minus_dst_color: return GL_ONE_MINUS_DST_COLOR; | |
| 114 | ✗ | case gate_gl_api_blend_src_alpha_saturate: return GL_SRC_ALPHA_SATURATE; | |
| 115 | } | ||
| 116 | ✗ | return 0; | |
| 117 | } | ||
| 118 | |||
| 119 | ✗ | void gate_gl_api_blendfunc(gate_gl_api_blend_t blend_func_src, gate_gl_api_blend_t blend_func_dst) | |
| 120 | { | ||
| 121 | ✗ | gate_gl_api.glBlendFunc(resolve_blend_function(blend_func_src), resolve_blend_function(blend_func_dst)); | |
| 122 | ✗ | } | |
| 123 | |||
| 124 | ✗ | void gate_gl_api_clearcolor(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | |
| 125 | { | ||
| 126 | ✗ | gate_gl_api.glClearColor(r, g, b, a); | |
| 127 | ✗ | } | |
| 128 | |||
| 129 | ✗ | void gate_gl_api_cleardepth(gate_real32_t depth) | |
| 130 | { | ||
| 131 | ✗ | gate_gl_api.glClearDepth(depth); | |
| 132 | ✗ | } | |
| 133 | |||
| 134 | ✗ | static GLenum translate_capability(gate_gl_api_capability_t capability) | |
| 135 | { | ||
| 136 | ✗ | switch (capability) | |
| 137 | { | ||
| 138 | ✗ | case gate_gl_api_capability_alpha_test: return GL_ALPHA_TEST; | |
| 139 | #if defined(GL_AUTO_NORMAL) | ||
| 140 | ✗ | case gate_gl_api_capability_auto_normal: return GL_AUTO_NORMAL; | |
| 141 | #endif | ||
| 142 | ✗ | case gate_gl_api_capability_blend: return GL_BLEND; | |
| 143 | //case gate_gl_api_capability_clip_plane: return GL_CLIP_PLANEi; | ||
| 144 | ✗ | case gate_gl_api_capability_color_logic_op: return GL_COLOR_LOGIC_OP; | |
| 145 | ✗ | case gate_gl_api_capability_color_material: return GL_COLOR_MATERIAL; | |
| 146 | ✗ | case gate_gl_api_capability_cull_face: return GL_CULL_FACE; | |
| 147 | ✗ | case gate_gl_api_capability_depth_test: return GL_DEPTH_TEST; | |
| 148 | ✗ | case gate_gl_api_capability_dither: return GL_DITHER; | |
| 149 | ✗ | case gate_gl_api_capability_fog: return GL_FOG; | |
| 150 | #if defined(GL_INDEX_LOGIC_OP) | ||
| 151 | ✗ | case gate_gl_api_capability_index_logic_op: return GL_INDEX_LOGIC_OP; | |
| 152 | #endif | ||
| 153 | //case gate_gl_api_capability_light: return GL_LIGHTi; | ||
| 154 | ✗ | case gate_gl_api_capability_lighting: return GL_LIGHTING; | |
| 155 | ✗ | case gate_gl_api_capability_line_smooth: return GL_LINE_SMOOTH; | |
| 156 | #if defined(GL_LINE_STIPPLE) | ||
| 157 | ✗ | case gate_gl_api_capability_line_stipple: return GL_LINE_STIPPLE; | |
| 158 | #endif | ||
| 159 | #if defined(GL_LOGIC_OP) | ||
| 160 | ✗ | case gate_gl_api_capability_logic_op: return GL_LOGIC_OP; | |
| 161 | #endif | ||
| 162 | #if defined(GL_MAP1_COLOR_4) | ||
| 163 | ✗ | case gate_gl_api_capability_map1_color_4: return GL_MAP1_COLOR_4; | |
| 164 | #endif | ||
| 165 | #if defined(GL_MAP1_INDEX) | ||
| 166 | ✗ | case gate_gl_api_capability_map1_index: return GL_MAP1_INDEX; | |
| 167 | #endif | ||
| 168 | #if defined(GL_MAP1_NORMAL) | ||
| 169 | ✗ | case gate_gl_api_capability_map1_normal: return GL_MAP1_NORMAL; | |
| 170 | #endif | ||
| 171 | #if defined(GL_MAP1_TEXTURE_COORD_1) | ||
| 172 | ✗ | case gate_gl_api_capability_map1_texture_coord_1: return GL_MAP1_TEXTURE_COORD_1; | |
| 173 | #endif | ||
| 174 | #if defined(GL_MAP1_TEXTURE_COORD_2) | ||
| 175 | ✗ | case gate_gl_api_capability_map1_texture_coord_2: return GL_MAP1_TEXTURE_COORD_2; | |
| 176 | #endif | ||
| 177 | #if defined(GL_MAP1_TEXTURE_COORD_3) | ||
| 178 | ✗ | case gate_gl_api_capability_map1_texture_coord_3: return GL_MAP1_TEXTURE_COORD_3; | |
| 179 | #endif | ||
| 180 | #if defined(GL_MAP1_TEXTURE_COORD_4) | ||
| 181 | ✗ | case gate_gl_api_capability_map1_texture_coord_4: return GL_MAP1_TEXTURE_COORD_4; | |
| 182 | #endif | ||
| 183 | #if defined(GL_MAP1_VERTEX_3) | ||
| 184 | ✗ | case gate_gl_api_capability_map1_vertex_3: return GL_MAP1_VERTEX_3; | |
| 185 | #endif | ||
| 186 | #if defined(GL_MAP1_VERTEX_4) | ||
| 187 | ✗ | case gate_gl_api_capability_map1_vertex_4: return GL_MAP1_VERTEX_4; | |
| 188 | #endif | ||
| 189 | #if defined(GL_MAP2_COLOR_4) | ||
| 190 | ✗ | case gate_gl_api_capability_map2_color_4: return GL_MAP2_COLOR_4; | |
| 191 | #endif | ||
| 192 | #if defined(GL_MAP2_INDEX) | ||
| 193 | ✗ | case gate_gl_api_capability_map2_index: return GL_MAP2_INDEX; | |
| 194 | #endif | ||
| 195 | #if defined(GL_MAP2_NORMAL) | ||
| 196 | ✗ | case gate_gl_api_capability_map2_normal: return GL_MAP2_NORMAL; | |
| 197 | #endif | ||
| 198 | #if defined(GL_MAP2_TEXTURE_COORD_1) | ||
| 199 | ✗ | case gate_gl_api_capability_map2_texture_coord_1: return GL_MAP2_TEXTURE_COORD_1; | |
| 200 | #endif | ||
| 201 | #if defined(GL_MAP2_TEXTURE_COORD_2) | ||
| 202 | ✗ | case gate_gl_api_capability_map2_texture_coord_2: return GL_MAP2_TEXTURE_COORD_2; | |
| 203 | #endif | ||
| 204 | #if defined(GL_MAP2_TEXTURE_COORD_3) | ||
| 205 | ✗ | case gate_gl_api_capability_map2_texture_coord_3: return GL_MAP2_TEXTURE_COORD_3; | |
| 206 | #endif | ||
| 207 | #if defined(GL_MAP2_TEXTURE_COORD_4) | ||
| 208 | ✗ | case gate_gl_api_capability_map2_texture_coord_4: return GL_MAP2_TEXTURE_COORD_4; | |
| 209 | #endif | ||
| 210 | #if defined(GL_MAP2_VERTEX_3) | ||
| 211 | ✗ | case gate_gl_api_capability_map2_vertex_3: return GL_MAP2_VERTEX_3; | |
| 212 | #endif | ||
| 213 | #if defined(GL_MAP2_VERTEX_4) | ||
| 214 | ✗ | case gate_gl_api_capability_map2_vertex_4: return GL_MAP2_VERTEX_4; | |
| 215 | #endif | ||
| 216 | ✗ | case gate_gl_api_capability_normalize: return GL_NORMALIZE; | |
| 217 | ✗ | case gate_gl_api_capability_point_smooth: return GL_POINT_SMOOTH; | |
| 218 | ✗ | case gate_gl_api_capability_polygon_offset_fill: return GL_POLYGON_OFFSET_FILL; | |
| 219 | #if defined(GL_POLYGON_OFFSET_LINE) | ||
| 220 | ✗ | case gate_gl_api_capability_polygon_offset_line: return GL_POLYGON_OFFSET_LINE; | |
| 221 | #endif | ||
| 222 | #if defined(GL_POLYGON_OFFSET_POINT) | ||
| 223 | ✗ | case gate_gl_api_capability_polygon_offset_point: return GL_POLYGON_OFFSET_POINT; | |
| 224 | #endif | ||
| 225 | #if defined(GL_POLYGON_SMOOTH) | ||
| 226 | ✗ | case gate_gl_api_capability_polygon_smooth: return GL_POLYGON_SMOOTH; | |
| 227 | #endif | ||
| 228 | #if defined(GL_POLYGON_STIPPLE) | ||
| 229 | ✗ | case gate_gl_api_capability_polygon_stipple: return GL_POLYGON_STIPPLE; | |
| 230 | #endif | ||
| 231 | ✗ | case gate_gl_api_capability_scissor_test: return GL_SCISSOR_TEST; | |
| 232 | ✗ | case gate_gl_api_capability_stencil_test: return GL_STENCIL_TEST; | |
| 233 | #if defined(GL_TEXTURE_1D) | ||
| 234 | ✗ | case gate_gl_api_capability_texture_1d: return GL_TEXTURE_1D; | |
| 235 | #endif | ||
| 236 | ✗ | case gate_gl_api_capability_texture_2d: return GL_TEXTURE_2D; | |
| 237 | #if defined(GL_TEXTURE_GEN_Q) | ||
| 238 | ✗ | case gate_gl_api_capability_texture_gen_q: return GL_TEXTURE_GEN_Q; | |
| 239 | #endif | ||
| 240 | #if defined(GL_TEXTURE_GEN_R) | ||
| 241 | ✗ | case gate_gl_api_capability_texture_gen_r: return GL_TEXTURE_GEN_R; | |
| 242 | #endif | ||
| 243 | #if defined(GL_TEXTURE_GEN_S) | ||
| 244 | ✗ | case gate_gl_api_capability_texture_gen_s: return GL_TEXTURE_GEN_S; | |
| 245 | #endif | ||
| 246 | #if defined(GL_TEXTURE_GEN_T) | ||
| 247 | ✗ | case gate_gl_api_capability_texture_gen_t: return GL_TEXTURE_GEN_T; | |
| 248 | #endif | ||
| 249 | ✗ | default: return 0; | |
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 253 | |||
| 254 | ✗ | void gate_gl_api_enable(gate_gl_api_capability_t capability) | |
| 255 | { | ||
| 256 | ✗ | gate_gl_api.glEnable(translate_capability(capability)); | |
| 257 | ✗ | } | |
| 258 | |||
| 259 | ✗ | void gate_gl_api_disable(gate_gl_api_capability_t capability) | |
| 260 | { | ||
| 261 | ✗ | gate_gl_api.glDisable(translate_capability(capability)); | |
| 262 | ✗ | } | |
| 263 | |||
| 264 | ✗ | void gate_gl_api_depthfunc(gate_gl_api_depth_t depth_function) | |
| 265 | { | ||
| 266 | ✗ | GLenum value = 0; | |
| 267 | ✗ | switch (depth_function) | |
| 268 | { | ||
| 269 | ✗ | case gate_gl_api_depth_never: value = GL_NEVER; break; | |
| 270 | ✗ | case gate_gl_api_depth_less: value = GL_LESS; break; | |
| 271 | ✗ | case gate_gl_api_depth_lequal: value = GL_LEQUAL; break; | |
| 272 | ✗ | case gate_gl_api_depth_equal: value = GL_EQUAL; break; | |
| 273 | ✗ | case gate_gl_api_depth_greater: value = GL_GREATER; break; | |
| 274 | ✗ | case gate_gl_api_depth_notequal:value = GL_NOTEQUAL;break; | |
| 275 | ✗ | case gate_gl_api_depth_gequal: value = GL_GEQUAL; break; | |
| 276 | ✗ | case gate_gl_api_depth_always: value = GL_ALWAYS; break; | |
| 277 | } | ||
| 278 | ✗ | gate_gl_api.glDepthFunc(value); | |
| 279 | ✗ | } | |
| 280 | |||
| 281 | ✗ | void gate_gl_api_depthmask(gate_bool_t enabled) | |
| 282 | { | ||
| 283 | ✗ | gate_gl_api.glDepthMask(enabled ? GL_TRUE : GL_FALSE); | |
| 284 | ✗ | } | |
| 285 | |||
| 286 | ✗ | void gate_gl_api_hint(gate_gl_api_hint_t hint_type, gate_gl_api_hintmode_t hint_mode) | |
| 287 | { | ||
| 288 | ✗ | GLenum ht = 0, hm = 0; | |
| 289 | ✗ | switch (hint_type) | |
| 290 | { | ||
| 291 | ✗ | case gate_gl_api_hint_fog_hint: ht = GL_FOG_HINT; break; | |
| 292 | ✗ | case gate_gl_api_hint_line_smooth_hint: ht = GL_LINE_SMOOTH_HINT; break; | |
| 293 | ✗ | case gate_gl_api_hint_perspective_correction_hint: ht = GL_PERSPECTIVE_CORRECTION_HINT;break; | |
| 294 | ✗ | case gate_gl_api_hint_point_smooth_hint: ht = GL_POINT_SMOOTH_HINT; break; | |
| 295 | #if defined(GL_POLYGON_SMOOTH_HINT) | ||
| 296 | ✗ | case gate_gl_api_hint_polygon_smooth_hint: ht = GL_POLYGON_SMOOTH_HINT; break; | |
| 297 | #endif | ||
| 298 | ✗ | default: ht = 0; break; | |
| 299 | } | ||
| 300 | |||
| 301 | ✗ | switch (hint_mode) | |
| 302 | { | ||
| 303 | ✗ | case gate_gl_api_hintmode_fastest: hm = GL_FASTEST; break; | |
| 304 | ✗ | case gate_gl_api_hintmode_nicest: hm = GL_NICEST; break; | |
| 305 | ✗ | case gate_gl_api_hintmode_dont_care: hm = GL_DONT_CARE; break; | |
| 306 | } | ||
| 307 | |||
| 308 | ✗ | gate_gl_api.glHint(ht, hm); | |
| 309 | ✗ | } | |
| 310 | |||
| 311 | ✗ | void gate_gl_api_viewport(gate_int32_t x, gate_int32_t y, gate_int32_t width, gate_int32_t height) | |
| 312 | { | ||
| 313 | ✗ | gate_gl_api.glViewport(x, y, width, height); | |
| 314 | ✗ | } | |
| 315 | |||
| 316 | ✗ | void gate_gl_api_matrixmode(gate_gl_api_matrixmode_t matrix_mode) | |
| 317 | { | ||
| 318 | ✗ | GLenum mm = 0; | |
| 319 | ✗ | switch (matrix_mode) | |
| 320 | { | ||
| 321 | ✗ | case gate_gl_api_matrixmode_modelview: mm = GL_MODELVIEW; break; | |
| 322 | ✗ | case gate_gl_api_matrixmode_projection: mm = GL_PROJECTION; break; | |
| 323 | ✗ | case gate_gl_api_matrixmode_texture: mm = GL_TEXTURE; break; | |
| 324 | } | ||
| 325 | ✗ | gate_gl_api.glMatrixMode(mm); | |
| 326 | ✗ | } | |
| 327 | |||
| 328 | ✗ | void gate_gl_api_loadidentity() | |
| 329 | { | ||
| 330 | ✗ | gate_gl_api.glLoadIdentity(); | |
| 331 | ✗ | } | |
| 332 | |||
| 333 | ✗ | void gate_gl_api_multmatrix(gate_real32_t const matrix[16]) | |
| 334 | { | ||
| 335 | ✗ | gate_gl_api.glMultMatrixf(matrix); | |
| 336 | ✗ | } | |
| 337 | |||
| 338 | ✗ | void gate_gl_api_translate(gate_real32_t x, gate_real32_t y, gate_real32_t z) | |
| 339 | { | ||
| 340 | ✗ | gate_gl_api.glTranslatef(x, y, z); | |
| 341 | ✗ | } | |
| 342 | |||
| 343 | ✗ | void gate_gl_api_rotate(gate_real32_t angle, gate_real32_t x, gate_real32_t y, gate_real32_t z) | |
| 344 | { | ||
| 345 | ✗ | gate_gl_api.glRotatef(angle, x, y, z); | |
| 346 | ✗ | } | |
| 347 | |||
| 348 | |||
| 349 | ✗ | void gate_gl_api_flush() | |
| 350 | { | ||
| 351 | ✗ | gate_gl_api.glFlush(); | |
| 352 | ✗ | } | |
| 353 | |||
| 354 | ✗ | void gate_gl_api_finish() | |
| 355 | { | ||
| 356 | ✗ | gate_gl_api.glFinish(); | |
| 357 | ✗ | } | |
| 358 | |||
| 359 | ✗ | void gate_gl_api_clear(unsigned clear_bits) | |
| 360 | { | ||
| 361 | ✗ | GLbitfield bf = 0; | |
| 362 | |||
| 363 | ✗ | if (clear_bits & gate_gl_api_clearbit_color_buffer_bit) | |
| 364 | { | ||
| 365 | ✗ | bf |= GL_COLOR_BUFFER_BIT; | |
| 366 | } | ||
| 367 | ✗ | if (clear_bits & gate_gl_api_clearbit_depth_buffer_bit) | |
| 368 | { | ||
| 369 | ✗ | bf |= GL_DEPTH_BUFFER_BIT; | |
| 370 | } | ||
| 371 | ✗ | if (clear_bits & gate_gl_api_clearbit_accum_buffer_bit) | |
| 372 | { | ||
| 373 | #if defined(GL_ACCUM_BUFFER_BIT) | ||
| 374 | ✗ | bf |= GL_ACCUM_BUFFER_BIT; | |
| 375 | #endif | ||
| 376 | } | ||
| 377 | ✗ | if (clear_bits & gate_gl_api_clearbit_stencil_buffer_bit) | |
| 378 | { | ||
| 379 | ✗ | bf |= GL_STENCIL_BUFFER_BIT; | |
| 380 | } | ||
| 381 | ✗ | gate_gl_api.glClear(bf); | |
| 382 | ✗ | } | |
| 383 | |||
| 384 | ✗ | void gate_gl_api_perspective(gate_real32_t fovy, gate_real32_t aspect, gate_real32_t znear, gate_real32_t zfar) | |
| 385 | { | ||
| 386 | ✗ | gate_real32_t f = (gate_real32_t)(1.0 / gate_math_tan(gate_math_deg2rad(fovy) / 2.0)); | |
| 387 | ✗ | GLfloat a = f / aspect; | |
| 388 | GLfloat m[16]; | ||
| 389 | ✗ | m[0] = a; m[1] = 0; m[2] = 0; m[3] = 0; | |
| 390 | ✗ | m[4] = 0; m[5] = f; m[6] = 0; m[7] = 0; | |
| 391 | ✗ | m[8] = 0; m[9] = 0; m[10] = (zfar + znear) / (znear - zfar); m[11] = -1.0f; | |
| 392 | ✗ | m[12] = 0; m[13] = 0; m[14] = (2.0f * zfar * znear) / (znear - zfar); m[15] = 0; | |
| 393 | ✗ | gate_gl_api.glMultMatrixf(m); | |
| 394 | ✗ | } | |
| 395 | |||
| 396 | |||
| 397 | ✗ | static void math_cross_prod(float x1, float y1, float z1, float x2, float y2, float z2, float res[3]) | |
| 398 | { | ||
| 399 | ✗ | res[0] = y1 * z2 - y2 * z1; | |
| 400 | ✗ | res[1] = x2 * z1 - x1 * z2; | |
| 401 | ✗ | res[2] = x1 * y2 - x2 * y1; | |
| 402 | ✗ | } | |
| 403 | |||
| 404 | /* https://www.khronos.org/message_boards/showthread.php/4991-The-Solution-for-gluLookAt%28%29-Function!!!! */ | ||
| 405 | /* https://community.khronos.org/t/the-solution-for-glulookat-function/521 */ | ||
| 406 | |||
| 407 | ✗ | static double square(double const arg) | |
| 408 | { | ||
| 409 | ✗ | return arg * arg; | |
| 410 | } | ||
| 411 | |||
| 412 | |||
| 413 | ✗ | void gate_gl_api_lookat(gate_real32_t eyeX, gate_real32_t eyeY, gate_real32_t eyeZ, | |
| 414 | gate_real32_t lookX, gate_real32_t lookY, gate_real32_t lookZ, | ||
| 415 | gate_real32_t upX, gate_real32_t upY, gate_real32_t upZ) | ||
| 416 | { | ||
| 417 | float f[3]; | ||
| 418 | float fMag; | ||
| 419 | float upMag; | ||
| 420 | float s[3], u[3]; | ||
| 421 | float M[16]; | ||
| 422 | |||
| 423 | |||
| 424 | ✗ | f[0] = lookX - eyeX; | |
| 425 | ✗ | f[1] = lookY - eyeY; | |
| 426 | ✗ | f[2] = lookZ - eyeZ; | |
| 427 | |||
| 428 | ✗ | fMag = (float)gate_math_sqrt(square(f[0]) + square(f[1]) + square(f[2])); | |
| 429 | ✗ | upMag = (float)gate_math_sqrt(square(upX) + square(upY) + square(upZ)); | |
| 430 | |||
| 431 | ✗ | if (fMag != 0) | |
| 432 | { | ||
| 433 | ✗ | f[0] = f[0] / fMag; | |
| 434 | ✗ | f[1] = f[1] / fMag; | |
| 435 | ✗ | f[2] = f[2] / fMag; | |
| 436 | } | ||
| 437 | |||
| 438 | ✗ | if (upMag != 0) | |
| 439 | { | ||
| 440 | ✗ | upX = upX / upMag; | |
| 441 | ✗ | upY = upY / upMag; | |
| 442 | ✗ | upZ = upZ / upMag; | |
| 443 | } | ||
| 444 | |||
| 445 | ✗ | math_cross_prod(f[0], f[1], f[2], upX, upY, upZ, s); | |
| 446 | ✗ | math_cross_prod(s[0], s[1], s[2], f[0], f[1], f[2], u); | |
| 447 | |||
| 448 | ✗ | M[0] = s[0]; M[1] = u[0]; M[2] = -f[0]; M[3] = 0; | |
| 449 | ✗ | M[4] = s[1]; M[5] = u[1]; M[6] = -f[1]; M[7] = 0; | |
| 450 | ✗ | M[8] = s[2]; M[9] = u[2]; M[10] = -f[2]; M[11] = 0; | |
| 451 | ✗ | M[12] = 0; M[13] = 0; M[14] = 0; M[15] = 1; | |
| 452 | |||
| 453 | ✗ | gate_gl_api.glMultMatrixf(M); | |
| 454 | ✗ | gate_gl_api.glTranslatef(-eyeX, -eyeY, -eyeZ); | |
| 455 | ✗ | } | |
| 456 | |||
| 457 | ✗ | 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) | |
| 458 | { | ||
| 459 | ✗ | gate_gl_api.glOrtho(left, right, bottom, top, near_val, far_val); | |
| 460 | ✗ | } | |
| 461 | |||
| 462 | |||
| 463 | ✗ | static GLenum translate_clientstate(gate_gl_api_clientstate_t client_state) | |
| 464 | { | ||
| 465 | ✗ | switch (client_state) | |
| 466 | { | ||
| 467 | ✗ | case gate_gl_api_clientstate_color_array: return GL_COLOR_ARRAY; | |
| 468 | #if defined(GL_EDGE_FLAG_ARRAY) | ||
| 469 | ✗ | case gate_gl_api_clientstate_edge_flag_array: return GL_EDGE_FLAG_ARRAY; | |
| 470 | #endif | ||
| 471 | #if defined(GL_INDEX_ARRAY) | ||
| 472 | ✗ | case gate_gl_api_clientstate_index_array: return GL_INDEX_ARRAY; | |
| 473 | #endif | ||
| 474 | ✗ | case gate_gl_api_clientstate_normal_array: return GL_NORMAL_ARRAY; | |
| 475 | ✗ | case gate_gl_api_clientstate_texture_coord_array: return GL_TEXTURE_COORD_ARRAY; | |
| 476 | ✗ | case gate_gl_api_clientstate_vertex_array: return GL_VERTEX_ARRAY; | |
| 477 | ✗ | default: return 0; | |
| 478 | } | ||
| 479 | } | ||
| 480 | |||
| 481 | ✗ | void gate_gl_api_enableclientstate(gate_gl_api_clientstate_t state) | |
| 482 | { | ||
| 483 | ✗ | gate_gl_api.glEnableClientState(translate_clientstate(state)); | |
| 484 | ✗ | } | |
| 485 | |||
| 486 | ✗ | void gate_gl_api_disableclientstate(gate_gl_api_clientstate_t state) | |
| 487 | { | ||
| 488 | ✗ | gate_gl_api.glDisableClientState(translate_clientstate(state)); | |
| 489 | ✗ | } | |
| 490 | |||
| 491 | ✗ | static GLenum translate_draw_mode(gate_gl_api_drawmode_t draw_mode) | |
| 492 | { | ||
| 493 | ✗ | GLenum ret = 0; | |
| 494 | ✗ | switch (draw_mode) | |
| 495 | { | ||
| 496 | ✗ | case gate_gl_api_drawmode_points: ret = GL_POINTS; break; | |
| 497 | ✗ | case gate_gl_api_drawmode_lines: ret = GL_LINES; break; | |
| 498 | ✗ | case gate_gl_api_drawmode_line_loop: ret = GL_LINE_LOOP; break; | |
| 499 | ✗ | case gate_gl_api_drawmode_line_strip: ret = GL_LINE_STRIP; break; | |
| 500 | ✗ | case gate_gl_api_drawmode_triangles: ret = GL_TRIANGLES; break; | |
| 501 | ✗ | case gate_gl_api_drawmode_triangle_strip: ret = GL_TRIANGLE_STRIP; break; | |
| 502 | ✗ | case gate_gl_api_drawmode_triangle_fan: ret = GL_TRIANGLE_FAN; break; | |
| 503 | #if defined(GL_QUADS) | ||
| 504 | ✗ | case gate_gl_api_drawmode_quads: ret = GL_QUADS; break; | |
| 505 | #endif | ||
| 506 | #if defined(GL_QUAD_STRIP) | ||
| 507 | ✗ | case gate_gl_api_drawmode_quad_strip: ret = GL_QUAD_STRIP; break; | |
| 508 | #endif | ||
| 509 | #if defined(GL_POLYGON) | ||
| 510 | ✗ | case gate_gl_api_drawmode_polygon: ret = GL_POLYGON; break; | |
| 511 | #endif | ||
| 512 | ✗ | default: ret = 0; break; | |
| 513 | } | ||
| 514 | ✗ | return ret; | |
| 515 | } | ||
| 516 | |||
| 517 | ✗ | void gate_gl_api_drawarrays(gate_gl_api_drawmode_t draw_mode, int index, size_t count) | |
| 518 | { | ||
| 519 | ✗ | gate_gl_api.glDrawArrays(translate_draw_mode(draw_mode), (GLint)index, (GLsizei)count); | |
| 520 | ✗ | } | |
| 521 | |||
| 522 | ✗ | void* gate_gl_api_createtexture(gate_gl_api_pixelformat_t pixel_format, | |
| 523 | gate_uint32_t width, gate_uint32_t height, void const* data) | ||
| 524 | { | ||
| 525 | GLenum format; | ||
| 526 | GLenum datatype; | ||
| 527 | GLuint tex; | ||
| 528 | ✗ | GLenum paramFilter = GL_LINEAR; | |
| 529 | ✗ | GLint internalFormat = | |
| 530 | #if defined(GL_RGBA8) | ||
| 531 | GL_RGBA8; | ||
| 532 | #elif defined(GL_RGB8) | ||
| 533 | GL_RGB8; | ||
| 534 | #else | ||
| 535 | GL_RGBA; | ||
| 536 | #endif | ||
| 537 | |||
| 538 | ✗ | switch (pixel_format) | |
| 539 | { | ||
| 540 | ✗ | case gate_gl_api_pixelformat_rgb: | |
| 541 | { | ||
| 542 | ✗ | format = GL_RGB; | |
| 543 | ✗ | datatype = GL_UNSIGNED_BYTE; | |
| 544 | ✗ | break; | |
| 545 | } | ||
| 546 | ✗ | case gate_gl_api_pixelformat_rgba: | |
| 547 | { | ||
| 548 | ✗ | format = GL_RGBA; | |
| 549 | ✗ | datatype = GL_UNSIGNED_BYTE; | |
| 550 | ✗ | break; | |
| 551 | } | ||
| 552 | ✗ | default: | |
| 553 | { | ||
| 554 | /* not supported */ | ||
| 555 | ✗ | return 0; | |
| 556 | } | ||
| 557 | } | ||
| 558 | |||
| 559 | ✗ | gate_gl_api.glEnable(GL_TEXTURE_2D); | |
| 560 | ✗ | gate_gl_api.glGenTextures(1, &tex); | |
| 561 | ✗ | gate_gl_api.glBindTexture(GL_TEXTURE_2D, tex); | |
| 562 | |||
| 563 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, paramFilter); | |
| 564 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, paramFilter); | |
| 565 | |||
| 566 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); | |
| 567 | ✗ | gate_gl_api.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); | |
| 568 | |||
| 569 | ✗ | gate_gl_api.glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, datatype, data); | |
| 570 | ✗ | gate_gl_api.glDisable(GL_TEXTURE_2D); | |
| 571 | |||
| 572 | ✗ | return (void*)(gate_uintptr_t)(tex); | |
| 573 | } | ||
| 574 | |||
| 575 | ✗ | void gate_gl_api_deletetexture(void* texture_id) | |
| 576 | { | ||
| 577 | ✗ | GLuint tex = (GLuint)(gate_uintptr_t)(texture_id); | |
| 578 | ✗ | gate_gl_api.glDeleteTextures(1, &tex); | |
| 579 | ✗ | } | |
| 580 | |||
| 581 | ✗ | void gate_gl_api_bindtexture(void* texture_id) | |
| 582 | { | ||
| 583 | ✗ | GLuint tex = (GLuint)(gate_uintptr_t)texture_id; | |
| 584 | ✗ | gate_gl_api.glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); | |
| 585 | ✗ | gate_gl_api.glBindTexture(GL_TEXTURE_2D, tex); | |
| 586 | ✗ | } | |
| 587 | |||
| 588 | ✗ | void gate_gl_api_cullface(gate_gl_api_cullface_t mode) | |
| 589 | { | ||
| 590 | ✗ | GLenum value = GL_FRONT_AND_BACK; | |
| 591 | ✗ | switch (mode) | |
| 592 | { | ||
| 593 | ✗ | case gate_gl_api_cullface_front: value = GL_FRONT; break; | |
| 594 | ✗ | case gate_gl_api_cullface_back: value = GL_BACK; break; | |
| 595 | ✗ | case gate_gl_api_cullface_front_and_back: value = GL_FRONT_AND_BACK; break; | |
| 596 | } | ||
| 597 | ✗ | gate_gl_api.glCullFace(value); | |
| 598 | ✗ | } | |
| 599 | |||
| 600 | |||
| 601 | |||
| 602 | #if defined(GATE_GL_API_WINAPI) | ||
| 603 | |||
| 604 | #include "gate/graphics/platform/opengl_winapi_impl.h" | ||
| 605 | |||
| 606 | #endif /* GATE_GL_API_WINAPI */ | ||
| 607 | |||
| 608 | |||
| 609 | |||
| 610 | #if defined(GATE_GL_API_GLUT) | ||
| 611 | |||
| 612 | #include "gate/graphics/platform/opengl_glut_impl.h" | ||
| 613 | |||
| 614 | #endif /* GATE_GL_API_GLUT */ | ||
| 615 | |||
| 616 | |||
| 617 | |||
| 618 | #if defined(GATE_GL_API_EGL) | ||
| 619 | |||
| 620 | # include "gate/graphics/platform/opengl_egl_apis.h" | ||
| 621 | |||
| 622 | # if defined(GATE_SYS_WINCE) | ||
| 623 | # elif defined(GATE_SYS_WASM) | ||
| 624 | # include "gate/graphics/platform/opengl_emscripten_impl.h" | ||
| 625 | # elif defined(GATE_SYS_ANDROID) | ||
| 626 | # include "gate/graphics/platform/opengl_android_impl.h" | ||
| 627 | # else | ||
| 628 | # include "gate/graphics/platform/opengl_xlib_impl.h" | ||
| 629 | # endif | ||
| 630 | |||
| 631 | #endif /* GATE_GL_API_EGL */ | ||
| 632 | |||
| 633 | |||
| 634 | #endif /* GATE_GRAPHICS_GL_OPENGL */ | ||
| 635 | |||
| 636 | |||
| 637 | |||
| 638 | #if defined(GATE_GARPHICS_GL_NOIMPL) | ||
| 639 | |||
| 640 | |||
| 641 | gate_result_t gate_gl_surface_init(gate_gl_surface_t* surface) | ||
| 642 | { | ||
| 643 | (void)surface; | ||
| 644 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 645 | } | ||
| 646 | gate_result_t gate_gl_surface_uninit(gate_gl_surface_t* surface) | ||
| 647 | { | ||
| 648 | (void)surface; | ||
| 649 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 650 | } | ||
| 651 | gate_result_t gate_gl_surface_open(gate_gl_surface_t* surface, gate_gl_surface_type_t type, | ||
| 652 | gate_uint32_t width, gate_uint32_t height, gate_enumint_t flags) | ||
| 653 | { | ||
| 654 | (void)surface; | ||
| 655 | (void)type; | ||
| 656 | (void)width; | ||
| 657 | (void)height; | ||
| 658 | (void)flags; | ||
| 659 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 660 | } | ||
| 661 | gate_result_t gate_gl_surface_close(gate_gl_surface_t* surface) | ||
| 662 | { | ||
| 663 | (void)surface; | ||
| 664 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 665 | } | ||
| 666 | gate_result_t gate_gl_surface_resize(gate_gl_surface_t* surface, gate_uint32_t width, gate_uint32_t height) | ||
| 667 | { | ||
| 668 | (void)surface; | ||
| 669 | (void)width; | ||
| 670 | (void)height; | ||
| 671 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 672 | } | ||
| 673 | gate_result_t gate_gl_surface_get_size(gate_gl_surface_t* surface, gate_uint32_t* width, gate_uint32_t* height) | ||
| 674 | { | ||
| 675 | (void)surface; | ||
| 676 | (void)width; | ||
| 677 | (void)height; | ||
| 678 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 679 | } | ||
| 680 | gate_result_t gate_gl_surface_print_image(gate_gl_surface_t* surface, gate_rasterimage_t* target_image) | ||
| 681 | { | ||
| 682 | (void)surface; | ||
| 683 | (void)target_image; | ||
| 684 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 685 | } | ||
| 686 | gate_result_t gate_gl_surface_run_event_loop(gate_gl_surface_t* surface, | ||
| 687 | gate_gl_surface_events_t* event_callbacks, void* user_param) | ||
| 688 | { | ||
| 689 | (void)surface; | ||
| 690 | (void)event_callbacks; | ||
| 691 | (void)user_param; | ||
| 692 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 693 | } | ||
| 694 | gate_result_t gate_gl_surface_exit_event_loop(gate_gl_surface_t* surface) | ||
| 695 | { | ||
| 696 | (void)surface; | ||
| 697 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 698 | } | ||
| 699 | gate_result_t gate_gl_surface_swap_buffers(gate_gl_surface_t* surface) | ||
| 700 | { | ||
| 701 | (void)surface; | ||
| 702 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 703 | } | ||
| 704 | |||
| 705 | |||
| 706 | |||
| 707 | gate_result_t gate_gl_api_init() | ||
| 708 | { | ||
| 709 | return GATE_RESULT_NOTIMPLEMENTED; | ||
| 710 | } | ||
| 711 | |||
| 712 | void gate_gl_api_color3(gate_real32_t r, gate_real32_t g, gate_real32_t b) | ||
| 713 | { | ||
| 714 | (void)r; | ||
| 715 | (void)g; | ||
| 716 | (void)b; | ||
| 717 | } | ||
| 718 | void gate_gl_api_color4(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | ||
| 719 | { | ||
| 720 | (void)r; | ||
| 721 | (void)g; | ||
| 722 | (void)b; | ||
| 723 | (void)a; | ||
| 724 | } | ||
| 725 | void gate_gl_api_color3b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b) | ||
| 726 | { | ||
| 727 | (void)r; | ||
| 728 | (void)g; | ||
| 729 | (void)b; | ||
| 730 | } | ||
| 731 | void gate_gl_api_color4b(gate_uint8_t r, gate_uint8_t g, gate_uint8_t b, gate_uint8_t a) | ||
| 732 | { | ||
| 733 | (void)r; | ||
| 734 | (void)g; | ||
| 735 | (void)b; | ||
| 736 | (void)a; | ||
| 737 | } | ||
| 738 | void gate_gl_api_vertexpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | ||
| 739 | { | ||
| 740 | (void)coord_count; | ||
| 741 | (void)ptr_coords; | ||
| 742 | } | ||
| 743 | void gate_gl_api_texcoordpointer(gate_size_t coord_count, gate_real32_t const* ptr_coords) | ||
| 744 | { | ||
| 745 | (void)coord_count; | ||
| 746 | (void)ptr_coords; | ||
| 747 | } | ||
| 748 | void gate_gl_api_shademodel(gate_gl_api_shademodel_t model) | ||
| 749 | { | ||
| 750 | (void)model; | ||
| 751 | } | ||
| 752 | void gate_gl_api_blendfunc(gate_gl_api_blend_t blend_func_src, gate_gl_api_blend_t blend_func_dst) | ||
| 753 | { | ||
| 754 | (void)blend_func_src; | ||
| 755 | (void)blend_func_dst; | ||
| 756 | } | ||
| 757 | void gate_gl_api_clearcolor(gate_real32_t r, gate_real32_t g, gate_real32_t b, gate_real32_t a) | ||
| 758 | { | ||
| 759 | (void)r; | ||
| 760 | (void)g; | ||
| 761 | (void)b; | ||
| 762 | (void)a; | ||
| 763 | } | ||
| 764 | void gate_gl_api_cleardepth(gate_real32_t depth) | ||
| 765 | { | ||
| 766 | (void)depth; | ||
| 767 | } | ||
| 768 | void gate_gl_api_enable(gate_gl_api_capability_t capability) | ||
| 769 | { | ||
| 770 | (void)capability; | ||
| 771 | } | ||
| 772 | void gate_gl_api_disable(gate_gl_api_capability_t capability) | ||
| 773 | { | ||
| 774 | (void)capability; | ||
| 775 | } | ||
| 776 | void gate_gl_api_depthfunc(gate_gl_api_depth_t depth_function) | ||
| 777 | { | ||
| 778 | (void)depth_function; | ||
| 779 | } | ||
| 780 | void gate_gl_api_depthmask(gate_bool_t enabled) | ||
| 781 | { | ||
| 782 | (void)enabled; | ||
| 783 | } | ||
| 784 | void gate_gl_api_hint(gate_gl_api_hint_t hint_type, gate_gl_api_hintmode_t hint_mode) | ||
| 785 | { | ||
| 786 | (void)hint_type; | ||
| 787 | (void)hint_mode; | ||
| 788 | } | ||
| 789 | void gate_gl_api_viewport(gate_int32_t x, gate_int32_t y, gate_int32_t width, gate_int32_t height) | ||
| 790 | { | ||
| 791 | (void)x; | ||
| 792 | (void)y; | ||
| 793 | (void)width; | ||
| 794 | (void)height; | ||
| 795 | } | ||
| 796 | void gate_gl_api_matrixmode(gate_gl_api_matrixmode_t matrix_mode) | ||
| 797 | { | ||
| 798 | (void)matrix_mode; | ||
| 799 | } | ||
| 800 | void gate_gl_api_loadidentity() | ||
| 801 | { | ||
| 802 | } | ||
| 803 | void gate_gl_api_multmatrix(gate_real32_t const matrix[16]) | ||
| 804 | { | ||
| 805 | (void)matrix; | ||
| 806 | } | ||
| 807 | void gate_gl_api_translate(gate_real32_t x, gate_real32_t y, gate_real32_t z) | ||
| 808 | { | ||
| 809 | (void)x; | ||
| 810 | (void)y; | ||
| 811 | (void)z; | ||
| 812 | } | ||
| 813 | void gate_gl_api_rotate(gate_real32_t angle, gate_real32_t x, gate_real32_t y, gate_real32_t z) | ||
| 814 | { | ||
| 815 | (void)angle; | ||
| 816 | (void)x; | ||
| 817 | (void)y; | ||
| 818 | (void)z; | ||
| 819 | } | ||
| 820 | void gate_gl_api_flush() | ||
| 821 | { | ||
| 822 | |||
| 823 | } | ||
| 824 | void gate_gl_api_finish() | ||
| 825 | { | ||
| 826 | |||
| 827 | } | ||
| 828 | void gate_gl_api_clear(unsigned clear_bits) | ||
| 829 | { | ||
| 830 | (void)clear_bits; | ||
| 831 | } | ||
| 832 | void gate_gl_api_perspective(gate_real32_t fovy, gate_real32_t aspect, gate_real32_t znear, gate_real32_t zfar) | ||
| 833 | { | ||
| 834 | (void)fovy; | ||
| 835 | (void)aspect; | ||
| 836 | (void)znear; | ||
| 837 | (void)zfar; | ||
| 838 | } | ||
| 839 | void gate_gl_api_lookat(gate_real32_t eyeX, gate_real32_t eyeY, gate_real32_t eyeZ, | ||
| 840 | gate_real32_t lookX, gate_real32_t lookY, gate_real32_t lookZ, | ||
| 841 | gate_real32_t upX, gate_real32_t upY, gate_real32_t upZ) | ||
| 842 | { | ||
| 843 | (void)eyeX; | ||
| 844 | (void)eyeY; | ||
| 845 | (void)eyeZ; | ||
| 846 | (void)lookX; | ||
| 847 | (void)lookY; | ||
| 848 | (void)lookZ; | ||
| 849 | (void)upX; | ||
| 850 | (void)upY; | ||
| 851 | (void)upZ; | ||
| 852 | } | ||
| 853 | void gate_gl_api_ortho(gate_real32_t left, gate_real32_t right, gate_real32_t bottom, gate_real32_t top, | ||
| 854 | gate_real32_t near_val, gate_real32_t far_val) | ||
| 855 | { | ||
| 856 | (void)left; | ||
| 857 | (void)right; | ||
| 858 | (void)bottom; | ||
| 859 | (void)top; | ||
| 860 | (void)near_val; | ||
| 861 | (void)far_val; | ||
| 862 | } | ||
| 863 | void gate_gl_api_enableclientstate(gate_gl_api_clientstate_t state) | ||
| 864 | { | ||
| 865 | (void)state; | ||
| 866 | } | ||
| 867 | void gate_gl_api_disableclientstate(gate_gl_api_clientstate_t state) | ||
| 868 | { | ||
| 869 | (void)state; | ||
| 870 | } | ||
| 871 | void gate_gl_api_drawarrays(gate_gl_api_drawmode_t draw_mode, int index, size_t count) | ||
| 872 | { | ||
| 873 | (void)draw_mode; | ||
| 874 | (void)index; | ||
| 875 | (void)count; | ||
| 876 | } | ||
| 877 | void* gate_gl_api_createtexture(gate_gl_api_pixelformat_t pixel_format, gate_uint32_t width, gate_uint32_t height, | ||
| 878 | void const* data) | ||
| 879 | { | ||
| 880 | (void)pixel_format; | ||
| 881 | (void)width; | ||
| 882 | (void)height; | ||
| 883 | (void)data; | ||
| 884 | return NULL; | ||
| 885 | } | ||
| 886 | void gate_gl_api_deletetexture(void* texture_id) | ||
| 887 | { | ||
| 888 | (void)texture_id; | ||
| 889 | } | ||
| 890 | void gate_gl_api_bindtexture(void* texture_id) | ||
| 891 | { | ||
| 892 | (void)texture_id; | ||
| 893 | } | ||
| 894 | void gate_gl_api_cullface(gate_gl_api_cullface_t mode) | ||
| 895 | { | ||
| 896 | (void)mode; | ||
| 897 | } | ||
| 898 | |||
| 899 | #endif /* GATE_GRAPHICS_GL_OPENGL */ | ||
| 900 | |||
| 901 |