|
@@ -19,8 +19,8 @@ import (
|
|
|
// methods to call OpenGL functions.
|
|
// methods to call OpenGL functions.
|
|
|
type GLS struct {
|
|
type GLS struct {
|
|
|
stats Stats // statistics
|
|
stats Stats // statistics
|
|
|
- prog *Program // current active program
|
|
|
|
|
- programs map[*Program]bool // programs cache
|
|
|
|
|
|
|
+ prog *Program // current active shader program
|
|
|
|
|
+ programs map[*Program]bool // shader programs cache
|
|
|
checkErrors bool // check openGL API errors flag
|
|
checkErrors bool // check openGL API errors flag
|
|
|
viewportX int32 // cached last set viewport x
|
|
viewportX int32 // cached last set viewport x
|
|
|
viewportY int32 // cached last set viewport y
|
|
viewportY int32 // cached last set viewport y
|
|
@@ -51,7 +51,7 @@ type GLS struct {
|
|
|
type Stats struct {
|
|
type Stats struct {
|
|
|
Shaders int // Current number of shader programs
|
|
Shaders int // Current number of shader programs
|
|
|
Vaos int // Number of Vertex Array Objects
|
|
Vaos int // Number of Vertex Array Objects
|
|
|
- Vbos int // Number of Vertex Buffer Objects
|
|
|
|
|
|
|
+ Buffers int // Number of Buffer Objects
|
|
|
Textures int // Number of Textures
|
|
Textures int // Number of Textures
|
|
|
Caphits uint64 // Cummulative number of hits for Enable/Disable
|
|
Caphits uint64 // Cummulative number of hits for Enable/Disable
|
|
|
UnilocHits uint64 // Cummulative number of uniform location cache hits
|
|
UnilocHits uint64 // Cummulative number of uniform location cache hits
|
|
@@ -274,9 +274,10 @@ func (gs *GLS) CreateShader(stype uint32) uint32 {
|
|
|
return uint32(h)
|
|
return uint32(h)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (gs *GLS) DeleteBuffers(vbos ...uint32) {
|
|
|
|
|
|
|
+func (gs *GLS) DeleteBuffers(bufs ...uint32) {
|
|
|
|
|
|
|
|
- C.glDeleteBuffers(C.GLsizei(len(vbos)), (*C.GLuint)(&vbos[0]))
|
|
|
|
|
|
|
+ C.glDeleteBuffers(C.GLsizei(len(bufs)), (*C.GLuint)(&bufs[0]))
|
|
|
|
|
+ gs.stats.Buffers -= len(bufs)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (gs *GLS) DeleteShader(shader uint32) {
|
|
func (gs *GLS) DeleteShader(shader uint32) {
|
|
@@ -298,6 +299,7 @@ func (gs *GLS) DeleteTextures(tex ...uint32) {
|
|
|
func (gs *GLS) DeleteVertexArrays(vaos ...uint32) {
|
|
func (gs *GLS) DeleteVertexArrays(vaos ...uint32) {
|
|
|
|
|
|
|
|
C.glDeleteVertexArrays(C.GLsizei(len(vaos)), (*C.GLuint)(&vaos[0]))
|
|
C.glDeleteVertexArrays(C.GLsizei(len(vaos)), (*C.GLuint)(&vaos[0]))
|
|
|
|
|
+ gs.stats.Vaos -= len(vaos)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (gs *GLS) DepthFunc(mode uint32) {
|
|
func (gs *GLS) DepthFunc(mode uint32) {
|
|
@@ -376,7 +378,7 @@ func (gs *GLS) GenBuffer() uint32 {
|
|
|
|
|
|
|
|
var buf uint32
|
|
var buf uint32
|
|
|
C.glGenBuffers(1, (*C.GLuint)(&buf))
|
|
C.glGenBuffers(1, (*C.GLuint)(&buf))
|
|
|
- gs.stats.Vbos++
|
|
|
|
|
|
|
+ gs.stats.Buffers++
|
|
|
return buf
|
|
return buf
|
|
|
}
|
|
}
|
|
|
|
|
|