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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
|
/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
* Copyright (c) 2021-2022, Jelle Raaijmakers <jelle@gmta.nl>
* Copyright (c) 2021-2022, Jesse Buhagiar <jooster669@gmail.com>
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Array.h>
#include <AK/Debug.h>
#include <LibGL/GL/gl.h>
#include <LibGL/GLContext.h>
extern GL::GLContext* g_gl_context;
// Transposes input matrices (column-major) to our Matrix (row-major).
template<typename I, typename O>
static constexpr Matrix4x4<O> transpose_input_matrix(I const* matrix)
{
if constexpr (IsSame<I, O>) {
// clang-format off
return {
matrix[0], matrix[4], matrix[8], matrix[12],
matrix[1], matrix[5], matrix[9], matrix[13],
matrix[2], matrix[6], matrix[10], matrix[14],
matrix[3], matrix[7], matrix[11], matrix[15],
};
// clang-format on
}
Array<O, 16> elements;
for (size_t i = 0; i < 16; ++i)
elements[i] = static_cast<O>(matrix[i]);
// clang-format off
return {
elements[0], elements[4], elements[8], elements[12],
elements[1], elements[5], elements[9], elements[13],
elements[2], elements[6], elements[10], elements[14],
elements[3], elements[7], elements[11], elements[15],
};
// clang-format on
}
void glActiveTexture(GLenum texture)
{
g_gl_context->gl_active_texture(texture);
}
void glActiveTextureARB(GLenum texture)
{
glActiveTexture(texture);
}
void glAlphaFunc(GLenum func, GLclampf ref)
{
return g_gl_context->gl_alpha_func(func, ref);
}
void glArrayElement(GLint i)
{
g_gl_context->gl_array_element(i);
}
void glBegin(GLenum mode)
{
g_gl_context->gl_begin(mode);
}
void glBindBuffer(GLenum target, GLuint buffer)
{
g_gl_context->gl_bind_buffer(target, buffer);
}
void glBindTexture(GLenum target, GLuint texture)
{
g_gl_context->gl_bind_texture(target, texture);
}
void glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte const* bitmap)
{
g_gl_context->gl_bitmap(width, height, xorig, yorig, xmove, ymove, bitmap);
}
void glBlendFunc(GLenum sfactor, GLenum dfactor)
{
return g_gl_context->gl_blend_func(sfactor, dfactor);
}
void glBufferData(GLenum target, GLsizeiptr size, void const* data, GLenum usage)
{
g_gl_context->gl_buffer_data(target, size, data, usage);
}
void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, void const* data)
{
g_gl_context->gl_buffer_sub_data(target, offset, size, data);
}
void glCallList(GLuint list)
{
return g_gl_context->gl_call_list(list);
}
void glCallLists(GLsizei n, GLenum type, void const* lists)
{
return g_gl_context->gl_call_lists(n, type, lists);
}
void glClear(GLbitfield mask)
{
g_gl_context->gl_clear(mask);
}
void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
g_gl_context->gl_clear_color(red, green, blue, alpha);
}
void glClearDepth(GLdouble depth)
{
g_gl_context->gl_clear_depth(depth);
}
void glClearDepthf(GLfloat depth)
{
g_gl_context->gl_clear_depth(static_cast<double>(depth));
}
void glClearStencil(GLint s)
{
g_gl_context->gl_clear_stencil(s);
}
void glClientActiveTexture(GLenum target)
{
g_gl_context->gl_client_active_texture(target);
}
void glClientActiveTextureARB(GLenum target)
{
glClientActiveTexture(target);
}
void glClipPlane(GLenum plane, GLdouble const* equation)
{
g_gl_context->gl_clip_plane(plane, equation);
}
void glColor3d(GLdouble r, GLdouble g, GLdouble b)
{
g_gl_context->gl_color(r, g, b, 1.0);
}
void glColor3dv(GLdouble const* v)
{
g_gl_context->gl_color(v[0], v[1], v[2], 1.0);
}
void glColor3f(GLfloat r, GLfloat g, GLfloat b)
{
g_gl_context->gl_color(r, g, b, 1.0);
}
void glColor3fv(GLfloat const* v)
{
g_gl_context->gl_color(v[0], v[1], v[2], 1.0);
}
void glColor3ub(GLubyte r, GLubyte g, GLubyte b)
{
g_gl_context->gl_color(r / 255.0, g / 255.0, b / 255.0, 1.0);
}
void glColor3ubv(GLubyte const* v)
{
g_gl_context->gl_color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, 1.0);
}
void glColor4b(GLbyte r, GLbyte g, GLbyte b, GLbyte a)
{
g_gl_context->gl_color(
(static_cast<double>(r) + 128) / 127.5 - 1,
(static_cast<double>(g) + 128) / 127.5 - 1,
(static_cast<double>(b) + 128) / 127.5 - 1,
(static_cast<double>(a) + 128) / 127.5 - 1);
}
void glColor4dv(GLdouble const* v)
{
g_gl_context->gl_color(v[0], v[1], v[2], v[3]);
}
void glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
{
g_gl_context->gl_color(r, g, b, a);
}
void glColor4fv(GLfloat const* v)
{
g_gl_context->gl_color(v[0], v[1], v[2], v[3]);
}
void glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a)
{
g_gl_context->gl_color(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
}
void glColor4ubv(GLubyte const* v)
{
g_gl_context->gl_color(v[0] / 255.0, v[1] / 255.0, v[2] / 255.0, v[3] / 255.0);
}
void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
g_gl_context->gl_color_mask(red, green, blue, alpha);
}
void glColorMaterial(GLenum face, GLenum mode)
{
g_gl_context->gl_color_material(face, mode);
}
void glColorPointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
{
g_gl_context->gl_color_pointer(size, type, stride, pointer);
}
void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
{
g_gl_context->gl_copy_tex_image_2d(target, level, internalformat, x, y, width, height, border);
}
void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
{
g_gl_context->gl_copy_tex_sub_image_2d(target, level, xoffset, yoffset, x, y, width, height);
}
void glCullFace(GLenum mode)
{
g_gl_context->gl_cull_face(mode);
}
void glDeleteBuffers(GLsizei n, GLuint const* buffers)
{
g_gl_context->gl_delete_buffers(n, buffers);
}
void glDepthFunc(GLenum func)
{
g_gl_context->gl_depth_func(func);
}
void glDepthMask(GLboolean flag)
{
g_gl_context->gl_depth_mask(flag);
}
void glDepthRange(GLdouble min, GLdouble max)
{
g_gl_context->gl_depth_range(min, max);
}
void glDeleteLists(GLuint list, GLsizei range)
{
return g_gl_context->gl_delete_lists(list, range);
}
void glDeleteTextures(GLsizei n, GLuint const* textures)
{
g_gl_context->gl_delete_textures(n, textures);
}
void glDisable(GLenum cap)
{
g_gl_context->gl_disable(cap);
}
void glDisableClientState(GLenum cap)
{
g_gl_context->gl_disable_client_state(cap);
}
void glDrawArrays(GLenum mode, GLint first, GLsizei count)
{
g_gl_context->gl_draw_arrays(mode, first, count);
}
void glDrawBuffer(GLenum buffer)
{
g_gl_context->gl_draw_buffer(buffer);
}
void glDrawElements(GLenum mode, GLsizei count, GLenum type, void const* indices)
{
g_gl_context->gl_draw_elements(mode, count, type, indices);
}
void glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, void const* data)
{
g_gl_context->gl_draw_pixels(width, height, format, type, data);
}
void glEnable(GLenum cap)
{
g_gl_context->gl_enable(cap);
}
void glEnableClientState(GLenum cap)
{
g_gl_context->gl_enable_client_state(cap);
}
void glEnd()
{
g_gl_context->gl_end();
}
void glEndList(void)
{
return g_gl_context->gl_end_list();
}
void glEvalCoord1d(GLdouble u)
{
dbgln("glEvalCoord1d({}): unimplemented", u);
TODO();
}
void glEvalCoord1f(GLfloat u)
{
dbgln("glEvalCoord1f({}): unimplemented", u);
TODO();
}
void glEvalCoord2d(GLdouble u, GLdouble v)
{
dbgln("glEvalCoord2d({}, {}): unimplemented", u, v);
TODO();
}
void glEvalCoord2f(GLfloat u, GLfloat v)
{
dbgln("glEvalCoord2f({}, {}): unimplemented", u, v);
TODO();
}
void glEvalMesh1(GLenum mode, GLint i1, GLint i2)
{
dbgln("glEvalMesh1({:#x}, {}, {}): unimplemented", mode, i1, i2);
TODO();
}
void glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
{
dbgln("glEvalMesh2({:#x}, {}, {}, {}, {}): unimplemented", mode, i1, i2, j1, j2);
TODO();
}
void glEvalPoint1(GLint i)
{
dbgln("glEvalPoint1({}): unimplemented", i);
TODO();
}
void glEvalPoint2(GLint i, GLint j)
{
dbgln("glEvalPoint2({}, {}): unimplemented", i, j);
TODO();
}
void glFinish()
{
g_gl_context->gl_finish();
}
void glFogfv(GLenum pname, GLfloat const* params)
{
g_gl_context->gl_fogfv(pname, params);
}
void glFogf(GLenum pname, GLfloat param)
{
g_gl_context->gl_fogf(pname, param);
}
void glFogi(GLenum pname, GLint param)
{
g_gl_context->gl_fogi(pname, param);
}
void glFlush()
{
g_gl_context->gl_flush();
}
void glFrontFace(GLenum mode)
{
g_gl_context->gl_front_face(mode);
}
void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal)
{
g_gl_context->gl_frustum(left, right, bottom, top, nearVal, farVal);
}
void glGenBuffers(GLsizei n, GLuint* buffers)
{
g_gl_context->gl_gen_buffers(n, buffers);
}
GLuint glGenLists(GLsizei range)
{
return g_gl_context->gl_gen_lists(range);
}
void glGenTextures(GLsizei n, GLuint* textures)
{
g_gl_context->gl_gen_textures(n, textures);
}
void glGetBooleanv(GLenum pname, GLboolean* data)
{
g_gl_context->gl_get_booleanv(pname, data);
}
void glGetClipPlane(GLenum plane, GLdouble* equation)
{
g_gl_context->gl_get_clip_plane(plane, equation);
}
void glGetDoublev(GLenum pname, GLdouble* params)
{
g_gl_context->gl_get_doublev(pname, params);
}
GLenum glGetError()
{
return g_gl_context->gl_get_error();
}
void glGetFloatv(GLenum pname, GLfloat* params)
{
g_gl_context->gl_get_floatv(pname, params);
}
void glGetIntegerv(GLenum pname, GLint* data)
{
g_gl_context->gl_get_integerv(pname, data);
}
void glGetLightfv(GLenum light, GLenum pname, GLfloat* params)
{
g_gl_context->gl_get_light(light, pname, params, GL_FLOAT);
}
void glGetLightiv(GLenum light, GLenum pname, GLint* params)
{
g_gl_context->gl_get_light(light, pname, params, GL_INT);
}
void glGetMaterialfv(GLenum face, GLenum pname, GLfloat* params)
{
g_gl_context->gl_get_material(face, pname, params, GL_FLOAT);
}
void glGetMaterialiv(GLenum face, GLenum pname, GLint* params)
{
g_gl_context->gl_get_material(face, pname, params, GL_INT);
}
GLubyte const* glGetString(GLenum name)
{
return g_gl_context->gl_get_string(name);
}
void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* pixels)
{
g_gl_context->gl_get_tex_image(target, level, format, type, pixels);
}
void glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint* params)
{
g_gl_context->gl_get_tex_parameter_integerv(target, level, pname, params);
}
void glHint(GLenum target, GLenum mode)
{
g_gl_context->gl_hint(target, mode);
}
GLboolean glIsEnabled(GLenum cap)
{
return g_gl_context->gl_is_enabled(cap);
}
GLboolean glIsList(GLuint list)
{
return g_gl_context->gl_is_list(list);
}
GLboolean glIsTexture(GLuint texture)
{
return g_gl_context->gl_is_texture(texture);
}
void glLightf(GLenum light, GLenum pname, GLfloat param)
{
g_gl_context->gl_lightf(light, pname, param);
}
void glLightfv(GLenum light, GLenum pname, GLfloat const* param)
{
g_gl_context->gl_lightfv(light, pname, param);
}
void glLighti(GLenum light, GLenum pname, GLint param)
{
g_gl_context->gl_lightf(light, pname, param);
}
void glLightiv(GLenum light, GLenum pname, GLint const* params)
{
g_gl_context->gl_lightiv(light, pname, params);
}
void glLightModelf(GLenum pname, GLfloat param)
{
g_gl_context->gl_light_model(pname, param, 0.0f, 0.0f, 0.0f);
}
void glLightModelfv(GLenum pname, GLfloat const* params)
{
switch (pname) {
case GL_LIGHT_MODEL_AMBIENT:
g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]);
break;
default:
g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f);
break;
}
}
void glLightModeliv(GLenum pname, GLint const* params)
{
switch (pname) {
case GL_LIGHT_MODEL_AMBIENT:
g_gl_context->gl_light_model(pname, params[0], params[1], params[2], params[3]);
break;
default:
g_gl_context->gl_light_model(pname, params[0], 0.0f, 0.0f, 0.0f);
break;
}
}
void glLightModeli(GLenum pname, GLint param)
{
g_gl_context->gl_light_model(pname, param, 0.0f, 0.0f, 0.0f);
}
void glLineWidth(GLfloat width)
{
g_gl_context->gl_line_width(width);
}
void glListBase(GLuint base)
{
return g_gl_context->gl_list_base(base);
}
void glLoadIdentity()
{
g_gl_context->gl_load_identity();
}
void glLoadMatrixd(GLdouble const* matrix)
{
g_gl_context->gl_load_matrix(transpose_input_matrix<double, float>(matrix));
}
void glLoadMatrixf(GLfloat const* matrix)
{
g_gl_context->gl_load_matrix(transpose_input_matrix<float, float>(matrix));
}
void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble const* points)
{
dbgln("glMap1d({:#x}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, stride, order, points);
TODO();
}
void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat const* points)
{
dbgln("glMap1f({:#x}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, stride, order, points);
TODO();
}
void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble const* points)
{
dbgln("glMap2d({:#x}, {}, {}, {}, {}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
TODO();
}
void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat const* points)
{
dbgln("glMap2f({:#x}, {}, {}, {}, {}, {}, {}, {}, {}, {:p}): unimplemented", target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points);
TODO();
}
void glMapGrid1d(GLint un, GLdouble u1, GLdouble u2)
{
dbgln("glMapGrid1d({}, {}, {}): unimplemented", un, u1, u2);
TODO();
}
void glMapGrid1f(GLint un, GLfloat u1, GLfloat u2)
{
dbgln("glMapGrid1f({}, {}, {}): unimplemented", un, u1, u2);
TODO();
}
void glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)
{
dbgln("glMapGrid2d({}, {}, {}, {}, {}, {}): unimplemented", un, u1, u2, vn, v1, v2);
TODO();
}
void glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)
{
dbgln("glMapGrid2f({}, {}, {}, {}, {}, {}): unimplemented", un, u1, u2, vn, v1, v2);
TODO();
}
void glMaterialf(GLenum face, GLenum pname, GLfloat param)
{
g_gl_context->gl_materialf(face, pname, param);
}
void glMaterialfv(GLenum face, GLenum pname, GLfloat const* params)
{
g_gl_context->gl_materialfv(face, pname, params);
}
void glMateriali(GLenum face, GLenum pname, GLint param)
{
g_gl_context->gl_materialf(face, pname, param);
}
void glMaterialiv(GLenum face, GLenum pname, GLint const* params)
{
g_gl_context->gl_materialiv(face, pname, params);
}
void glMatrixMode(GLenum mode)
{
g_gl_context->gl_matrix_mode(mode);
}
void glMultiTexCoord1f(GLenum target, GLfloat s)
{
g_gl_context->gl_multi_tex_coord(target, s, 0.f, 0.f, 1.f);
}
void glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
{
glMultiTexCoord2f(target, s, t);
}
void glMultiTexCoord2fvARB(GLenum target, GLfloat const* v)
{
glMultiTexCoord2fv(target, v);
}
void glMultiTexCoord2fv(GLenum target, GLfloat const* v)
{
g_gl_context->gl_multi_tex_coord(target, v[0], v[1], 0.f, 1.f);
}
void glMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t)
{
g_gl_context->gl_multi_tex_coord(target, s, t, 0.f, 1.f);
}
void glMultiTexCoord3f(GLenum target, GLfloat s, GLfloat t, GLfloat r)
{
g_gl_context->gl_multi_tex_coord(target, s, t, r, 1.f);
}
void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
{
g_gl_context->gl_multi_tex_coord(target, s, t, r, q);
}
void glMultMatrixd(GLdouble const* matrix)
{
g_gl_context->gl_mult_matrix(transpose_input_matrix<double, float>(matrix));
}
void glMultMatrixf(GLfloat const* matrix)
{
g_gl_context->gl_mult_matrix(transpose_input_matrix<float, float>(matrix));
}
void glNewList(GLuint list, GLenum mode)
{
return g_gl_context->gl_new_list(list, mode);
}
void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz)
{
g_gl_context->gl_normal(nx, ny, nz);
}
void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
{
g_gl_context->gl_normal(nx, ny, nz);
}
void glNormal3fv(GLfloat const* v)
{
g_gl_context->gl_normal(v[0], v[1], v[2]);
}
void glNormalPointer(GLenum type, GLsizei stride, void const* pointer)
{
g_gl_context->gl_normal_pointer(type, stride, pointer);
}
void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal)
{
g_gl_context->gl_ortho(left, right, bottom, top, nearVal, farVal);
}
void glPixelStorei(GLenum pname, GLint param)
{
g_gl_context->gl_pixel_storei(pname, param);
}
void glPointSize(GLfloat size)
{
g_gl_context->gl_point_size(size);
}
void glPolygonMode(GLenum face, GLenum mode)
{
g_gl_context->gl_polygon_mode(face, mode);
}
void glPolygonOffset(GLfloat factor, GLfloat units)
{
g_gl_context->gl_polygon_offset(factor, units);
}
void glPopAttrib()
{
g_gl_context->gl_pop_attrib();
}
void glPopMatrix()
{
g_gl_context->gl_pop_matrix();
}
void glPushAttrib(GLbitfield mask)
{
g_gl_context->gl_push_attrib(mask);
}
void glPushMatrix()
{
g_gl_context->gl_push_matrix();
}
void glRasterPos2d(GLdouble x, GLdouble y)
{
g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.f, 1.f);
}
void glRasterPos2f(GLfloat x, GLfloat y)
{
g_gl_context->gl_raster_pos(x, y, 0.f, 1.f);
}
void glRasterPos2i(GLint x, GLint y)
{
g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.f, 1.f);
}
void glRasterPos2s(GLshort x, GLshort y)
{
g_gl_context->gl_raster_pos(static_cast<float>(x), static_cast<float>(y), 0.f, 1.f);
}
void glReadBuffer(GLenum mode)
{
g_gl_context->gl_read_buffer(mode);
}
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
{
g_gl_context->gl_read_pixels(x, y, width, height, format, type, pixels);
}
void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
{
g_gl_context->gl_rect(x1, y1, x2, y2);
}
void glRecti(GLint x1, GLint y1, GLint x2, GLint y2)
{
g_gl_context->gl_rect(x1, y1, x2, y2);
}
void glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z)
{
g_gl_context->gl_rotate(angle, x, y, z);
}
void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
g_gl_context->gl_rotate(angle, x, y, z);
}
void glScaled(GLdouble x, GLdouble y, GLdouble z)
{
g_gl_context->gl_scale(x, y, z);
}
void glScalef(GLfloat x, GLfloat y, GLfloat z)
{
g_gl_context->gl_scale(x, y, z);
}
void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{
g_gl_context->gl_scissor(x, y, width, height);
}
void glShadeModel(GLenum mode)
{
g_gl_context->gl_shade_model(mode);
}
void glStencilFunc(GLenum func, GLint ref, GLuint mask)
{
g_gl_context->gl_stencil_func_separate(GL_FRONT_AND_BACK, func, ref, mask);
}
void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
{
g_gl_context->gl_stencil_func_separate(face, func, ref, mask);
}
void glStencilMask(GLuint mask)
{
g_gl_context->gl_stencil_mask_separate(GL_FRONT_AND_BACK, mask);
}
void glStencilMaskSeparate(GLenum face, GLuint mask)
{
g_gl_context->gl_stencil_mask_separate(face, mask);
}
void glStencilOp(GLenum sfail, GLenum dpfail, GLenum dppass)
{
g_gl_context->gl_stencil_op_separate(GL_FRONT_AND_BACK, sfail, dpfail, dppass);
}
void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)
{
g_gl_context->gl_stencil_op_separate(face, sfail, dpfail, dppass);
}
void glTexCoord1f(GLfloat s)
{
g_gl_context->gl_tex_coord(s, 0.0f, 0.0f, 1.0f);
}
void glTexCoord1fv(GLfloat const* v)
{
g_gl_context->gl_tex_coord(v[0], 0.0f, 0.0f, 1.0f);
}
void glTexCoord2d(GLdouble s, GLdouble t)
{
g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
}
void glTexCoord2dv(GLdouble const* v)
{
g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 1.0f);
}
void glTexCoord2f(GLfloat s, GLfloat t)
{
g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
}
void glTexCoord2fv(GLfloat const* v)
{
g_gl_context->gl_tex_coord(v[0], v[1], 0.0f, 1.0f);
}
void glTexCoord2i(GLint s, GLint t)
{
g_gl_context->gl_tex_coord(s, t, 0.0f, 1.0f);
}
void glTexCoord3f(GLfloat s, GLfloat t, GLfloat r)
{
g_gl_context->gl_tex_coord(s, t, r, 1.0f);
}
void glTexCoord3fv(GLfloat const* v)
{
g_gl_context->gl_tex_coord(v[0], v[1], v[2], 1.0f);
}
void glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q)
{
g_gl_context->gl_tex_coord(s, t, r, q);
}
void glTexCoord4fv(GLfloat const* v)
{
g_gl_context->gl_tex_coord(v[0], v[1], v[2], v[3]);
}
void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
{
g_gl_context->gl_tex_coord_pointer(size, type, stride, pointer);
}
void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
{
g_gl_context->gl_tex_env(target, pname, param);
}
void glTexEnvi(GLenum target, GLenum pname, GLint param)
{
g_gl_context->gl_tex_env(target, pname, param);
}
void glTexGend(GLenum coord, GLenum pname, GLdouble param)
{
g_gl_context->gl_tex_gen(coord, pname, param);
}
void glTexGenf(GLenum coord, GLenum pname, GLfloat param)
{
g_gl_context->gl_tex_gen(coord, pname, param);
}
void glTexGenfv(GLenum coord, GLenum pname, GLfloat const* params)
{
g_gl_context->gl_tex_gen_floatv(coord, pname, params);
}
void glTexGeni(GLenum coord, GLenum pname, GLint param)
{
g_gl_context->gl_tex_gen(coord, pname, param);
}
void glTexImage1D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid const* data)
{
dbgln("glTexImage1D({:#x}, {}, {:#x}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, border, format, type, data);
TODO();
}
void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid const* data)
{
g_gl_context->gl_tex_image_2d(target, level, internalFormat, width, height, border, format, type, data);
}
void glTexImage3D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLvoid const* data)
{
dbgln("glTexImage3D({:#x}, {}, {:#x}, {}, {}, {}, {}, {:#x}, {:#x}, {:p}): unimplemented", target, level, internalFormat, width, height, depth, border, format, type, data);
TODO();
}
void glTexParameteri(GLenum target, GLenum pname, GLint param)
{
g_gl_context->gl_tex_parameter(target, pname, param);
}
void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
{
g_gl_context->gl_tex_parameter(target, pname, param);
}
void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid const* data)
{
g_gl_context->gl_tex_sub_image_2d(target, level, xoffset, yoffset, width, height, format, type, data);
}
void glTranslated(GLdouble x, GLdouble y, GLdouble z)
{
g_gl_context->gl_translate(x, y, z);
}
void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
{
g_gl_context->gl_translate(x, y, z);
}
void glVertex2d(GLdouble x, GLdouble y)
{
g_gl_context->gl_vertex(x, y, 0.0, 1.0);
}
void glVertex2dv(GLdouble const* v)
{
g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
}
void glVertex2f(GLfloat x, GLfloat y)
{
g_gl_context->gl_vertex(x, y, 0.0, 1.0);
}
void glVertex2fv(GLfloat const* v)
{
g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
}
void glVertex2i(GLint x, GLint y)
{
g_gl_context->gl_vertex(x, y, 0.0, 1.0);
}
void glVertex2iv(GLint const* v)
{
g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
}
void glVertex2s(GLshort x, GLshort y)
{
g_gl_context->gl_vertex(x, y, 0.0, 1.0);
}
void glVertex2sv(GLshort const* v)
{
g_gl_context->gl_vertex(v[0], v[1], 0.0, 1.0);
}
void glVertex3d(GLdouble x, GLdouble y, GLdouble z)
{
g_gl_context->gl_vertex(x, y, z, 1.0);
}
void glVertex3dv(GLdouble const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
}
void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
{
g_gl_context->gl_vertex(x, y, z, 1.0);
}
void glVertex3fv(GLfloat const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
}
void glVertex3i(GLint x, GLint y, GLint z)
{
g_gl_context->gl_vertex(x, y, z, 1.0);
}
void glVertex3iv(GLint const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
}
void glVertex3s(GLshort x, GLshort y, GLshort z)
{
g_gl_context->gl_vertex(x, y, z, 1.0);
}
void glVertex3sv(GLshort const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], 1.0);
}
void glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
{
g_gl_context->gl_vertex(x, y, z, w);
}
void glVertex4dv(GLdouble const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
}
void glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
g_gl_context->gl_vertex(x, y, z, w);
}
void glVertex4fv(GLfloat const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
}
void glVertex4i(GLint x, GLint y, GLint z, GLint w)
{
g_gl_context->gl_vertex(x, y, z, w);
}
void glVertex4iv(GLint const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
}
void glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w)
{
g_gl_context->gl_vertex(x, y, z, w);
}
void glVertex4sv(GLshort const* v)
{
g_gl_context->gl_vertex(v[0], v[1], v[2], v[3]);
}
void glVertexPointer(GLint size, GLenum type, GLsizei stride, void const* pointer)
{
g_gl_context->gl_vertex_pointer(size, type, stride, pointer);
}
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
{
g_gl_context->gl_viewport(x, y, width, height);
}
|