Last active
December 24, 2015 12:59
-
-
Save james4k/6801003 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
glfw "github.com/go-gl/glfw3" | |
) | |
func errorCallback(err glfw.ErrorCode, desc string) { | |
fmt.Printf("%v: %v\n", err, desc) | |
} | |
func onCloseA(wnd *glfw.Window) { | |
fmt.Println("closed A") | |
} | |
func onCloseB(wnd *glfw.Window) { | |
fmt.Println("closed B") | |
} | |
func main() { | |
glfw.SetErrorCallback(errorCallback) | |
if !glfw.Init() { | |
panic("Can't init glfw!") | |
} | |
defer glfw.Terminate() | |
window, err := glfw.CreateWindow(640, 480, "Testing A", nil, nil) | |
if err != nil { | |
panic(err) | |
} | |
windowB, err := glfw.CreateWindow(640, 480, "Testing B", nil, nil) | |
if err != nil { | |
panic(err) | |
} | |
window.SetCloseCallback(onCloseA) | |
windowB.SetCloseCallback(onCloseB) | |
window.MakeContextCurrent() | |
for !window.ShouldClose() || !windowB.ShouldClose() { | |
//Do OpenGL stuff | |
window.SwapBuffers() | |
glfw.PollEvents() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment