41 lines
819 B
Odin
41 lines
819 B
Odin
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)
|
|
}
|
|
|
|
}
|