Start transition to github.com/AllenDang/cimgui-go for imgui because the old wrapper is now depcreated. This is auto generated so has much better chance of being supported, and we get latest imgui always (including docking!)

This commit is contained in:
bloeys
2023-07-24 01:05:42 +04:00
parent abb45e4c4a
commit a735e01a77
5 changed files with 151 additions and 96 deletions

View File

@ -3,12 +3,12 @@ package engine
import (
"runtime"
newimgui "github.com/AllenDang/cimgui-go"
"github.com/bloeys/nmage/assert"
"github.com/bloeys/nmage/input"
"github.com/bloeys/nmage/renderer"
"github.com/bloeys/nmage/timing"
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/inkyblackness/imgui-go/v4"
"github.com/veandco/go-sdl2/sdl"
)
@ -26,8 +26,9 @@ type Window struct {
func (w *Window) handleInputs() {
input.EventLoopStart()
imIO := imgui.CurrentIO()
imIO := newimgui.CurrentIO()
// @TODO: Would be nice to have imgui package process its own events via a callback instead of it being part of engine code
for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
//Fire callbacks
@ -49,13 +50,14 @@ func (w *Window) handleInputs() {
input.HandleKeyboardEvent(e)
if e.Type == sdl.KEYDOWN {
imIO.KeyPress(int(e.Keysym.Scancode))
// @TODO: Move to new ImGui input system
// imIO.KeyPress(int(e.Keysym.Scancode))
} else if e.Type == sdl.KEYUP {
imIO.KeyRelease(int(e.Keysym.Scancode))
// imIO.KeyRelease(int(e.Keysym.Scancode))
}
case *sdl.TextInputEvent:
imIO.AddInputCharacters(string(e.Text[:]))
// imIO.AddInputCharacters(string(e.Text[:]))
case *sdl.MouseButtonEvent:
input.HandleMouseBtnEvent(e)
@ -74,16 +76,16 @@ func (w *Window) handleInputs() {
}
// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
x, y, _ := sdl.GetMouseState()
imIO.SetMousePosition(imgui.Vec2{X: float32(x), Y: float32(y)})
// x, y, _ := sdl.GetMouseState()
// imIO.SetMousePosition(imgui.Vec2{X: float32(x), Y: float32(y)})
imIO.SetMouseButtonDown(0, input.MouseDown(sdl.BUTTON_LEFT))
imIO.SetMouseButtonDown(1, input.MouseDown(sdl.BUTTON_RIGHT))
imIO.SetMouseButtonDown(2, input.MouseDown(sdl.BUTTON_MIDDLE))
imIO.KeyShift(sdl.SCANCODE_LSHIFT, sdl.SCANCODE_RSHIFT)
imIO.KeyCtrl(sdl.SCANCODE_LCTRL, sdl.SCANCODE_RCTRL)
imIO.KeyAlt(sdl.SCANCODE_LALT, sdl.SCANCODE_RALT)
// imIO.KeyShift(sdl.SCANCODE_LSHIFT, sdl.SCANCODE_RSHIFT)
// imIO.KeyCtrl(sdl.SCANCODE_LCTRL, sdl.SCANCODE_RCTRL)
// imIO.KeyAlt(sdl.SCANCODE_LALT, sdl.SCANCODE_RALT)
}
func (w *Window) handleWindowResize() {

3
go.mod
View File

@ -9,5 +9,6 @@ require github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6
require (
github.com/bloeys/assimp-go v0.4.4
github.com/bloeys/gglm v0.43.0
github.com/inkyblackness/imgui-go/v4 v4.6.0
)
require github.com/AllenDang/cimgui-go v0.0.0-20230720025235-f2ff398a66b2

15
go.sum
View File

@ -1,21 +1,10 @@
github.com/AllenDang/cimgui-go v0.0.0-20230720025235-f2ff398a66b2 h1:3HA/5qD8Rimxz/y1sLyVaM7ws1dzjXzMt4hOBiwHggo=
github.com/AllenDang/cimgui-go v0.0.0-20230720025235-f2ff398a66b2/go.mod h1:iNfbIyOBN8k3XScMxULbrwYbPsXEAUD0Jb6UwrspQb8=
github.com/bloeys/assimp-go v0.4.4 h1:Yn5e/RpE0Oes0YMBy8O7KkwAO4R/RpgrZPJCt08dVIU=
github.com/bloeys/assimp-go v0.4.4/go.mod h1:my3yRxT7CfOztmvi+0svmwbaqw0KFrxaHxncoyaEIP0=
github.com/bloeys/gglm v0.43.0 h1:ZpOghR3PHfpkigTDh+FqxLsF0gN8CD6s/bWoei6LyxI=
github.com/bloeys/gglm v0.43.0/go.mod h1:qwJQ0WzV191wAMwlGicbfbChbKoSedMk7gFFX6GnyOk=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk=
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
github.com/inkyblackness/imgui-go/v4 v4.6.0 h1:ShcnXEYl80+xREGBY9OpGWePA6FfJChY9Varsm+3jjE=
github.com/inkyblackness/imgui-go/v4 v4.6.0/go.mod h1:g8SAGtOYUP7rYaOB2AsVKCEHmPMDmJKgt4z6d+flhb0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/veandco/go-sdl2 v0.4.3 h1:vAmvGBrWRmeQ1BhzwbDCSNjKIBLGjTuN0rFN4jnl840=
github.com/veandco/go-sdl2 v0.4.3/go.mod h1:FB+kTpX9YTE+urhYiClnRzpOXbiWgaU3+5F2AB78DPg=
github.com/veandco/go-sdl2 v0.4.25 h1:J5ac3KKOccp/0xGJA1PaNYKPUcZm19IxhDGs8lJofPI=
github.com/veandco/go-sdl2 v0.4.25/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=
github.com/veandco/go-sdl2 v0.4.35 h1:NohzsfageDWGtCd9nf7Pc3sokMK/MOK+UA2QMJARWzQ=
github.com/veandco/go-sdl2 v0.4.35/go.mod h1:OROqMhHD43nT4/i9crJukyVecjPNYYuCofep6SNiAjY=

14
main.go
View File

@ -4,6 +4,7 @@ import (
"fmt"
"runtime"
newimgui "github.com/AllenDang/cimgui-go"
"github.com/bloeys/gglm/gglm"
"github.com/bloeys/nmage/assets"
"github.com/bloeys/nmage/camera"
@ -18,7 +19,6 @@ import (
"github.com/bloeys/nmage/timing"
nmageimgui "github.com/bloeys/nmage/ui/imgui"
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/inkyblackness/imgui-go/v4"
"github.com/veandco/go-sdl2/sdl"
)
@ -130,7 +130,7 @@ func main() {
game := &OurGame{
Win: window,
ImGUIInfo: nmageimgui.NewImGUI(),
ImGUIInfo: nmageimgui.NewImGui(),
}
window.EventCallbacks = append(window.EventCallbacks, game.handleWindowEvents)
@ -272,18 +272,18 @@ func (g *OurGame) Update() {
cubeModelMat.Rotate(10*timing.DT()*gglm.Deg2Rad, gglm.NewVec3(1, 1, 1).Normalize())
}
if imgui.DragFloat3("Cam Pos", &cam.Pos.Data) {
if newimgui.DragFloat3("Cam Pos", &cam.Pos.Data) {
updateViewMat()
}
if imgui.DragFloat3("Cam Forward", &cam.Forward.Data) {
if newimgui.DragFloat3("Cam Forward", &cam.Forward.Data) {
updateViewMat()
}
if imgui.DragFloat3("Light Pos 1", &lightPos1.Data) {
if newimgui.DragFloat3("Light Pos 1", &lightPos1.Data) {
simpleMat.SetUnifVec3("lightPos1", lightPos1)
}
if imgui.DragFloat3("Light Color 1", &lightColor1.Data) {
if newimgui.DragFloat3("Light Color 1", &lightColor1.Data) {
simpleMat.SetUnifVec3("lightColor1", lightColor1)
}
@ -355,7 +355,7 @@ func (g *OurGame) updateCameraPos() {
func (g *OurGame) Render() {
matToUse := simpleMat
imgui.Checkbox("Debug depth buffer", &debugDrawDepthBuffer)
newimgui.Checkbox("Debug depth buffer", &debugDrawDepthBuffer)
if debugDrawDepthBuffer {
matToUse = debugDepthMat
}

View File

@ -1,17 +1,16 @@
package nmageimgui
import (
newimgui "github.com/AllenDang/cimgui-go"
"github.com/bloeys/gglm/gglm"
"github.com/bloeys/nmage/assert"
"github.com/bloeys/nmage/materials"
"github.com/bloeys/nmage/timing"
"github.com/go-gl/gl/v4.1-core/gl"
"github.com/inkyblackness/imgui-go/v4"
"github.com/veandco/go-sdl2/sdl"
)
type ImguiInfo struct {
ImCtx *imgui.Context
ImCtx newimgui.Context
// ImCtx2 *imgui.Context
Mat *materials.Material
VaoID uint32
@ -22,32 +21,32 @@ type ImguiInfo struct {
func (i *ImguiInfo) FrameStart(winWidth, winHeight float32) {
if err := i.ImCtx.SetCurrent(); err != nil {
assert.T(false, "Setting imgui ctx as current failed. Err: "+err.Error())
}
// if err := i.ImCtx.SetCurrent(); err != nil {
// assert.T(false, "Setting imgui ctx as current failed. Err: "+err.Error())
// }
imIO := imgui.CurrentIO()
imIO.SetDisplaySize(imgui.Vec2{X: float32(winWidth), Y: float32(winHeight)})
imIO := newimgui.CurrentIO()
imIO.SetDisplaySize(newimgui.Vec2{X: float32(winWidth), Y: float32(winHeight)})
imIO.SetDeltaTime(timing.DT())
imgui.NewFrame()
newimgui.NewFrame()
}
func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32) {
if err := i.ImCtx.SetCurrent(); err != nil {
assert.T(false, "Setting imgui ctx as current failed. Err: "+err.Error())
}
// if err := i.ImCtx.SetCurrent(); err != nil {
// assert.T(false, "Setting imgui ctx as current failed. Err: "+err.Error())
// }
imgui.Render()
newimgui.Render()
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
if fbWidth <= 0 || fbHeight <= 0 {
return
}
drawData := imgui.RenderedDrawData()
drawData.ScaleClipRects(imgui.Vec2{
drawData := newimgui.CurrentDrawData()
drawData.ScaleClipRects(newimgui.Vec2{
X: float32(fbWidth) / float32(winWidth),
Y: float32(fbHeight) / float32(winHeight),
})
@ -79,7 +78,7 @@ func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32)
gl.BindVertexArray(i.VaoID)
gl.BindBuffer(gl.ARRAY_BUFFER, i.VboID)
vertexSize, vertexOffsetPos, vertexOffsetUv, vertexOffsetCol := imgui.VertexBufferLayout()
vertexSize, vertexOffsetPos, vertexOffsetUv, vertexOffsetCol := newimgui.VertexBufferLayout()
i.Mat.EnableAttribute("Position")
i.Mat.EnableAttribute("UV")
i.Mat.EnableAttribute("Color")
@ -87,7 +86,7 @@ func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32)
gl.VertexAttribPointerWithOffset(uint32(i.Mat.GetAttribLoc("UV")), 2, gl.FLOAT, false, int32(vertexSize), uintptr(vertexOffsetUv))
gl.VertexAttribPointerWithOffset(uint32(i.Mat.GetAttribLoc("Color")), 4, gl.UNSIGNED_BYTE, true, int32(vertexSize), uintptr(vertexOffsetCol))
indexSize := imgui.IndexBufferLayout()
indexSize := newimgui.IndexBufferLayout()
drawType := gl.UNSIGNED_SHORT
if indexSize == 4 {
drawType = gl.UNSIGNED_INT
@ -96,11 +95,11 @@ func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32)
// Draw
for _, list := range drawData.CommandLists() {
vertexBuffer, vertexBufferSize := list.VertexBuffer()
vertexBuffer, vertexBufferSize := list.GetVertexBuffer()
gl.BindBuffer(gl.ARRAY_BUFFER, i.VboID)
gl.BufferData(gl.ARRAY_BUFFER, vertexBufferSize, vertexBuffer, gl.STREAM_DRAW)
indexBuffer, indexBufferSize := list.IndexBuffer()
indexBuffer, indexBufferSize := list.GetIndexBuffer()
gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, i.IndexBufID)
gl.BufferData(gl.ELEMENT_ARRAY_BUFFER, indexBufferSize, indexBuffer, gl.STREAM_DRAW)
@ -113,7 +112,7 @@ func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32)
clipRect := cmd.ClipRect()
gl.Scissor(int32(clipRect.X), int32(fbHeight)-int32(clipRect.W), int32(clipRect.Z-clipRect.X), int32(clipRect.W-clipRect.Y))
gl.DrawElementsBaseVertex(gl.TRIANGLES, int32(cmd.ElementCount()), uint32(drawType), gl.PtrOffset(cmd.IndexOffset()*indexSize), int32(cmd.VertexOffset()))
gl.DrawElementsBaseVertex(gl.TRIANGLES, int32(cmd.ElemCount()), uint32(drawType), gl.PtrOffset(int(cmd.IdxOffset())*indexSize), int32(cmd.VtxOffset()))
}
}
}
@ -124,26 +123,26 @@ func (i *ImguiInfo) Render(winWidth, winHeight float32, fbWidth, fbHeight int32)
gl.Enable(gl.DEPTH_TEST)
}
func (i *ImguiInfo) AddFontTTF(fontPath string, fontSize float32, fontConfig *imgui.FontConfig, glyphRanges *imgui.GlyphRanges) imgui.Font {
func (i *ImguiInfo) AddFontTTF(fontPath string, fontSize float32, fontConfig *newimgui.FontConfig, glyphRanges *newimgui.GlyphRange) newimgui.Font {
fontConfigToUse := imgui.DefaultFontConfig
fontConfigToUse := newimgui.NewFontConfig()
if fontConfig != nil {
fontConfigToUse = *fontConfig
}
glyphRangesToUse := imgui.EmptyGlyphRanges
glyphRangesToUse := newimgui.NewGlyphRange()
if glyphRanges != nil {
glyphRangesToUse = *glyphRanges
}
imIO := imgui.CurrentIO()
imIO := newimgui.CurrentIO()
a := imIO.Fonts()
f := a.AddFontFromFileTTFV(fontPath, fontSize, fontConfigToUse, glyphRangesToUse)
image := a.TextureDataAlpha8()
f := a.AddFontFromFileTTFV(fontPath, fontSize, fontConfigToUse, glyphRangesToUse.Data())
pixels, width, height, _ := a.GetTextureDataAsAlpha8()
gl.BindTexture(gl.TEXTURE_2D, i.TexID)
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RED, int32(image.Width), int32(image.Height), 0, gl.RED, gl.UNSIGNED_BYTE, image.Pixels)
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RED, int32(width), int32(height), 0, gl.RED, gl.UNSIGNED_BYTE, pixels)
return f
}
@ -184,15 +183,17 @@ void main()
}
`
func NewImGUI() ImguiInfo {
func NewImGui() ImguiInfo {
imguiInfo := ImguiInfo{
ImCtx: imgui.CreateContext(nil),
Mat: materials.NewMaterialSrc("ImGUI Mat", []byte(imguiShdrSrc)),
// ImCtx2: imgui.CreateContext(nil),
ImCtx: newimgui.CreateContext(),
Mat: materials.NewMaterialSrc("ImGUI Mat", []byte(imguiShdrSrc)),
}
imIO := imgui.CurrentIO()
imIO.SetBackendFlags(imIO.GetBackendFlags() | imgui.BackendFlagsRendererHasVtxOffset)
imIO := newimgui.CurrentIO()
imIO.SetBackendFlags(imIO.BackendFlags() | newimgui.BackendFlagsRendererHasVtxOffset)
gl.GenVertexArrays(1, &imguiInfo.VaoID)
gl.GenBuffers(1, &imguiInfo.VboID)
@ -205,11 +206,11 @@ func NewImGUI() ImguiInfo {
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
gl.PixelStorei(gl.UNPACK_ROW_LENGTH, 0)
image := imIO.Fonts().TextureDataAlpha8()
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RED, int32(image.Width), int32(image.Height), 0, gl.RED, gl.UNSIGNED_BYTE, image.Pixels)
pixels, width, height, _ := imIO.Fonts().GetTextureDataAsAlpha8()
gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RED, int32(width), int32(height), 0, gl.RED, gl.UNSIGNED_BYTE, pixels)
// Store our identifier
imIO.Fonts().SetTextureID(imgui.TextureID(imguiInfo.TexID))
imIO.Fonts().SetTexID(newimgui.TextureID(uintptr(imguiInfo.TexID)))
//Shader attributes
imguiInfo.Mat.Bind()
@ -218,35 +219,97 @@ func NewImGUI() ImguiInfo {
imguiInfo.Mat.EnableAttribute("Color")
imguiInfo.Mat.UnBind()
//Init imgui input mapping
keys := map[int]int{
imgui.KeyTab: sdl.SCANCODE_TAB,
imgui.KeyLeftArrow: sdl.SCANCODE_LEFT,
imgui.KeyRightArrow: sdl.SCANCODE_RIGHT,
imgui.KeyUpArrow: sdl.SCANCODE_UP,
imgui.KeyDownArrow: sdl.SCANCODE_DOWN,
imgui.KeyPageUp: sdl.SCANCODE_PAGEUP,
imgui.KeyPageDown: sdl.SCANCODE_PAGEDOWN,
imgui.KeyHome: sdl.SCANCODE_HOME,
imgui.KeyEnd: sdl.SCANCODE_END,
imgui.KeyInsert: sdl.SCANCODE_INSERT,
imgui.KeyDelete: sdl.SCANCODE_DELETE,
imgui.KeyBackspace: sdl.SCANCODE_BACKSPACE,
imgui.KeySpace: sdl.SCANCODE_BACKSPACE,
imgui.KeyEnter: sdl.SCANCODE_RETURN,
imgui.KeyEscape: sdl.SCANCODE_ESCAPE,
imgui.KeyA: sdl.SCANCODE_A,
imgui.KeyC: sdl.SCANCODE_C,
imgui.KeyV: sdl.SCANCODE_V,
imgui.KeyX: sdl.SCANCODE_X,
imgui.KeyY: sdl.SCANCODE_Y,
imgui.KeyZ: sdl.SCANCODE_Z,
}
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
for imguiKey, nativeKey := range keys {
imIO.KeyMap(imguiKey, nativeKey)
}
// //Init imgui input mapping
// keys := map[int]int{
// newimgui.KeyTab: sdl.SCANCODE_TAB,
// newimgui.KeyLeftArrow: sdl.SCANCODE_LEFT,
// newimgui.KeyRightArrow: sdl.SCANCODE_RIGHT,
// newimgui.KeyUpArrow: sdl.SCANCODE_UP,
// newimgui.KeyDownArrow: sdl.SCANCODE_DOWN,
// newimgui.KeyPageUp: sdl.SCANCODE_PAGEUP,
// newimgui.KeyPageDown: sdl.SCANCODE_PAGEDOWN,
// newimgui.KeyHome: sdl.SCANCODE_HOME,
// newimgui.KeyEnd: sdl.SCANCODE_END,
// newimgui.KeyInsert: sdl.SCANCODE_INSERT,
// newimgui.KeyDelete: sdl.SCANCODE_DELETE,
// newimgui.KeyBackspace: sdl.SCANCODE_BACKSPACE,
// newimgui.KeySpace: sdl.SCANCODE_BACKSPACE,
// newimgui.KeyEnter: sdl.SCANCODE_RETURN,
// newimgui.KeyEscape: sdl.SCANCODE_ESCAPE,
// newimgui.KeyA: sdl.SCANCODE_A,
// newimgui.KeyC: sdl.SCANCODE_C,
// newimgui.KeyV: sdl.SCANCODE_V,
// newimgui.KeyX: sdl.SCANCODE_X,
// newimgui.KeyY: sdl.SCANCODE_Y,
// newimgui.KeyZ: sdl.SCANCODE_Z,
// }
return imguiInfo
}
// func newImGUI() ImguiInfo {
// imguiInfo := ImguiInfo{
// ImCtx: imgui.CreateContext(nil),
// Mat: materials.NewMaterialSrc("ImGUI Mat", []byte(imguiShdrSrc)),
// }
// imIO := imgui.CurrentIO()
// imIO.SetBackendFlags(imIO.GetBackendFlags() | imgui.BackendFlagsRendererHasVtxOffset)
// gl.GenVertexArrays(1, &imguiInfo.VaoID)
// gl.GenBuffers(1, &imguiInfo.VboID)
// gl.GenBuffers(1, &imguiInfo.IndexBufID)
// gl.GenTextures(1, &imguiInfo.TexID)
// // Upload font to gpu
// gl.BindTexture(gl.TEXTURE_2D, imguiInfo.TexID)
// gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
// gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
// gl.PixelStorei(gl.UNPACK_ROW_LENGTH, 0)
// image := imIO.Fonts().TextureDataAlpha8()
// gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RED, int32(image.Width), int32(image.Height), 0, gl.RED, gl.UNSIGNED_BYTE, image.Pixels)
// // Store our identifier
// imIO.Fonts().SetTextureID(imgui.TextureID(imguiInfo.TexID))
// //Shader attributes
// imguiInfo.Mat.Bind()
// imguiInfo.Mat.EnableAttribute("Position")
// imguiInfo.Mat.EnableAttribute("UV")
// imguiInfo.Mat.EnableAttribute("Color")
// imguiInfo.Mat.UnBind()
// //Init imgui input mapping
// keys := map[int]int{
// imgui.KeyTab: sdl.SCANCODE_TAB,
// imgui.KeyLeftArrow: sdl.SCANCODE_LEFT,
// imgui.KeyRightArrow: sdl.SCANCODE_RIGHT,
// imgui.KeyUpArrow: sdl.SCANCODE_UP,
// imgui.KeyDownArrow: sdl.SCANCODE_DOWN,
// imgui.KeyPageUp: sdl.SCANCODE_PAGEUP,
// imgui.KeyPageDown: sdl.SCANCODE_PAGEDOWN,
// imgui.KeyHome: sdl.SCANCODE_HOME,
// imgui.KeyEnd: sdl.SCANCODE_END,
// imgui.KeyInsert: sdl.SCANCODE_INSERT,
// imgui.KeyDelete: sdl.SCANCODE_DELETE,
// imgui.KeyBackspace: sdl.SCANCODE_BACKSPACE,
// imgui.KeySpace: sdl.SCANCODE_BACKSPACE,
// imgui.KeyEnter: sdl.SCANCODE_RETURN,
// imgui.KeyEscape: sdl.SCANCODE_ESCAPE,
// imgui.KeyA: sdl.SCANCODE_A,
// imgui.KeyC: sdl.SCANCODE_C,
// imgui.KeyV: sdl.SCANCODE_V,
// imgui.KeyX: sdl.SCANCODE_X,
// imgui.KeyY: sdl.SCANCODE_Y,
// imgui.KeyZ: sdl.SCANCODE_Z,
// }
// // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
// for imguiKey, nativeKey := range keys {
// imIO.KeyMap(imguiKey, nativeKey)
// }
// return imguiInfo
// }