Hi there,
I'm following this tutorial to learn OpenGL/GLFW programming, but writing things in Nim rather than C++. The code is here and specifically I am trying to perform challenge 2, where you draw a square on the screen using 4 unique vertices to make 2 triangles using an element array (though I've had the same issue with challenge 1).
My code is here
What I get is NOT a square, sadly:
I am sure I must have made a mistake in either my stride, my size of the colour components, my size of the position components, or the offset. But I've checked them so many times and they seem correct?
If anyone can show me what stupid mistake I'm making I would be so so grateful.
Your problem is line 60, which doesn't even compile because you're casting nothing: https://gist.github.com/jphdotam/f5e2c89e13615c8755fd961ce3e16502#file-main-nim-L60
I changed that line to this...
glVertexAttribPointer(1, 3, EGL_FLOAT, false, GLfloat.sizeof * 7, cast[pointer](GLfloat.sizeof * 4))
And now i get:
be carefull using assert's as
assert glfwInit()
they will be removed when compiling on -d:release and the instruction will not be executed