-
Notifications
You must be signed in to change notification settings - Fork 52
/
texture.go
516 lines (424 loc) · 17.9 KB
/
texture.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
// 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
// #include "gl.h"
import "C"
import "unsafe"
//bool glAreTexturesResident (GLsizei n, const uint *textures, bool *residences)
func AreTexturesResident(textures []uint, residences []bool) bool {
sz := len(textures)
if sz == 0 {
return false
}
if sz != len(residences) {
panic("Residences slice must be equal in length to textures slice.")
}
ret := C.glAreTexturesResident(
C.GLsizei(sz),
(*C.GLuint)(unsafe.Pointer(&textures[0])),
(*C.GLboolean)(unsafe.Pointer(&residences[0])),
)
if ret == TRUE {
return true
}
return false
}
func ActiveTexture(texture GLenum) { C.glActiveTexture(C.GLenum(texture)) }
// Texture
type Texture Object
// Create single texture object
func GenTexture() Texture {
var b C.GLuint
C.glGenTextures(1, &b)
return Texture(b)
}
// Fill slice with new textures
func GenTextures(textures []Texture) {
if len(textures) > 0 {
C.glGenTextures(C.GLsizei(len(textures)), (*C.GLuint)(&textures[0]))
}
}
// Delete texture object
func (texture Texture) Delete() {
b := C.GLuint(texture)
C.glDeleteTextures(1, &b)
}
// Delete all textures in slice
func DeleteTextures(textures []Texture) {
if len(textures) > 0 {
C.glDeleteTextures(C.GLsizei(len(textures)), (*C.GLuint)(&textures[0]))
}
}
// Bind this texture as target
func (texture Texture) Bind(target GLenum) {
C.glBindTexture(C.GLenum(target), C.GLuint(texture))
}
// Unbind this texture
func (texture Texture) Unbind(target GLenum) {
C.glBindTexture(C.GLenum(target), 0)
}
//void glTexImage1D (GLenum target, int level, int internalformat, int width, int border, GLenum format, GLenum type, const GLvoid *pixels)
func TexImage1D(target GLenum, level int, internalformat int, width int, border int, format, typ GLenum, pixels interface{}) {
C.glTexImage1D(C.GLenum(target), C.GLint(level), C.GLint(internalformat),
C.GLsizei(width), C.GLint(border), C.GLenum(format), C.GLenum(typ),
ptr(pixels))
}
//void glTexImage2D (GLenum target, int level, int internalformat, int width, int height, int border, GLenum format, GLenum type, const GLvoid *pixels)
func TexImage2D(target GLenum, level int, internalformat int, width int, height int, border int, format, typ GLenum, pixels interface{}) {
C.glTexImage2D(C.GLenum(target), C.GLint(level), C.GLint(internalformat),
C.GLsizei(width), C.GLsizei(height), C.GLint(border), C.GLenum(format),
C.GLenum(typ), ptr(pixels))
}
//void glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLint border, GLsizei imagesize, const GLvoid * data )
func CompressedTexImage2D(target GLenum, level int, internalformat GLenum, width int, height int, border int, imagesize int, data interface{}) {
C.glCompressedTexImage2D(C.GLenum(target), C.GLint(level), C.GLenum(internalformat),
C.GLsizei(width), C.GLsizei(height), C.GLint(border), C.GLsizei(imagesize), ptr(data))
}
//void glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img )
func GetCompressedTexImage(target GLenum, lod int, data interface{}) {
C.glGetCompressedTexImage(C.GLenum(target), C.GLint(lod), ptr(data))
}
//void glTexImage3D (GLenum target, int level, int internalformat, int width, int height, int depth, int border, GLenum format, GLenum type, const GLvoid *pixels)
func TexImage3D(target GLenum, level int, internalformat int, width, height, depth int, border int, format, typ GLenum, pixels interface{}) {
C.glTexImage3D(C.GLenum(target), C.GLint(level), C.GLint(internalformat),
C.GLsizei(width), C.GLsizei(height), C.GLsizei(depth), C.GLint(border),
C.GLenum(format), C.GLenum(typ), ptr(pixels))
}
//void glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer)
func TexBuffer(target, internalformat GLenum, buffer Buffer) {
C.glTexBuffer(C.GLenum(target), C.GLenum(internalformat), C.GLuint(buffer))
}
//void glPixelMapfv (GLenum map, int mapsize, const float *values)
func PixelMapfv(map_ GLenum, mapsize int, values *float32) {
C.glPixelMapfv(C.GLenum(map_), C.GLsizei(mapsize), (*C.GLfloat)(values))
}
//void glPixelMapuiv (GLenum map, int mapsize, const uint *values)
func PixelMapuiv(map_ GLenum, mapsize int, values *uint32) {
C.glPixelMapuiv(C.GLenum(map_), C.GLsizei(mapsize), (*C.GLuint)(values))
}
//void glPixelMapusv (GLenum map, int mapsize, const uint16 *values)
func PixelMapusv(map_ GLenum, mapsize int, values *uint16) {
C.glPixelMapusv(C.GLenum(map_), C.GLsizei(mapsize), (*C.GLushort)(values))
}
//void glTexSubImage1D (GLenum target, int level, int xoffset, int width, GLenum format, GLenum type, const GLvoid *pixels)
func TexSubImage1D(target GLenum, level int, xoffset int, width int, format, typ GLenum, pixels interface{}) {
C.glTexSubImage1D(C.GLenum(target), C.GLint(level), C.GLint(xoffset),
C.GLsizei(width), C.GLenum(format), C.GLenum(typ), ptr(pixels))
}
//void glTexSubImage2D (GLenum target, int level, int xoffset, int yoffset, int width, int height, GLenum format, GLenum type, const GLvoid *pixels)
func TexSubImage2D(target GLenum, level int, xoffset int, yoffset int, width int, height int, format, typ GLenum, pixels interface{}) {
C.glTexSubImage2D(C.GLenum(target), C.GLint(level), C.GLint(xoffset),
C.GLint(yoffset), C.GLsizei(width), C.GLsizei(height), C.GLenum(format),
C.GLenum(typ), ptr(pixels))
}
//void glTexImage3D (GLenum target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, GLenum format, GLenum type, const GLvoid *pixels)
func TexSubImage3D(target GLenum, level int, xoffset, yoffset, zoffset, width, height, depth int, format, typ GLenum, pixels interface{}) {
C.glTexSubImage3D(C.GLenum(target), C.GLint(level),
C.GLint(xoffset), C.GLint(yoffset), C.GLint(zoffset),
C.GLsizei(width), C.GLsizei(height), C.GLsizei(depth),
C.GLenum(format), C.GLenum(typ), ptr(pixels))
}
//void glCopyTexImage1D (GLenum target, int level, GLenum internalFormat, int x, int y, int width, int border)
func CopyTexImage1D(target GLenum, level int, internalFormat GLenum, x int, y int, width int, border int) {
C.glCopyTexImage1D(C.GLenum(target), C.GLint(level), C.GLenum(internalFormat), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLint(border))
}
//void glCopyTexImage2D (GLenum target, int level, GLenum internalFormat, int x, int y, int width, int height, int border)
func CopyTexImage2D(target GLenum, level int, internalFormat GLenum, x int, y int, width int, height int, border int) {
C.glCopyTexImage2D(C.GLenum(target), C.GLint(level), C.GLenum(internalFormat), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height), C.GLint(border))
}
//void glCopyTexSubImage1D (GLenum target, int level, int xoffset, int x, int y, int width)
func CopyTexSubImage1D(target GLenum, level int, xoffset int, x int, y int, width int) {
C.glCopyTexSubImage1D(C.GLenum(target), C.GLint(level), C.GLint(xoffset), C.GLint(x), C.GLint(y), C.GLsizei(width))
}
//void glCopyTexSubImage2D (GLenum target, int level, int xoffset, int yoffset, int x, int y, int width, int height)
func CopyTexSubImage2D(target GLenum, level int, xoffset int, yoffset int, x int, y int, width int, height int) {
C.glCopyTexSubImage2D(C.GLenum(target), C.GLint(level), C.GLint(xoffset), C.GLint(yoffset), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height))
}
// TODO 3D textures
//void glTexEnvf (GLenum target, GLenum pname, float32 param)
func TexEnvf(target GLenum, pname GLenum, param float32) {
C.glTexEnvf(C.GLenum(target), C.GLenum(pname), C.GLfloat(param))
}
//void glTexEnvfv (GLenum target, GLenum pname, const float *params)
func TexEnvfv(target GLenum, pname GLenum, params []float32) {
if len(params) != 1 && len(params) != 4 {
panic("Invalid params slice length")
}
C.glTexEnvfv(C.GLenum(target), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glTexEnvi (GLenum target, GLenum pname, int param)
func TexEnvi(target GLenum, pname GLenum, param int) {
C.glTexEnvi(C.GLenum(target), C.GLenum(pname), C.GLint(param))
}
//void glTexEnviv (GLenum target, GLenum pname, const int *params)
func TexEnviv(target GLenum, pname GLenum, params []int32) {
if len(params) != 1 && len(params) != 4 {
panic("Invalid params slice length")
}
C.glTexEnviv(C.GLenum(target), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glTexGend (GLenum coord, GLenum pname, float64 param)
func TexGend(coord GLenum, pname GLenum, param float64) {
C.glTexGend(C.GLenum(coord), C.GLenum(pname), C.GLdouble(param))
}
//void glTexGendv (GLenum coord, GLenum pname, const float64 *params)
func TexGendv(coord GLenum, pname GLenum, params []float64) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glTexGendv(C.GLenum(coord), C.GLenum(pname), (*C.GLdouble)(¶ms[0]))
}
//void glTexGenf (GLenum coord, GLenum pname, float32 param)
func TexGenf(coord GLenum, pname GLenum, param float32) {
C.glTexGenf(C.GLenum(coord), C.GLenum(pname), C.GLfloat(param))
}
//void glTexGenfv (GLenum coord, GLenum pname, const float *params)
func TexGenfv(coord GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glTexGenfv(C.GLenum(coord), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glTexGeni (GLenum coord, GLenum pname, int param)
func TexGeni(coord GLenum, pname GLenum, param int) {
C.glTexGeni(C.GLenum(coord), C.GLenum(pname), C.GLint(param))
}
//void glTexGeniv (GLenum coord, GLenum pname, const int *params)
func TexGeniv(coord GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glTexGeniv(C.GLenum(coord), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glTexParameterf (GLenum target, GLenum pname, float32 param)
func TexParameterf(target GLenum, pname GLenum, param float32) {
C.glTexParameterf(C.GLenum(target), C.GLenum(pname), C.GLfloat(param))
}
//void glTexParameterfv (GLenum target, GLenum pname, const float *params)
func TexParameterfv(target GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glTexParameterfv(C.GLenum(target), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glTexParameteri (GLenum target, GLenum pname, int param)
func TexParameteri(target GLenum, pname GLenum, param int) {
C.glTexParameteri(C.GLenum(target), C.GLenum(pname), C.GLint(param))
}
//void glTexParameteriv (GLenum target, GLenum pname, const int *params)
func TexParameteriv(target GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glTexParameteriv(C.GLenum(target), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glPrioritizeTextures (GLsizei n, const uint *textures, const GLclampf *priorities)
func PrioritizeTextures(n int, textures *uint32, priorities *GLclampf) {
C.glPrioritizeTextures(C.GLsizei(n), (*C.GLuint)(textures), (*C.GLclampf)(priorities))
}
//void glGetTexEnvfv (GLenum target, GLenum pname, float *params)
func GetTexEnvfv(target GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexEnvfv(C.GLenum(target), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glGetTexEnviv (GLenum target, GLenum pname, int *params)
func GetTexEnviv(target GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexEnviv(C.GLenum(target), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glGetTexGendv (GLenum coord, GLenum pname, float64 *params)
func GetTexGendv(coord GLenum, pname GLenum, params []float64) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexGendv(C.GLenum(coord), C.GLenum(pname), (*C.GLdouble)(¶ms[0]))
}
//void glGetTexGenfv (GLenum coord, GLenum pname, float *params)
func GetTexGenfv(coord GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexGenfv(C.GLenum(coord), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glGetTexGeniv (GLenum coord, GLenum pname, int *params)
func GetTexGeniv(coord GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexGeniv(C.GLenum(coord), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glGetTexImage (GLenum target, int level, GLenum format, GLenum type, GLvoid *pixels)
func GetTexImage(target GLenum, level int, format, typ GLenum, pixels interface{}) {
C.glGetTexImage(C.GLenum(target), C.GLint(level), C.GLenum(format),
C.GLenum(typ), ptr(pixels))
}
//void glGetTexLevelParameterfv (GLenum target, int level, GLenum pname, float *params)
func GetTexLevelParameterfv(target GLenum, level int, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexLevelParameterfv(C.GLenum(target), C.GLint(level), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glGetTexLevelParameteriv (GLenum target, int level, GLenum pname, int *params)
func GetTexLevelParameteriv(target GLenum, level int, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexLevelParameteriv(C.GLenum(target), C.GLint(level), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
//void glGetTexParameterfv (GLenum target, GLenum pname, float *params)
func GetTexParameterfv(target GLenum, pname GLenum, params []float32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexParameterfv(C.GLenum(target), C.GLenum(pname), (*C.GLfloat)(¶ms[0]))
}
//void glGetTexParameteriv (GLenum target, GLenum pname, int *params)
func GetTexParameteriv(target GLenum, pname GLenum, params []int32) {
if len(params) == 0 {
panic("Invalid params slice length")
}
C.glGetTexParameteriv(C.GLenum(target), C.GLenum(pname), (*C.GLint)(¶ms[0]))
}
func GenerateMipmap(target GLenum) {
C.glGenerateMipmap(C.GLenum(target))
}
//void glTexCoord1d (float64 s)
func TexCoord1d(s float64) {
C.glTexCoord1d(C.GLdouble(s))
}
//void glTexCoord1dv (const float64 *v)
func TexCoord1dv(v *[1]float64) {
C.glTexCoord1dv((*C.GLdouble)(&v[0]))
}
//void glTexCoord1f (float32 s)
func TexCoord1f(s float32) {
C.glTexCoord1f(C.GLfloat(s))
}
//void glTexCoord1fv (const float *v)
func TexCoord1fv(v *[1]float32) {
C.glTexCoord1fv((*C.GLfloat)(&v[0]))
}
//void glTexCoord1i (int s)
func TexCoord1i(s int) {
C.glTexCoord1i(C.GLint(s))
}
//void glTexCoord1iv (const int *v)
func TexCoord1iv(v *[1]int32) {
C.glTexCoord1iv((*C.GLint)(&v[0]))
}
//void glTexCoord1s (int16 s)
func TexCoord1s(s int16) {
C.glTexCoord1s(C.GLshort(s))
}
//void glTexCoord1sv (const int16 *v)
func TexCoord1sv(v *[1]int16) {
C.glTexCoord1sv((*C.GLshort)(&v[0]))
}
//void glTexCoord2d (float64 s, float64 t)
func TexCoord2d(s float64, t float64) {
C.glTexCoord2d(C.GLdouble(s), C.GLdouble(t))
}
//void glTexCoord2dv (const float64 *v)
func TexCoord2dv(v *[2]float64) {
C.glTexCoord2dv((*C.GLdouble)(&v[0]))
}
//void glTexCoord2f (float32 s, float32 t)
func TexCoord2f(s float32, t float32) {
C.glTexCoord2f(C.GLfloat(s), C.GLfloat(t))
}
//void glTexCoord2fv (const float *v)
func TexCoord2fv(v *[2]float32) {
C.glTexCoord2fv((*C.GLfloat)(&v[0]))
}
//void glTexCoord2i (int s, int t)
func TexCoord2i(s int, t int) {
C.glTexCoord2i(C.GLint(s), C.GLint(t))
}
//void glTexCoord2iv (const int *v)
func TexCoord2iv(v *[2]int32) {
C.glTexCoord2iv((*C.GLint)(&v[0]))
}
//void glTexCoord2s (int16 s, int16 t)
func TexCoord2s(s int16, t int16) {
C.glTexCoord2s(C.GLshort(s), C.GLshort(t))
}
//void glTexCoord2sv (const int16 *v)
func TexCoord2sv(v *[2]int16) {
C.glTexCoord2sv((*C.GLshort)(&v[0]))
}
//void glTexCoord3d (float64 s, float64 t, float64 r)
func TexCoord3d(s float64, t float64, r float64) {
C.glTexCoord3d(C.GLdouble(s), C.GLdouble(t), C.GLdouble(r))
}
//void glTexCoord3dv (const float64 *v)
func TexCoord3dv(v *[3]float64) {
C.glTexCoord3dv((*C.GLdouble)(&v[0]))
}
//void glTexCoord3f (float32 s, float32 t, float32 r)
func TexCoord3f(s float32, t float32, r float32) {
C.glTexCoord3f(C.GLfloat(s), C.GLfloat(t), C.GLfloat(r))
}
//void glTexCoord3fv (const float *v)
func TexCoord3fv(v *[3]float32) {
C.glTexCoord3fv((*C.GLfloat)(&v[0]))
}
//void glTexCoord3i (int s, int t, int r)
func TexCoord3i(s int, t int, r int) {
C.glTexCoord3i(C.GLint(s), C.GLint(t), C.GLint(r))
}
//void glTexCoord3iv (const int *v)
func TexCoord3iv(v *[3]int32) {
C.glTexCoord3iv((*C.GLint)(&v[0]))
}
//void glTexCoord3s (int16 s, int16 t, int16 r)
func TexCoord3s(s int16, t int16, r int16) {
C.glTexCoord3s(C.GLshort(s), C.GLshort(t), C.GLshort(r))
}
//void glTexCoord3sv (const int16 *v)
func TexCoord3sv(v *[3]int16) {
C.glTexCoord3sv((*C.GLshort)(&v[0]))
}
//void glTexCoord4d (float64 s, float64 t, float64 r, float64 q)
func TexCoord4d(s float64, t float64, r float64, q float64) {
C.glTexCoord4d(C.GLdouble(s), C.GLdouble(t), C.GLdouble(r), C.GLdouble(q))
}
//void glTexCoord4dv (const float64 *v)
func TexCoord4dv(v *[4]float64) {
C.glTexCoord4dv((*C.GLdouble)(&v[0]))
}
//void glTexCoord4f (float32 s, float32 t, float32 r, float32 q)
func TexCoord4f(s float32, t float32, r float32, q float32) {
C.glTexCoord4f(C.GLfloat(s), C.GLfloat(t), C.GLfloat(r), C.GLfloat(q))
}
//void glTexCoord4fv (const float *v)
func TexCoord4fv(v *[4]float32) {
C.glTexCoord4fv((*C.GLfloat)(&v[0]))
}
//void glTexCoord4i (int s, int t, int r, int q)
func TexCoord4i(s int, t int, r int, q int) {
C.glTexCoord4i(C.GLint(s), C.GLint(t), C.GLint(r), C.GLint(q))
}
//void glTexCoord4iv (const int *v)
func TexCoord4iv(v *[4]int32) {
C.glTexCoord4iv((*C.GLint)(&v[0]))
}
//void glTexCoord4s (int16 s, int16 t, int16 r, int16 q)
func TexCoord4s(s int16, t int16, r int16, q int16) {
C.glTexCoord4s(C.GLshort(s), C.GLshort(t), C.GLshort(r), C.GLshort(q))
}
//void glTexCoord4sv (const int16 *v)
func TexCoord4sv(v *[4]int16) {
C.glTexCoord4sv((*C.GLshort)(&v[0]))
}
//void glTexCoordPointer (int size, GLenum type, int stride, const GLvoid *pointer)
func TexCoordPointer(size int, typ GLenum, stride int, pointer interface{}) {
C.glTexCoordPointer(C.GLint(size), C.GLenum(typ), C.GLsizei(stride),
ptr(pointer))
}