remove extra stuff and attempt to fix glfw loop
This commit is contained in:
parent
cf0300fb62
commit
534d8e2400
75
main.go
75
main.go
@ -9,6 +9,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/go-gl/gl/v2.1/gl"
|
||||||
"github.com/go-gl/glfw/v3.1/glfw"
|
"github.com/go-gl/glfw/v3.1/glfw"
|
||||||
"github.com/kardianos/osext"
|
"github.com/kardianos/osext"
|
||||||
"github.com/lordwelch/qml"
|
"github.com/lordwelch/qml"
|
||||||
@ -41,6 +42,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
glfw.Terminate()
|
glfw.Terminate()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -49,84 +51,47 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func run() error {
|
func run() error {
|
||||||
|
|
||||||
engine := qml.NewEngine()
|
engine := qml.NewEngine()
|
||||||
path, err = osext.ExecutableFolder()
|
path, err = osext.ExecutableFolder()
|
||||||
path = filepath.Clean(path + "/../src/github.com/lordwelch/PresentationApp/")
|
path = filepath.Clean(path + "/../src/github.com/lordwelch/PresentationApp/")
|
||||||
//fmt.Println(path)
|
|
||||||
qml.RunMain(func() {
|
|
||||||
if err = glfw.Init(); err != nil {
|
|
||||||
log.Fatalln("failed to initialize glfw:", err)
|
|
||||||
}
|
|
||||||
checkMon()
|
|
||||||
|
|
||||||
win, err = glfw.CreateWindow(800, 600, "Cube", nil, nil)
|
if err = glfw.Init(); err != nil {
|
||||||
if err != nil {
|
log.Fatalln("failed to initialize glfw:", err)
|
||||||
panic(err)
|
}
|
||||||
}
|
checkMon()
|
||||||
|
glfw.WindowHint(glfw.ContextVersionMajor, 2)
|
||||||
|
glfw.WindowHint(glfw.ContextVersionMinor, 1)
|
||||||
|
|
||||||
win.MakeContextCurrent()
|
win, err = glfw.CreateWindow(800, 600, "Cube", nil, nil)
|
||||||
|
if err != nil {
|
||||||
fmt.Printf("qml loop: %d\n", qml.Ilyuh)
|
panic(err)
|
||||||
qml.Ilyuh++
|
}
|
||||||
if !win.ShouldClose() {
|
if err := gl.Init(); err != nil {
|
||||||
win.SwapBuffers()
|
panic(err)
|
||||||
glfw.PollEvents()
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
qml.RunMain(func() {
|
win.MakeContextCurrent()
|
||||||
fmt.Println("win: ", win.ShouldClose())
|
|
||||||
fmt.Printf("qml loop: %d\n", qml.Ilyuh)
|
|
||||||
qml.Ilyuh++
|
|
||||||
if !win.ShouldClose() {
|
|
||||||
win.SwapBuffers()
|
|
||||||
glfw.PollEvents()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
mainQml, err := engine.LoadFile(path + "/main.qml")
|
mainQml, err := engine.LoadFile(path + "/main.qml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
qml.RunMain(func() {
|
|
||||||
fmt.Printf("qml loop: %d\n", qml.Ilyuh)
|
|
||||||
qml.Ilyuh++
|
|
||||||
if !win.ShouldClose() {
|
|
||||||
win.SwapBuffers()
|
|
||||||
glfw.PollEvents()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
/*projQml, err := engine.LoadFile(path + "/qml/projection.qml")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}*/
|
|
||||||
|
|
||||||
cellQml, err = engine.LoadFile(path + "/qml/cell.qml")
|
cellQml, err = engine.LoadFile(path + "/qml/cell.qml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
window = mainQml.CreateWindow(nil)
|
window = mainQml.CreateWindow(nil)
|
||||||
//created(projQml)
|
|
||||||
textEdit = window.ObjectByName("textEdit")
|
textEdit = window.ObjectByName("textEdit")
|
||||||
slides.addCell()
|
slides.addCell()
|
||||||
|
|
||||||
qml.RunMain(func() {
|
gl.ClearColor(0.1, 0.5, 0.9, 0.0)
|
||||||
fmt.Printf("qml loop: %d\n", qml.Ilyuh)
|
|
||||||
qml.Ilyuh++
|
|
||||||
if !win.ShouldClose() {
|
|
||||||
win.SwapBuffers()
|
|
||||||
glfw.PollEvents()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
qml.Ilyuh = 0
|
|
||||||
qml.Func1 = func() {
|
qml.Func1 = func() {
|
||||||
fmt.Printf("qml loop: %d\n", qml.Ilyuh)
|
|
||||||
qml.Ilyuh++
|
|
||||||
if !win.ShouldClose() {
|
if !win.ShouldClose() {
|
||||||
|
gl.Clear(gl.COLOR_BUFFER_BIT)
|
||||||
win.SwapBuffers()
|
win.SwapBuffers()
|
||||||
glfw.PollEvents()
|
glfw.PollEvents()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user