-
Notifications
You must be signed in to change notification settings - Fork 7
/
types_opengl.go
88 lines (70 loc) · 1.54 KB
/
types_opengl.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
//go:build !js
// +build !js
package gl
// Enum is equivalent to GLenum, and is normally used with one of the
// constants defined in this package.
type Enum uint32
// Attrib identifies the location of a specific attribute variable.
type Attrib struct {
Value uint
}
// Program identifies a compiled shader program.
type Program struct {
Value uint32
}
// Shader identifies a GLSL shader.
type Shader struct {
Value uint32
}
// Buffer identifies a GL buffer object.
type Buffer struct {
Value uint32
}
// Framebuffer identifies a GL framebuffer.
type Framebuffer struct {
Value uint32
}
// A Renderbuffer is a GL object that holds an image in an internal format.
type Renderbuffer struct {
Value uint32
}
// A Texture identifies a GL texture unit.
type Texture struct {
Value uint32
}
// Uniform identifies the location of a specific uniform variable.
type Uniform struct {
Value int32
}
var NoAttrib Attrib
var NoProgram Program
var NoShader Shader
var NoBuffer Buffer
var NoFramebuffer Framebuffer
var NoRenderbuffer Renderbuffer
var NoTexture Texture
var NoUniform Uniform
// Object is a generic interface for OpenGL objects
type Object interface {
Identifier() Enum
Name() uint32
}
// Implement Name() for the Object interface
func (p Program) Name() uint32 {
return p.Value
}
func (s Shader) Name() uint32 {
return s.Value
}
func (b Buffer) Name() uint32 {
return b.Value
}
func (fb Framebuffer) Name() uint32 {
return fb.Value
}
func (rb Renderbuffer) Name() uint32 {
return rb.Value
}
func (t Texture) Name() uint32 {
return t.Value
}