I installed some fresh copies of the opengl and glfw wrappers via nimble today and tried to compile the following minimal example:
import opengl
import glfw/glfw
glfw.init()
var win = newGlWin(dim = (w: 640, h: 480), title = "Minimal example")
win.makeContextCurrent()
loadExtensions()
win.destroy()
glfw.terminate()
Compilation aborts with the following error message: (file path)..\nimcache\nimgl.o:nimgl.c:(.text+0x957): undefined reference to 'nimLoadProcs0' Since this refers to the C code generated for the loadExtensions proc, my guess would be that something broke with the latest nim release and needs to be updated. I looked at the relevant lines calling nimLoadProcs0 in opengl.nim, but I don't really understand most of what's going on there, so I can't fix it myself. Any help regarding this particular problem would be appreciated.
try this code with the glfw3 package not the high level wrapper.
import os, glfw/glfw3 as glfw
import opengl
#{.deadCodeElim: on.}
enableAutoGLErrorCheck(true)
proc main() =
var Win: glfw.Window
if glfw.Init() == cint(0):
echo(" glfw did not init/n")
quit()
glfw.WindowHint(glfw.CONTEXT_VERSION_MAJOR,4)
glfw.WindowHint(glfw.CONTEXT_VERSION_MINOR,3)
#glfw.WindowHint(glfw.OPENGL_PROFILE,glfw.OPENGL_COMPAT_PROFILE)
Win = glfw.CreateWindow(800.cint,600.cint,"Opengl Window",nil,nil)
glfw.MakeContextCurrent(Win)
loadExtensions()
while glfw.WindowShouldClose(Win) == 0:
glClear(GL_COLOR_BUFFER_BIT)
glClearColor(0.5,0.0,0.1,1.0)
glfw.SwapBuffers(Win)
glfw.PollEvents()
glfw.Terminate()
main()
i have gotten this to work u still have to compile the .dll to work with your compiler using cmake and glfw3