windowww!

This commit is contained in:
Morrígan 2025-06-20 14:53:56 +02:00
commit b7a21689f6
Signed by: morrigan
GPG key ID: CACB010F463A77D0

41
main.odin Normal file
View 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)
}
}