openglsuperbible/sb6code

sb6code / src / spinnycube / spinnycube.cpp why do unnecessary VertArray allocation?

Opened this issue · 0 comments

In sb6code / src / spinnycube / spinnycube.cpp, around line #98:
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
then the code fills vertex_positions -> unrelated
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);

It seems to me that the VA generated for vao is never used. (Or did i miss anything? - if i comment it out, the code works fine)

Second issue: (at around line #186)
vmath::mat4 mv_matrix = vmath::translate(0.0f, 0.0f, -6.0f) *
vmath::rotate((float)currentTime * 45.0f, 0.0f, 1.0f, 0.0f) *
vmath::rotate((float)currentTime * 21.0f, 1.0f, 0.0f, 0.0f) *
vmath::translate(sinf(2.1f * f) * 2.0f,
cosf(1.7f * f) * 2.0f,
sinf(1.3f * f) * cosf(1.5f * f) * 2.0f);
If i use the transformations in this order, the cube leaves the screen. If i flip the translations with rotations, the cube starts rotating around its local axes -> looks better