try to fix glfw close window

This commit is contained in:
lordwelch 2016-03-16 10:23:15 -07:00
parent 29eb54f7ae
commit d483570591

18
main.go
View File

@ -37,9 +37,8 @@ var (
err error err error
monitors []*glfw.Monitor monitors []*glfw.Monitor
projMonitor *glfw.Monitor projMonitor *glfw.Monitor
//mw1 *imagick.MagickWand
tex1 uint32 tex1 uint32
texDel Bool texDel = false
) )
func main() { func main() {
@ -49,8 +48,6 @@ func main() {
os.Exit(1) os.Exit(1)
} }
defer glfw.Terminate()
} }
func run() error { func run() error {
@ -98,7 +95,7 @@ func setupScene() {
gl.ClearColor(0, 0, 0, 0) gl.ClearColor(0, 0, 0, 0)
if texDel { if texDel {
gl.DeleteTextures(1,tex1) gl.DeleteTextures(1, &tex1)
} }
tex1 = newTexture(*slides[selSlide].getImage(x0, y0)) tex1 = newTexture(*slides[selSlide].getImage(x0, y0))
@ -212,8 +209,9 @@ func glInit() {
if err := gl.Init(); err != nil { if err := gl.Init(); err != nil {
panic(err) panic(err)
} }
setupScene()
win.SetPos(projMonitor.GetPos()) win.SetPos(projMonitor.GetPos())
setupScene()
qml.Func1 = func() int { qml.Func1 = func() int {
if !win.ShouldClose() { if !win.ShouldClose() {
@ -224,7 +222,8 @@ func glInit() {
} else { } else {
win.Hide() win.Hide()
win.Destroy() //win.Destroy()
glfw.Terminate()
return 1 return 1
} }
@ -238,7 +237,6 @@ func setSignals() {
window.ObjectByName("btnRem").On("clicked", func() { window.ObjectByName("btnRem").On("clicked", func() {
slides[len(slides)-1].remove() slides[len(slides)-1].remove()
fmt.Println("testing....")
}) })
window.ObjectByName("btnMem").On("clicked", func() { window.ObjectByName("btnMem").On("clicked", func() {
@ -246,7 +244,7 @@ func setSignals() {
}) })
window.On("closing", func() { window.On("closing", func() {
win.Hide() win.SetShouldClose(true)
window.Set("cls", true) window.Set("cls", true)
}) })
@ -293,7 +291,7 @@ func (cl *cell) setSignal() {
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func() { cl.qmlcell.ObjectByName("cellMouse").On("clicked", func() {
cl.qmlcell.ObjectByName("cellMouse").Set("focus", true) cl.qmlcell.ObjectByName("cellMouse").Set("focus", true)
setupScene() setupScene()
} })
cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() { cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() {