aboutsummaryrefslogtreecommitdiff
path: root/gl.go
blob: 82f237c095e600211b8b53861a0aeff5110bf885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
// 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)(&params[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)(&params[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(&params[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)(&params[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)(&params[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)(&params[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)(&params[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)(&params[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)(&params[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)(&params[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), &params[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)(&params[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)(&params[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)(&params[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)(&params[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)(&params[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)(&params[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))
}

//void glPushName (uint name)
func PushName(name uint) {
	C.glPushName(C.GLuint(name))
}

//void glRasterPos2d (float64 x, float64 y)
func RasterPos2d(x float64, y float64) {
	C.glRasterPos2d(C.GLdouble(x), C.GLdouble(y))
}

//void glRasterPos2dv (const float64 *v)
func RasterPos2dv(v *[2]float64) {
	C.glRasterPos2dv((*C.GLdouble)(&v[0]))
}

//void glRasterPos2f (float32 x, float32 y)
func RasterPos2f(x float32, y float32) {
	C.glRasterPos2f(C.GLfloat(x), C.GLfloat(y))
}

//void glRasterPos2fv (const float *v)
func RasterPos2fv(v *[2]float32) {
	C.glRasterPos2fv((*C.GLfloat)(&v[0]))
}

//void glRasterPos2i (int x, int y)
func RasterPos2i(x int, y int) {
	C.glRasterPos2i(C.GLint(x), C.GLint(y))
}

//void glRasterPos2iv (const int *v)
func RasterPos2iv(v *[2]int32) {
	C.glRasterPos2iv((*C.GLint)(&v[0]))
}

//void glRasterPos2s (int16 x, int16 y)
func RasterPos2s(x int16, y int16) {
	C.glRasterPos2s(C.GLshort(x), C.GLshort(y))
}

//void glRasterPos2sv (const int16 *v)
func RasterPos2sv(v *[2]int16) {
	C.glRasterPos2sv((*C.GLshort)(&v[0]))
}

//void glRasterPos3d (float64 x, float64 y, float64 z)
func RasterPos3d(x float64, y float64, z float64) {
	C.glRasterPos3d(C.GLdouble(x), C.GLdouble(y), C.GLdouble(z))
}

//void glRasterPos3dv (const float64 *v)
func RasterPos3dv(v *[3]float64) {
	C.glRasterPos3dv((*C.GLdouble)(&v[0]))
}

//void glRasterPos3f (float32 x, float32 y, float32 z)
func RasterPos3f(x float32, y float32, z float32) {
	C.glRasterPos3f(C.GLfloat(x), C.GLfloat(y), C.GLfloat(z))
}

//void glRasterPos3fv (const float *v)
func RasterPos3fv(v *[3]float32) {
	C.glRasterPos3fv((*C.GLfloat)(&v[0]))
}

//void glRasterPos3i (int x, int y, int z)
func RasterPos3i(x int, y int, z int) {
	C.glRasterPos3i(C.GLint(x), C.GLint(y), C.GLint(z))
}

//void glRasterPos3iv (const int *v)
func RasterPos3iv(v *[3]int32) {
	C.glRasterPos3iv((*C.GLint)(&v[0]))
}

//void glRasterPos3s (int16 x, int16 y, int16 z)
func RasterPos3s(x int16, y int16, z int16) {
	C.glRasterPos3s(C.GLshort(x), C.GLshort(y), C.GLshort(z))
}

//void glRasterPos3sv (const int16 *v)
func RasterPos3sv(v *[3]int16) {
	C.glRasterPos3sv((*C.GLshort)(&v[0]))
}

//void glRasterPos4d (float64 x, float64 y, float64 z, float64 w)
func RasterPos4d(x float64, y float64, z float64, w float64) {
	C.glRasterPos4d(C.GLdouble(x), C.GLdouble(y), C.GLdouble(z), C.GLdouble(w))
}

//void glRasterPos4dv (const float64 *v)
func RasterPos4dv(v *[3]float64) {
	C.glRasterPos4dv((*C.GLdouble)(&v[0]))
}

//void glRasterPos4f (float32 x, float32 y, float32 z, float32 w)
func RasterPos4f(x float32, y float32, z float32, w float32) {
	C.glRasterPos4f(C.GLfloat(x), C.GLfloat(y), C.GLfloat(z), C.GLfloat(w))
}

//void glRasterPos4fv (const float *v)
func RasterPos4fv(v *[4]float32) {
	C.glRasterPos4fv((*C.GLfloat)(&v[0]))
}

//void glRasterPos4i (int x, int y, int z, int w)
func RasterPos4i(x int, y int, z int, w int) {
	C.glRasterPos4i(C.GLint(x), C.GLint(y), C.GLint(z), C.GLint(w))
}

//void glRasterPos4iv (const int *v)
func RasterPos4iv(v *[4]int32) {
	C.glRasterPos4iv((*C.GLint)(&v[0]))
}

