gls.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2016 The G3N Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package gls implements a loader of OpenGL functions for the platform
  5. // and a Go binding for selected OpenGL functions. The binding maintains
  6. // some cached state to minimize the number of C function calls.
  7. // The OpenGL function loader is generated by the "glapi2go" tool by
  8. // parsing the OpenGL "glcorearb.h" header file
  9. //
  10. // This package also contains abstractions for some OpenGL object such as Program,
  11. // Uniform, VBO and others.
  12. package gls
  13. import (
  14. "github.com/g3n/engine/util/logger"
  15. "math"
  16. "unsafe"
  17. )
  18. // Package logger
  19. var log = logger.New("GLS", logger.Default)
  20. // Stats contains counters of WebGL resources being used as well
  21. // the cumulative numbers of some WebGL calls for performance evaluation.
  22. type Stats struct {
  23. Shaders int // Current number of shader programs
  24. Vaos int // Number of Vertex Array Objects
  25. Buffers int // Number of Buffer Objects
  26. Textures int // Number of Textures
  27. Caphits uint64 // Cumulative number of hits for Enable/Disable
  28. UnilocHits uint64 // Cumulative number of uniform location cache hits
  29. UnilocMiss uint64 // Cumulative number of uniform location cache misses
  30. Unisets uint64 // Cumulative number of uniform sets
  31. Drawcalls uint64 // Cumulative number of draw calls
  32. }
  33. const (
  34. capUndef = 0
  35. capDisabled = 1
  36. capEnabled = 2
  37. uintUndef = math.MaxUint32
  38. intFalse = 0
  39. intTrue = 1
  40. )
  41. const (
  42. FloatSize = int32(unsafe.Sizeof(float32(0)))
  43. )