I am a nim-lang newbie using the nim-glfw and trying to compile:
glClear(bitor(GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT)) which gives me the following error:
triangle_0.nim(153, 18) Error: type mismatch
... Expression: bitor(16384'u, 256'u)
... [1] 16384'u: GLbitfield
... [2] 256'u: GLbitfield
... Expected one of (first mismatch at [position]):
... [1] macro bitor[T: SomeInteger](x, y: T; z: varargs[T]): T
... The parameter type and its values are defined as:
GLbitfield* = distinct uint32
GL_DEPTH_BUFFER_BIT* = 0x00000100.GLbitfield
GL_STENCIL_BUFFER_BIT* = 0x00000400.GLbitfield
GL_COLOR_BUFFER_BIT* = 0x00004000.GLbitfield What is the correct way of doing bit twiddling on this distinct type?
TIA
How about:
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) Also, the keyword or maps to the bitwise OR operation when the arguments are integers. Strictly for understanding Nim a little more, it could be written with type conversions like this:
glClear(GLbitfield(GL_COLOR_BUFFER_BIT.uint32 or GL_DEPTH_BUFFER_BIT.uint32)))