windowww!
This commit is contained in:
commit
b7a21689f6
1 changed files with 41 additions and 0 deletions
41
main.odin
Normal file
41
main.odin
Normal file
|
@ -0,0 +1,41 @@
|
|||
package main
|
||||
|
||||
import "core:fmt"
|
||||
import gl "vendor:OpenGL"
|
||||
import "vendor:glfw"
|
||||
|
||||
WIDTH :: 1600
|
||||
HEIGHT :: 900
|
||||
|
||||
// @note You might need to lower this to 3.3 depending on how old your graphics card is.
|
||||
GL_MAJOR_VERSION :: 4
|
||||
GL_MINOR_VERSION :: 5
|
||||
|
||||
|
||||
main :: proc() {
|
||||
if !bool(glfw.Init()) {
|
||||
fmt.eprintln("GLFW failed to load!")
|
||||
return
|
||||
}
|
||||
|
||||
window := glfw.CreateWindow(WIDTH, HEIGHT, "hello", nil, nil)
|
||||
|
||||
defer glfw.Terminate()
|
||||
defer glfw.DestroyWindow(window)
|
||||
|
||||
if window == nil {
|
||||
fmt.eprintln("GLFW has failed to load the window.")
|
||||
return
|
||||
}
|
||||
|
||||
glfw.MakeContextCurrent(window)
|
||||
gl.load_up_to(GL_MAJOR_VERSION, GL_MINOR_VERSION, glfw.gl_set_proc_address)
|
||||
for !glfw.WindowShouldClose(window) {
|
||||
glfw.PollEvents()
|
||||
gl.ClearColor(1.0, 1.0, 1.0, 1.0)
|
||||
gl.Clear(gl.COLOR_BUFFER_BIT)
|
||||
|
||||
glfw.SwapBuffers(window)
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue