-
Notifications
You must be signed in to change notification settings - Fork 52
/
gl.go
1233 lines (1010 loc) · 34.3 KB
/
gl.go
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
// Copyright 2012 The go-gl Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gl
// #cgo darwin LDFLAGS: -framework OpenGL -lGLEW
// #cgo windows LDFLAGS: -lglew32 -lopengl32
// #cgo linux LDFLAGS: -lGLEW -lGL
// #cgo freebsd CFLAGS: -I/usr/local/include
// #cgo freebsd LDFLAGS: -L/usr/local/lib -lglfw
// #include "gl.h"
// void SetGlewExperimental(GLboolean v) { glewExperimental = v; }
import "C"
import "unsafe"
import "reflect"
type GLenum C.GLenum
type GLbitfield C.GLbitfield
type GLclampf C.GLclampf
type GLclampd C.GLclampd
type Pointer unsafe.Pointer
// those types are left for compatibility reasons
type GLboolean C.GLboolean
type GLbyte C.GLbyte
type GLshort C.GLshort
type GLint C.GLint
type GLsizei C.GLsizei
type GLubyte C.GLubyte
type GLushort C.GLushort
type GLuint C.GLuint
type GLfloat C.GLfloat
type GLdouble C.GLdouble
// helpers
func glBool(v bool) C.GLboolean {
if v {
return 1
}
return 0
}
func goBool(v C.GLboolean) bool {
return v != 0
}
func glString(s string) *C.GLchar { return (*C.GLchar)(C.CString(s)) }
func freeString(ptr *C.GLchar) { C.free(unsafe.Pointer(ptr)) }
func ptr(v interface{}) unsafe.Pointer {
if v == nil {
return unsafe.Pointer(nil)
}
rv := reflect.ValueOf(v)
var et reflect.Value
switch rv.Type().Kind() {
case reflect.Uintptr:
offset, _ := v.(uintptr)
return unsafe.Pointer(offset)
case reflect.Ptr:
if rv.IsNil() {
return unsafe.Pointer(nil)
}
et = rv.Elem()
case reflect.Slice:
if rv.IsNil() || rv.Len() == 0 {
return unsafe.Pointer(nil)
}
et = rv.Index(0)
default:
panic("type must be a pointer, a slice, uintptr or nil")
}
return unsafe.Pointer(et.UnsafeAddr())
}
/*
uniformMatrix2fv
uniformMatrix2fv
uniformMatrix3fv
uniformMatrix3fv
uniformMatrix4fv
uniformMatrix4fv
*/
// Main
func BlendColor(red GLclampf, green GLclampf, blue GLclampf, alpha GLclampf) {
C.glBlendColor(C.GLclampf(red), C.GLclampf(green), C.GLclampf(blue), C.GLclampf(alpha))
}
func BlendEquation(mode GLenum) { C.glBlendEquation(C.GLenum(mode)) }
func BlendEquationSeparate(modeRGB GLenum, modeAlpha GLenum) {
C.glBlendEquationSeparate(C.GLenum(modeRGB), C.GLenum(modeAlpha))
}
func BlendFuncSeparate(srcRGB GLenum, dstRGB GLenum, srcAlpha GLenum, dstAlpha GLenum) {
C.glBlendFuncSeparate(C.GLenum(srcRGB), C.GLenum(dstRGB), C.GLenum(srcAlpha), C.GLenum(dstAlpha))
}
func SampleCoverage(value GLclampf, invert bool) {
C.glSampleCoverage(C.GLclampf(value), glBool(invert))
}
func StencilFuncSeparate(face GLenum, func_ GLenum, ref int, mask uint) {
C.glStencilFuncSeparate(C.GLenum(face), C.GLenum(func_), C.GLint(ref), C.GLuint(mask))
}
func StencilMaskSeparate(face GLenum, mask uint) {
C.glStencilMaskSeparate(C.GLenum(face), C.GLuint(mask))
}
func StencilOpSeparate(face GLenum, fail GLenum, zfail GLenum, zpass GLenum) {
C.glStencilOpSeparate(C.GLenum(face), C.GLenum(fail), C.GLenum(zfail), C.GLenum(zpass))
}
//void glAccum (GLenum op, float32 value)
func Accum(op GLenum, value float32) {
C.glAccum(C.GLenum(op), C.GLfloat(value))
}
//void glAlphaFunc (GLenum func, GLclampf ref)
func AlphaFunc(func_ GLenum, ref GLclampf) {
C.glAlphaFunc(C.GLenum(func_), C.GLclampf(ref))
}
//void glArrayElement (int i)
func ArrayElement(i int) {
C.glArrayElement(C.GLint(i))
}
//void glBegin (GLenum mode)
func Begin(mode GLenum) {
C.glBegin(C.GLenum(mode))
}
//void glBitmap (GLsizei width, int height, float32 xorig, float32 yorig, float32 xmove, float32 ymove, const uint8 *bitmap)
func Bitmap(width int, height int, xorig float32, yorig float32, xmove float32, ymove float32, bitmap *uint8) {
C.glBitmap(C.GLsizei(width), C.GLsizei(height), C.GLfloat(xorig), C.GLfloat(yorig), C.GLfloat(xmove), C.GLfloat(ymove), (*C.GLubyte)(bitmap))
}
//void glBlendFunc (GLenum sfactor, GLenum dfactor)
func BlendFunc(sfactor GLenum, dfactor GLenum) {
C.glBlendFunc(C.GLenum(sfactor), C.GLenum(dfactor))
}
//void glCallList (uint list)
func CallList(list uint) {
C.glCallList(C.GLuint(list))
}
//void glCallLists (GLsizei n, GLenum type, const GLvoid *lists)
func CallLists(n int, typ GLenum, lists interface{}) {
C.glCallLists(C.GLsizei(n), C.GLenum(typ), ptr(lists))
}
//void glClear (GLbitfield mask)
func Clear(mask GLbitfield) {
C.glClear(C.GLbitfield(mask))
}
//void glClearAccum (float32 red, float32 green, float32 blue, float32 alpha)
func ClearAccum(red float32, green float32, blue float32, alpha float32) {
C.glClearAccum(C.GLfloat(red), C.GLfloat(green), C.GLfloat(blue), C.GLfloat(alpha))
}
//void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
func ClearColor(red GLclampf, green GLclampf, blue GLclampf, alpha GLclampf) {
C.glClearColor(C.GLclampf(red), C.GLclampf(green), C.GLclampf(blue), C.GLclampf(alpha))
}
//void glClearDepth (GLclampd depth)
func ClearDepth(depth GLclampd) {
C.glClearDepth(C.GLclampd(depth))
}
//void glClearIndex (float32 c)
func ClearIndex(c float32) {
C.glClearIndex(C.GLfloat(c))
}
//void glClearStencil (int s)
func ClearStencil(s int) {
C.glClearStencil(C.GLint(s))
}
//void glClipPlane (GLenum plane, const float64 *equation)
func ClipPlane(plane GLenum, equation []float64) {
C.glClipPlane(C.GLenum(plane), (*C.GLdouble)(&equation[0]))
}
//void glCopyPixels (int x, int y, int width, int height, GLenum type)
func CopyPixels(x int, y int, width int, height int, type_ GLenum) {
C.glCopyPixels(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height), C.GLenum(type_))
}
//void glCullFace (GLenum mode)
func CullFace(mode GLenum) {
C.glCullFace(C.GLenum(mode))
}
//void glDeleteLists (uint list, int range)
func DeleteLists(list uint, range_ int) {
C.glDeleteLists(C.GLuint(list), C.GLsizei(range_))
}
//void glDepthFunc (GLenum func)
func DepthFunc(func_ GLenum) {
C.glDepthFunc(C.GLenum(func_))
}
//void glDepthMask (bool flag)
func DepthMask(flag bool) {
C.glDepthMask(glBool(flag))
}
//void glDepthRange (GLclampd zNear, GLclampd zFar)
func DepthRange(zNear GLclampd, zFar GLclampd) {
C.glDepthRange(C.GLclampd(zNear), C.GLclampd(zFar))
}
//void glDisable (GLenum cap)
func Disable(cap GLenum) {
C.glDisable(C.GLenum(cap))
}
//void glDisableClientState (GLenum array)
func DisableClientState(array GLenum) {
C.glDisableClientState(C.GLenum(array))
}
//void glDrawArrays (GLenum mode, int first, int count)
func DrawArrays(mode GLenum, first int, count int) {
C.glDrawArrays(C.GLenum(mode), C.GLint(first), C.GLsizei(count))
}
//void glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
func DrawArraysInstanced(mode GLenum, first int, count, primcount int) {
C.glDrawArraysInstanced(C.GLenum(mode), C.GLint(first), C.GLsizei(count), C.GLsizei(primcount))
}
//void glDrawBuffer (GLenum mode)
func DrawBuffer(mode GLenum) {
C.glDrawBuffer(C.GLenum(mode))
}
// //void glDrawBuffers(GLsizei n, const GLenum *bufs)
func DrawBuffers(n int, bufs []GLenum) {
C.glDrawBuffers(C.GLsizei(n), (*C.GLenum)(&bufs[0]))
}
//void glDrawElements (GLenum mode, int count, GLenum type, const GLvoid *indices)
func DrawElements(mode GLenum, count int, typ GLenum, indices interface{}) {
C.glDrawElements(C.GLenum(mode), C.GLsizei(count), C.GLenum(typ),
ptr(indices))
}
//void glDrawRangeElements (GLenum mode, int start, int end, int count, GLenum type, const GLvoid *indices)
func DrawRangeElements(mode GLenum, start, end uint, count int, typ GLenum, indices interface{}) {
C.glDrawRangeElements(C.GLenum(mode), C.GLuint(start), C.GLuint(end), C.GLsizei(count), C.GLenum(typ),
ptr(indices))
}
//void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount)
func DrawElementsInstanced(mode GLenum, count int, typ GLenum, indices interface{}, primcount int) {
C.glDrawElementsInstanced(C.GLenum(mode), C.GLsizei(count), C.GLenum(typ),
ptr(indices), C.GLsizei(primcount))
}
//void glDrawElementsBaseVertex(GLenum mode, int count, GLenum type, GLvoid *indices, int basevertex)
func DrawElementsBaseVertex(mode GLenum, count int, typ GLenum, indices interface{}, basevertex int) {
C.glDrawElementsBaseVertex(C.GLenum(mode), C.GLsizei(count),
C.GLenum(typ), ptr(indices), C.GLint(basevertex))
}
//void glDrawPixels (GLsizei width, int height, GLenum format, GLenum type, const GLvoid *pixels)
func DrawPixels(width int, height int, format, typ GLenum, pixels interface{}) {
C.glDrawPixels(C.GLsizei(width), C.GLsizei(height), C.GLenum(format),
C.GLenum(typ), ptr(pixels))
}
//void glEdgeFlag (bool flag)
func EdgeFlag(flag bool) {
C.glEdgeFlag(glBool(flag))
}
//void glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer)
func EdgeFlagPointer(stride int, pointer unsafe.Pointer) {
C.glEdgeFlagPointer(C.GLsizei(stride), pointer)
}
//void glEdgeFlagv (const bool *flag)
func EdgeFlagv(flag []bool) {
if len(flag) > 0 {
C.glEdgeFlagv((*C.GLboolean)(unsafe.Pointer(&flag[0])))
}
}
//void glEnable (GLenum cap)
func Enable(cap GLenum) {
C.glEnable(C.GLenum(cap))
}
//void glEnableClientState (GLenum array)
func EnableClientState(array GLenum) {
C.glEnableClientState(C.GLenum(array))
}
//void glEnd (void)
func End() {
C.glEnd()
}
//void glEndList (void)
func EndList() {
C.glEndList()
}
//void glEvalCoord1d (float64 u)
func EvalCoord1d(u float64) {
C.glEvalCoord1d(C.GLdouble(u))
}
//void glEvalCoord1dv (const float64 *u)
func EvalCoord1dv(u *float64) {
C.glEvalCoord1dv((*C.GLdouble)(u))
}
//void glEvalCoord1f (float32 u)
func EvalCoord1f(u float32) {
C.glEvalCoord1f(C.GLfloat(u))
}
//void glEvalCoord1fv (const float *u)
func EvalCoord1fv(u *[1]float32) {
C.glEvalCoord1fv((*C.GLfloat)(&u[0]))
}
//void glEvalCoord2d (float64 u, float64 v)
func EvalCoord2d(u float64, v float64) {
C.glEvalCoord2d(C.GLdouble(u), C.GLdouble(v))
}
//void glEvalCoord2dv (const float64 *u)
func EvalCoord2dv(u *float64) {
C.glEvalCoord2dv((*C.GLdouble)(u))
}
//void glEvalCoord2f (float32 u, float32 v)
func EvalCoord2f(u float32, v float32) {
C.glEvalCoord2f(C.GLfloat(u), C.GLfloat(v))
}
//void glEvalCoord2fv (const float *u)
func EvalCoord2fv(u *[2]float32) {
C.glEvalCoord2fv((*C.GLfloat)(&u[0]))
}
//void glEvalMesh1 (GLenum mode, int i1, int i2)
func EvalMesh1(mode GLenum, i1 int, i2 int) {
C.glEvalMesh1(C.GLenum(mode), C.GLint(i1), C.GLint(i2))
}
//void glEvalMesh2 (GLenum mode, int i1, int i2, int j1, int j2)
func EvalMesh2(mode GLenum, i1 int, i2 int, j1 int, j2 int) {
C.glEvalMesh2(C.GLenum(mode), C.GLint(i1), C.GLint(i2), C.GLint(j1), C.GLint(j2))
}
//void glEvalPoint1 (int i)
func EvalPoint1(i int) {
C.glEvalPoint1(C.GLint(i))
}
//void glEvalPoint2 (int i, int j)
func EvalPoint2(i int, j int) {
C.glEvalPoint2(C.GLint(i), C.GLint(j))
}
//void glFeedbackBuffer (GLsizei size, GLenum type, float32 *buffer)
func FeedbackBuffer(size int, type_ GLenum, buffer *float32) {
C.glFeedbackBuffer(C.GLsizei(size), C.GLenum(type_), (*C.GLfloat)(buffer))
}
//void glFinish (void)
func Finish() {
C.glFinish()
}
//void glFlush (void)
func Flush() {
C.glFlush()
}
//void glFogf (GLenum pname, float32 param)
func Fogf(pname GLenum, param float32) {
C.glFogf(C.GLenum(pname), C.GLfloat(param))
}
//void glFogfv (GLenum pname, const float *params)
func Fogfv(pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glFogfv(C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glFogi (GLenum pname, int param)
func Fogi(pname GLenum, param int) {
C.glFogi(C.GLenum(pname), C.GLint(param))
}
//void glFogiv (GLenum pname, const int *params)
func Fogiv(pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glFogiv(C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glFrontFace (GLenum mode)
func FrontFace(mode GLenum) {
C.glFrontFace(C.GLenum(mode))
}
//uint glGenLists (GLsizei range)
func GenLists(range_ int) uint {
return uint(C.glGenLists(C.GLsizei(range_)))
}
//void glGetBooleanv (GLenum pname, bool *params)
func GetBooleanv(pname GLenum, params []bool) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetBooleanv(C.GLenum(pname), (*C.GLboolean)(unsafe.Pointer(¶ms[0])))
}
// Convenience function for GetBooleanv
func GetBoolean4(pname GLenum) (v0, v1, v2, v3 bool) {
var values [4]C.GLboolean
C.glGetBooleanv(C.GLenum(pname), &values[0])
v0 = values[0] != 0
v1 = values[1] != 0
v2 = values[2] != 0
v3 = values[3] != 0
return
}
//void glGetClipPlane (GLenum plane, float64 *equation)
func GetClipPlane(plane GLenum, equation *float64) {
C.glGetClipPlane(C.GLenum(plane), (*C.GLdouble)(equation))
}
//void glGetDoublev (GLenum pname, float64 *params)
func GetDoublev(pname GLenum, params []float64) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetDoublev(C.GLenum(pname), (*C.GLdouble)(¶ms[0]))
}
// Convenience function for GetDoublev
func GetDouble4(pname GLenum) (v0, v1, v2, v3 float64) {
var values [4]C.GLdouble
C.glGetDoublev(C.GLenum(pname), &values[0])
v0 = float64(values[0])
v1 = float64(values[1])
v2 = float64(values[2])
v3 = float64(values[3])
return
}
//GLenum glGetError (void)
func GetError() GLenum {
return GLenum(C.glGetError())
}
//void glGetFloatv (GLenum pname, float *params)
func GetFloatv(pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetFloatv(C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
// Convenience function for GetFloatv
func GetFloat4(pname GLenum) (v0, v1, v2, v3 float32) {
var values [4]C.GLfloat
C.glGetFloatv(C.GLenum(pname), &values[0])
v0 = float32(values[0])
v1 = float32(values[1])
v2 = float32(values[2])
v3 = float32(values[3])
return
}
//void glGetIntegerv (GLenum pname, int *params)
func GetIntegerv(pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetIntegerv(C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
// Convenience function for glGetIntegerv
func GetInteger4(pname GLenum) (v0, v1, v2, v3 int) {
var values [4]C.GLint
C.glGetIntegerv(C.GLenum(pname), &values[0])
v0 = int(values[0])
v1 = int(values[1])
v2 = int(values[2])
v3 = int(values[3])
return
}
//void glGetLightfv (GLenum light, GLenum pname, float *params)
func GetLightfv(light GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetLightfv(C.GLenum(light), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glGetLightiv (GLenum light, GLenum pname, int *params)
func GetLightiv(light GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetLightiv(C.GLenum(light), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glGetMapdv (GLenum target, GLenum query, float64 *v)
func GetMapdv(target GLenum, query GLenum, v []float64) {
if len(v) == 0 {
panic("Invalid slice length")
}
C.glGetMapdv(C.GLenum(target), C.GLenum(query), (*C.GLdouble)(&v[0]))
}
//void glGetMapfv (GLenum target, GLenum query, float *v)
func GetMapfv(target GLenum, query GLenum, v []float32) {
if len(v) == 0 {
panic("Invalid slice length")
}
C.glGetMapfv(C.GLenum(target), C.GLenum(query), (*C.GLfloat)(&v[0]))
}
//void glGetMapiv (GLenum target, GLenum query, int *v)
func GetMapiv(target GLenum, query GLenum, v []int32) {
if len(v) == 0 {
panic("Invalid slice length")
}
C.glGetMapiv(C.GLenum(target), C.GLenum(query), (*C.GLint)(&v[0]))
}
//void glGetMaterialfv (GLenum face, GLenum pname, float *params)
func GetMaterialfv(face GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetMaterialfv(C.GLenum(face), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glGetMaterialiv (GLenum face, GLenum pname, int *params)
func GetMaterialiv(face GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetMaterialiv(C.GLenum(face), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glGetPixelMapfv (GLenum map, float *values)
func GetPixelMapfv(map_ GLenum, values []float32) {
if len(values) == 0 {
panic("Invalid values length")
}
C.glGetPixelMapfv(C.GLenum(map_), (*C.GLfloat)(&values[0]))
}
//void glGetPixelMapuiv (GLenum map, uint *values)
func GetPixelMapuiv(map_ GLenum, values *uint32) {
C.glGetPixelMapuiv(C.GLenum(map_), (*C.GLuint)(values))
}
//void glGetPixelMapusv (GLenum map, uint16 *values)
func GetPixelMapusv(map_ GLenum, values *uint16) {
C.glGetPixelMapusv(C.GLenum(map_), (*C.GLushort)(values))
}
//void glGetPointerv (GLenum pname, GLvoid* *params)
func GetPointerv(pname GLenum, params []unsafe.Pointer) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glGetPointerv(C.GLenum(pname), ¶ms[0])
}
//void glGetPolygonStipple (uint8 *mask)
func GetPolygonStipple(mask *uint8) {
C.glGetPolygonStipple((*C.GLubyte)(mask))
}
//const uint8 * glGetString (GLenum name)
func GetString(name GLenum) string {
s := unsafe.Pointer(C.glGetString(C.GLenum(name)))
return C.GoString((*C.char)(s))
}
//void glHint (GLenum target, GLenum mode)
func Hint(target GLenum, mode GLenum) {
C.glHint(C.GLenum(target), C.GLenum(mode))
}
//void glIndexMask (uint mask)
func IndexMask(mask uint) {
C.glIndexMask(C.GLuint(mask))
}
//void glIndexPointer (GLenum type, int stride, const GLvoid *pointer)
func IndexPointer(typ GLenum, stride int, pointer interface{}) {
C.glIndexPointer(C.GLenum(typ), C.GLsizei(stride), ptr(pointer))
}
//void glIndexd (float64 c)
func Indexd(c float64) {
C.glIndexd(C.GLdouble(c))
}
//void glIndexdv (const float64 *c)
func Indexdv(c *[1]float64) {
C.glIndexdv((*C.GLdouble)(&c[0]))
}
//void glIndexf (float32 c)
func Indexf(c float32) {
C.glIndexf(C.GLfloat(c))
}
//void glIndexfv (const float32 *c)
func Indexfv(c *[1]float32) {
C.glIndexfv((*C.GLfloat)(&c[0]))
}
//void glIndexi (int c)
func Indexi(c int) {
C.glIndexi(C.GLint(c))
}
//void glIndexiv (const int *c)
func Indexiv(c *[1]int32) {
C.glIndexiv((*C.GLint)(&c[0]))
}
//void glIndexs (int16 c)
func Indexs(c int16) {
C.glIndexs(C.GLshort(c))
}
//void glIndexsv (const int16 *c)
func Indexsv(c *[1]int16) {
C.glIndexsv((*C.GLshort)(&c[0]))
}
//void glIndexub (uint8 c)
func Indexub(c uint8) {
C.glIndexub(C.GLubyte(c))
}
//void glIndexubv (const uint8 *c)
func Indexubv(c *[1]uint8) {
C.glIndexubv((*C.GLubyte)(&c[0]))
}
//void glInitNames (void)
func InitNames() {
C.glInitNames()
}
//void glInterleavedArrays (GLenum format, int stride, const GLvoid *pointer)
func InterleavedArrays(format GLenum, stride int, pointer unsafe.Pointer) {
C.glInterleavedArrays(C.GLenum(format), C.GLsizei(stride), pointer)
}
//bool glIsEnabled (GLenum cap)
func IsEnabled(cap GLenum) bool {
return goBool(C.glIsEnabled(C.GLenum(cap)))
}
//bool glIsList (uint list)
func IsList(list uint) bool {
return goBool(C.glIsList(C.GLuint(list)))
}
//void glLightModelf (GLenum pname, float32 param)
func LightModelf(pname GLenum, param float32) {
C.glLightModelf(C.GLenum(pname), C.GLfloat(param))
}
//void glLightModelfv (GLenum pname, const float *params)
func LightModelfv(pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glLightModelfv(C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glLightModeli (GLenum pname, int param)
func LightModeli(pname GLenum, param int) {
C.glLightModeli(C.GLenum(pname), C.GLint(param))
}
//void glLightModeliv (GLenum pname, const int *params)
func LightModeliv(pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glLightModeliv(C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glLightf (GLenum light, GLenum pname, float32 param)
func Lightf(light GLenum, pname GLenum, param float32) {
C.glLightf(C.GLenum(light), C.GLenum(pname), C.GLfloat(param))
}
//void glLightfv (GLenum light, GLenum pname, const float *params)
func Lightfv(light GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glLightfv(C.GLenum(light), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glLighti (GLenum light, GLenum pname, int param)
func Lighti(light GLenum, pname GLenum, param int) {
C.glLighti(C.GLenum(light), C.GLenum(pname), C.GLint(param))
}
//void glLightiv (GLenum light, GLenum pname, const int *params)
func Lightiv(light GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glLightiv(C.GLenum(light), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glLineStipple (int factor, uint16 pattern)
func LineStipple(factor int, pattern uint16) {
C.glLineStipple(C.GLint(factor), C.GLushort(pattern))
}
//void glLineWidth (float32 width)
func LineWidth(width float32) {
C.glLineWidth(C.GLfloat(width))
}
//void glListBase (uint base)
func ListBase(base uint) {
C.glListBase(C.GLuint(base))
}
//void glLoadName (uint name)
func LoadName(name uint) {
C.glLoadName(C.GLuint(name))
}
//void glLogicOp (GLenum opcode)
func LogicOp(opcode GLenum) {
C.glLogicOp(C.GLenum(opcode))
}
//void glMap1d (GLenum target, float64 u1, float64 u2, int stride, int order, const float64 *points)
func Map1d(target GLenum, u1 float64, u2 float64, stride int, order int, points []float64) {
if len(points) == 0 {
panic("Invalid points size")
}
C.glMap1d(C.GLenum(target), C.GLdouble(u1), C.GLdouble(u2),
C.GLint(stride), C.GLint(order), (*C.GLdouble)(&points[0]))
}
//void glMap1f (GLenum target, float32 u1, float32 u2, int stride, int order, const float32 *points)
func Map1f(target GLenum, u1 float32, u2 float32, stride int, order int, points []float32) {
if len(points) == 0 {
panic("Invalid points size")
}
C.glMap1f(C.GLenum(target), C.GLfloat(u1), C.GLfloat(u2), C.GLint(stride),
C.GLint(order), (*C.GLfloat)(&points[0]))
}
//void glMap2d (GLenum target, float64 u1, float64 u2, int ustride, int uorder, float64 v1, float64 v2, int vstride, int vorder, const float64 *points)
func Map2d(target GLenum, u1 float64, u2 float64, ustride int, uorder int, v1 float64, v2 float64, vstride int, vorder int, points []float64) {
if len(points) == 0 {
panic("Invalid points size")
}
C.glMap2d(C.GLenum(target), C.GLdouble(u1), C.GLdouble(u2), C.GLint(ustride),
C.GLint(uorder), C.GLdouble(v1), C.GLdouble(v2), C.GLint(vstride),
C.GLint(vorder), (*C.GLdouble)(&points[0]))
}
//void glMap2f (GLenum target, float32 u1, float32 u2, int ustride, int uorder, float32 v1, float32 v2, int vstride, int vorder, const float32 *points)
func Map2f(target GLenum, u1 float32, u2 float32, ustride int, uorder int, v1 float32, v2 float32, vstride int, vorder int, points []float32) {
if len(points) == 0 {
panic("Invalid points size")
}
C.glMap2f(C.GLenum(target), C.GLfloat(u1), C.GLfloat(u2), C.GLint(ustride),
C.GLint(uorder), C.GLfloat(v1), C.GLfloat(v2), C.GLint(vstride),
C.GLint(vorder), (*C.GLfloat)(&points[0]))
}
//void glMapGrid1d (int un, float64 u1, float64 u2)
func MapGrid1d(un int, u1 float64, u2 float64) {
C.glMapGrid1d(C.GLint(un), C.GLdouble(u1), C.GLdouble(u2))
}
//void glMapGrid1f (int un, float32 u1, float32 u2)
func MapGrid1f(un int, u1 float32, u2 float32) {
C.glMapGrid1f(C.GLint(un), C.GLfloat(u1), C.GLfloat(u2))
}
//void glMapGrid2d (int un, float64 u1, float64 u2, int vn, float64 v1, float64 v2)
func MapGrid2d(un int, u1 float64, u2 float64, vn int, v1 float64, v2 float64) {
C.glMapGrid2d(C.GLint(un), C.GLdouble(u1), C.GLdouble(u2), C.GLint(vn), C.GLdouble(v1), C.GLdouble(v2))
}
//void glMapGrid2f (int un, float32 u1, float32 u2, int vn, float32 v1, float32 v2)
func MapGrid2f(un int, u1 float32, u2 float32, vn int, v1 float32, v2 float32) {
C.glMapGrid2f(C.GLint(un), C.GLfloat(u1), C.GLfloat(u2), C.GLint(vn), C.GLfloat(v1), C.GLfloat(v2))
}
//void glMaterialf (GLenum face, GLenum pname, float32 param)
func Materialf(face GLenum, pname GLenum, param float32) {
C.glMaterialf(C.GLenum(face), C.GLenum(pname), C.GLfloat(param))
}
//void glMaterialfv (GLenum face, GLenum pname, const float *params)
func Materialfv(face GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glMaterialfv(C.GLenum(face), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glMateriali (GLenum face, GLenum pname, int param)
func Materiali(face GLenum, pname GLenum, param int) {
C.glMateriali(C.GLenum(face), C.GLenum(pname), C.GLint(param))
}
//void glMaterialiv (GLenum face, GLenum pname, const int *params)
func Materialiv(face GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params length")
}
C.glMaterialiv(C.GLenum(face), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glNewList (uint list, GLenum mode)
func NewList(list uint, mode GLenum) {
C.glNewList(C.GLuint(list), C.GLenum(mode))
}
//void glNormal3b (int8 nx, int8 ny, int8 nz)
func Normal3b(nx int8, ny int8, nz int8) {
C.glNormal3b(C.GLbyte(nx), C.GLbyte(ny), C.GLbyte(nz))
}
//void glNormal3bv (const int8 *v)
func Normal3bv(v *[3]int8) {
C.glNormal3bv((*C.GLbyte)(&v[0]))
}
//void glNormal3d (float64 nx, float64 ny, float64 nz)
func Normal3d(nx float64, ny float64, nz float64) {
C.glNormal3d(C.GLdouble(nx), C.GLdouble(ny), C.GLdouble(nz))
}
//void glNormal3dv (const float64 *v)
func Normal3dv(v *[3]float64) {
C.glNormal3dv((*C.GLdouble)(&v[0]))
}
//void glNormal3f (float32 nx, float32 ny, float32 nz)
func Normal3f(nx float32, ny float32, nz float32) {
C.glNormal3f(C.GLfloat(nx), C.GLfloat(ny), C.GLfloat(nz))
}
//void glNormal3fv (const float *v)
func Normal3fv(v *[3]float32) {
C.glNormal3fv((*C.GLfloat)(&v[0]))
}
//void glNormal3i (int nx, int ny, int nz)
func Normal3i(nx int, ny int, nz int) {
C.glNormal3i(C.GLint(nx), C.GLint(ny), C.GLint(nz))
}
//void glNormal3iv (const int *v)
func Normal3iv(v *[3]int32) {
C.glNormal3iv((*C.GLint)(&v[0]))
}
//void glNormal3s (int16 nx, int16 ny, int16 nz)
func Normal3s(nx int16, ny int16, nz int16) {
C.glNormal3s(C.GLshort(nx), C.GLshort(ny), C.GLshort(nz))
}
//void glNormal3sv (const int16 *v)
func Normal3sv(v *[3]int16) {
C.glNormal3sv((*C.GLshort)(&v[0]))
}
//void glNormalPointer (GLenum type, int stride, const GLvoid *pointer)
func NormalPointer(typ GLenum, stride int, pointer interface{}) {
C.glNormalPointer(C.GLenum(typ), C.GLsizei(stride), ptr(pointer))
}
//void glPassThrough (float32 token)
func PassThrough(token float32) {
C.glPassThrough(C.GLfloat(token))
}
//void glPixelStoref (GLenum pname, float param)
func PixelStoref(pname GLenum, param float32) {
C.glPixelStoref(C.GLenum(pname), C.GLfloat(param))
}
//void glPixelStorei (GLenum pname, int param)
func PixelStorei(pname GLenum, param int) {
C.glPixelStorei(C.GLenum(pname), C.GLint(param))
}
//void glPixelTransferf (GLenum pname, float32 param)
func PixelTransferf(pname GLenum, param float32) {
C.glPixelTransferf(C.GLenum(pname), C.GLfloat(param))
}
//void glPixelTransferi (GLenum pname, int param)
func PixelTransferi(pname GLenum, param int) {
C.glPixelTransferi(C.GLenum(pname), C.GLint(param))
}
//void glPixelZoom (float32 xfactor, float32 yfactor)
func PixelZoom(xfactor float32, yfactor float32) {
C.glPixelZoom(C.GLfloat(xfactor), C.GLfloat(yfactor))
}
//void glPointSize (float32 size)
func PointSize(size float32) {
C.glPointSize(C.GLfloat(size))
}
//void glPolygonMode (GLenum face, GLenum mode)
func PolygonMode(face GLenum, mode GLenum) {
C.glPolygonMode(C.GLenum(face), C.GLenum(mode))
}
//void glPolygonOffset (float32 factor, float32 units)
func PolygonOffset(factor float32, units float32) {
C.glPolygonOffset(C.GLfloat(factor), C.GLfloat(units))
}
//void glPolygonStipple (const uint8 *mask)
func PolygonStipple(mask *uint8) {
C.glPolygonStipple((*C.GLubyte)(mask))
}
//void glPopAttrib (void)
func PopAttrib() {
C.glPopAttrib()
}
//void glPopClientAttrib (void)
func PopClientAttrib() {
C.glPopClientAttrib()
}
//void glPopName (void)
func PopName() {
C.glPopName()
}
//void glPrimitiveRestartIndex(GLuint index)
func PrimitiveRestartIndex(index GLuint) {
C.glPrimitiveRestartIndex(C.GLuint(index))
}
//void glPushAttrib (GLbitfield mask)
func PushAttrib(mask GLbitfield) {
C.glPushAttrib(C.GLbitfield(mask))
}
//void glPushClientAttrib (GLbitfield mask)
func PushClientAttrib(mask GLbitfield) {
C.glPushClientAttrib(C.GLbitfield(mask))