gls.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. "math"
  15. "unsafe"
  16. "github.com/g3n/engine/util/logger"
  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. Fbos uint64 // Number of frame buffer objects
  33. Rbos uint64 // Number of render buffer objects
  34. }
  35. const (
  36. capUndef = 0
  37. capDisabled = 1
  38. capEnabled = 2
  39. uintUndef = math.MaxUint32
  40. intFalse = 0
  41. intTrue = 1
  42. )
  43. const (
  44. FloatSize = int32(unsafe.Sizeof(float32(0)))
  45. )