func (_ *NgUserIO) recreateWin() (err error) { winInit := &Options.Initialization.Window if UserIO.Window.isCreated { glfw.CloseWindow() } if UserIO.Window.isCreated, err = false, glfw.OpenWindow(UserIO.Window.width, UserIO.Window.height, winInit.Rbits, winInit.Gbits, winInit.Bbits, winInit.Abits, winInit.DepthBits, winInit.StencilBits, ugo.Ifi(UserIO.Window.fullscreen, glfw.Fullscreen, glfw.Windowed)); err == nil { UserIO.Window.width, UserIO.Window.height = glfw.WindowSize() UserIO.Window.isCreated = true UserIO.Window.SetTitle(UserIO.Window.title) UserIO.Window.SetSwapInterval(UserIO.Window.swap) glfw.SetWindowCloseCallback(glfwOnWindowClose) glfw.SetWindowSizeCallback(glfwOnWindowResize) // glfw.Disable(glfw.MouseCursor) glfw.Disable(glfw.AutoPollEvents) glfw.Disable(glfw.StickyKeys) } return }
func main() { err := initGL() if err != nil { log.Printf("InitGL: %v", err) return } defer glfw.Terminate() mb := createBuffer() defer mb.Release() attr := mb.Colors() // Perform the rendering. for glfw.WindowParam(glfw.Opened) > 0 { gl.Clear(gl.COLOR_BUFFER_BIT) gl.LoadIdentity() // Center mesh on screen. wx, wy := glfw.WindowSize() px := (wx / 2) - ((Cols * CellWidth) / 2) py := (wy / 2) - ((Rows * CellHeight) / 2) gl.Translatef(float32(px), float32(py), 0) // Change the color of the quad under the mouse cursor. colorize(px, py, attr) // Render the mesh. mb.Render(gl.QUADS) glfw.SwapBuffers() } attr = nil }
// Handles window resize. func (c *Controller) resize() (err error) { c.Win.Width, c.Win.Height = glfw.WindowSize() return }
func (me *window) Size() (width, height int) { return glfw.WindowSize() }