I was trying to replicate an example of the last example of this section of this opengl tutorial, but without the textures, with wireframe cubes and with all the cubes rotating but when i run it only 1 cube is rendered.

I tried to do it again from scratch but only with c style code (except by the shaders and the glfw window) and i got the same result. Why it only renders 1 cube?

vertex shader: https://pastebin.com/6VzJKwBN fragment shader: https://pastebin.com/Ns9dLmqe the source file: https://pastebin.com/MvQtQG3g canned_glfw_window.hpp: https://pastebin.com/h2zD1WbK canned_glfw_window.cpp: https://pastebin.com/N2WX7NT8

  • scinde@discuss.tchncs.de
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    In the loop where you iterate over the positions, you translate the matrix model with the position correctly, but when you rotate it in the next line, you rotate the identity matrix, not the translated matrix, and put the result into model, which resets the position. And so all the cubes get rendered at the same place which results in it looking like only one cube is being rendered.