TextureID.go 1.3 KB

12345678910111213141516171819202122232425
  1. package imgui
  2. // #include "imguiWrapperTypes.h"
  3. import "C"
  4. // TextureID is a user data to identify a texture.
  5. //
  6. // TextureID is a uintptr used to pass renderer-agnostic texture references around until it hits your render function.
  7. // imgui knows nothing about what those bits represent, it just passes them around. It is up to you to decide what you want the value to carry!
  8. //
  9. // It could be an identifier to your OpenGL texture (cast as uint32), a key to your custom engine material, etc.
  10. // At the end of the chain, your renderer takes this value to cast it back into whatever it needs to select a current texture to render.
  11. //
  12. // To display a custom image/texture within an imgui window, you may use functions such as imgui.Image().
  13. // imgui will generate the geometry and draw calls using the TextureID that you passed and which your renderer can use.
  14. // It is your responsibility to get textures uploaded to your GPU.
  15. //
  16. // Note: Internally, the value is based on a pointer type, so its size is dependent on your architecture.
  17. // For the most part, this will be 64bits on current systems (in 2018).
  18. // Beware: This value must never be a Go pointer, because the value escapes the runtime!
  19. type TextureID uintptr
  20. func (id TextureID) handle() C.IggTextureID {
  21. return C.IggTextureID(id)
  22. }