forked from go-gl-legacy/gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertexarray.go
41 lines (32 loc) · 882 Bytes
/
vertexarray.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
// 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"
// Vertex Arrays
type VertexArray Object
func GenVertexArray() VertexArray {
var a C.GLuint
C.glGenVertexArrays(1, &a)
return VertexArray(a)
}
func GenVertexArrays(arrays []VertexArray) {
if len(arrays) > 0 {
C.glGenVertexArrays(C.GLsizei(len(arrays)), (*C.GLuint)(&arrays[0]))
}
}
func (array VertexArray) Delete() {
C.glDeleteVertexArrays(1, (*C.GLuint)(&array))
}
func DeleteVertexArrays(arrays []VertexArray) {
if len(arrays) > 0 {
C.glDeleteVertexArrays(C.GLsizei(len(arrays)), (*C.GLuint)(&arrays[0]))
}
}
func (array VertexArray) Bind() {
C.glBindVertexArray(C.GLuint(array))
}
func (array VertexArray) Unbind() {
C.glBindVertexArray(C.GLuint(0))
}