//void glRasterPos4s (int16 x, int16 y, int16 z, int16 w)
func RasterPos4s(x int16, y int16, z int16, w int16) {
	C.glRasterPos4s(C.GLshort(x), C.GLshort(y), C.GLshort(z), C.GLshort(w))
}

//void glRasterPos4sv (const int16 *v)
func RasterPos4sv(v *[4]int16) {
	C.glRasterPos4sv((*C.GLshort)(&v[0]))
}

//void glReadBuffer (GLenum mode)
func ReadBuffer(mode GLenum) {
	C.glReadBuffer(C.GLenum(mode))
}

//void glReadPixels (int x, int y, int width, int height, GLenum format, GLenum type, GLvoid *pixels)
func ReadPixels(x int, y int, width int, height int, format, typ GLenum, pixels interface{}) {
	C.glReadPixels(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height),
		C.GLenum(format), C.GLenum(typ), ptr(pixels))
}

//void glRectd (float64 x1, float64 y1, float64 x2, float64 y2)
func Rectd(x1 float64, y1 float64, x2 float64, y2 float64) {
	C.glRectd(C.GLdouble(x1), C.GLdouble(y1), C.GLdouble(x2), C.GLdouble(y2))
}

//void glRectdv (const float64 *v1, const float64 *v2)
func Rectdv(a, b *[2]float64) {
	C.glRectdv((*C.GLdouble)(&a[0]), (*C.GLdouble)(&b[0]))
}

//void glRectf (float32 x1, float32 y1, float32 x2, float32 y2)
func Rectf(x1 float32, y1 float32, x2 float32, y2 float32) {
	C.glRectf(C.GLfloat(x1), C.GLfloat(y1), C.GLfloat(x2), C.GLfloat(y2))
}

//void glRectfv (const float *v1, const float *v2)
func Rectfv(a, b *[2]float32) {
	C.glRectfv((*C.GLfloat)(&a[0]), (*C.GLfloat)(&b[0]))
}

//void glRecti (int x1, int y1, int x2, int y2)
func Recti(x1 int, y1 int, x2 int, y2 int) {
	C.glRecti(C.GLint(x1), C.GLint(y1), C.GLint(x2), C.GLint(y2))
}

//void glRectiv (const int *v1, const int *v2)
func Rectiv(a, b *[2]int32) {
	C.glRectiv((*C.GLint)(&a[0]), (*C.GLint)(&b[0]))
}

//void glRects (int16 x1, int16 y1, int16 x2, int16 y2)
func Rects(x1 int16, y1 int16, x2 int16, y2 int16) {
	C.glRects(C.GLshort(x1), C.GLshort(y1), C.GLshort(x2), C.GLshort(y2))
}

//void glRectsv (const int16 *v1, const int16 *v2)
func Rectsv(a, b *[2]int16) {
	C.glRectsv((*C.GLshort)(&a[0]), (*C.GLshort)(&b[0]))
}

//int glRenderMode (GLenum mode)
func RenderMode(mode GLenum) int {
	return int(C.glRenderMode(C.GLenum(mode)))
}

//void glScissor (int x, int y, int width, int height)
func Scissor(x int, y int, width int, height int) {
	C.glScissor(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height))
}

//void glSelectBuffer (GLsizei size, uint *buffer)
func SelectBuffer(buffer []uint32) {
	if len(buffer) > 0 {
		C.glSelectBuffer(C.GLsizei(len(buffer)), (*C.GLuint)(&buffer[0]))
	}
}

//void glShadeModel (GLenum mode)
func ShadeModel(mode GLenum) {
	C.glShadeModel(C.GLenum(mode))
}

//void glStencilFunc (GLenum func, int ref, uint mask)
func StencilFunc(func_ GLenum, ref int, mask uint) {
	C.glStencilFunc(C.GLenum(func_), C.GLint(ref), C.GLuint(mask))
}

//void glStencilMask (uint mask)
func StencilMask(mask uint) {
	C.glStencilMask(C.GLuint(mask))
}

//void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass)
func StencilOp(fail GLenum, zfail GLenum, zpass GLenum) {
	C.glStencilOp(C.GLenum(fail), C.GLenum(zfail), C.GLenum(zpass))
}

//void glViewport (int x, int y, int width, int height)
func Viewport(x int, y int, width int, height int) {
	C.glViewport(C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height))
}

// void glGetFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname, GLint* params);
//func GetFramebufferAttachmentParameter (target, attachment, pname GLenum, params []int32) {
//	if len(params) == 0 {
//		panic("Invalid params size")
//	}
//  C.glGetFramebufferAttachmentParameter (C.GLenum(target), C.GLenum(attachment),
//  	C.GLenum(pname), (*C.GLint)(&params[0]))
//}

func Init() GLenum {
	C.SetGlewExperimental(C.GLboolean(1))
	return GLenum(C.glewInit())
}