get imgui properly running in viewer

This commit is contained in:
Alex Yatskov 2018-12-29 17:04:37 -08:00
parent 0e1e1a51f0
commit 723f55186b
3 changed files with 6 additions and 3 deletions

View File

@ -299,7 +299,7 @@ func createFontTexture() uint32 {
// Store our identifier
io.Fonts().SetTextureID(imgui.TextureID(fontTexture))
// Restore singleton
// Restore state
gl.BindTexture(gl.TEXTURE_2D, uint32(lastTexture))
return fontTexture
}

View File

@ -82,11 +82,11 @@ func (w *Window) RenderTexture(texture *Texture, srcRect, dstRect math.Rect4i) {
func (w *Window) advance() {
imgui_backend.NewFrame(w.displaySize())
w.sdlRenderer.Clear()
w.scene.Advance(w)
imgui.Render()
w.sdlWindow.GLMakeCurrent(w.sdlGlContext)
imgui_backend.Render(w.displaySize(), w.bufferSize(), imgui.RenderedDrawData())
w.sdlWindow.GLSwap()
}

View File

@ -5,6 +5,7 @@ import (
"log"
"os"
imgui "github.com/FooSoft/imgui-go"
"github.com/FooSoft/lazarus/formats/dat"
"github.com/FooSoft/lazarus/formats/dc6"
"github.com/FooSoft/lazarus/math"
@ -62,6 +63,8 @@ func (s *scene) Init(window *platform.Window) error {
}
func (s *scene) Advance(window *platform.Window) error {
imgui.Text("Hello")
window.RenderTexture(
s.texture,
math.Rect4i{X: 0, Y: 0, W: 256, H: 256},