I am working on integrating OpenGL in a Nim project while I am still learning Nim. As I am still waiting on the arrival of the book, I hope I am not asking something that is addressed in the manual but I haven't found yet (although I DO hope there is a solution of course).
But at this moment, it looks like a serious issue between the identifier equality and FFI. glTexImage2D(GL_TEXTURE_2D.GLenum, 0.GLint, GL_RGBA32F.GLint, 512.GLsizei, 512.GLsizei, 0.GLint, GL_RGBA.GLenum, GL_FLOAT.GLenum, buf[0].addr) Run (You can replace the buf[0].addr with nil if you like, result is the same) I can't get this to compile because of the GL_FLOAT constant. In OpenGL, there is a GLfloat type and a GL_FLOAT constant and I think it is due to identifier equality in Nim that it is interpreted wrong. If I omit the .GLenum cast on GL_FLOAT, the error message is: Error: type mismatch Expression: glTexImage2D(GLenum(3553'u), GLint(0), GLint(34836'u), GLsizei(512), GLsizei(512), GLint(0), GLenum(6408'u), GLfloat, addr(buf[0])) [1] GLenum(3553'u): GLenum [2] GLint(0): GLint [3] GLint(34836'u): GLint [4] GLsizei(512): GLsizei [5] GLsizei(512): GLsizei [6] GLint(0): GLint [7] GLenum(6408'u): GLenum [8] GLfloat: typedesc[GLfloat] [9] addr(buf[0]): ptr float32 Expected one of (first mismatch at [position]): [8] proc glTexImage2D(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; border: GLint; format: GLenum; type: GLenum; pixels: pointer) Run If I add the .GLenum cast: Error: type mismatch: got 'typedesc[GLfloat]' for 'GLfloat' but expected 'GLenum = distinct uint32' Run Both error messages indicate (to me... that's how I interpret it) that Nim thinks I am talking about the GLfloat type, not the GL_FLOAT constant. Can this be solved? And how?