nim-glew/examples/ex1.nim
Joey Yakimowich-Payne cb5066b3ae Add simple example
2020-09-13 20:28:17 -06:00

28 lines
681 B
Nim

import opengl
import glfw
import glew
proc main() =
initHint(CONTEXT_VERSION_MAJOR, 3)
initHint(CONTEXT_VERSION_MINOR, 2)
when defined(macosx):
initHint(OPENGL_FORWARD_COMPAT, 1)
initHint(OPENGL_PROFILE, OPENGL_CORE_PROFILE)
discard glfw.init()
windowHint(CONTEXT_VERSION_MAJOR, 3)
windowHint(CONTEXT_VERSION_MINOR, 2)
when defined(macosx):
windowHint(OPENGL_FORWARD_COMPAT, 1)
windowHint(OPENGL_PROFILE, OPENGL_CORE_PROFILE)
var w = createWindow(800, 600, "Minimal Nim-GLFW Example", nil, nil)
w.makeContextCurrent()
let code = glew.init()
if code != GLEW_OK:
raise newException(CatchableError, "Glew not initialized properly")
main()