(Solved) : Opengl Need Help Displaying Cubes X Y Z Cordinates Cubeposition Gives Cube Display Need Cr Q41364242 . . .

This is OpenGL
I need help with displaying cubes in X, Y, and Z cordinates.

cubePosition[] // this is what gives you cube to display
how do I need to create for loops so that it will display it like apyramid
Base 10 x 10, next level is 9 x 9 and so on.
Thanks for help.

       glBindVertexArray(VAO);
           for (unsignedint i = 0; i < 10; i++)
           {

              for (int j = 0; j < 10 – i; j++)
              {
                  // calculate the model matrixfor each object and pass it to shader before drawing
                  glm::mat4 model =glm::mat4(1.0f); // make sure to initialize matrix to identitymatrix first
                  model = glm::translate(model,cubePositions[i, j]);
                  //float angle = 20.0f *i;
                  //model = glm::rotate(model,glm::radians(angle), glm::vec3(2.0f, 2.0f, 2.0f));
                  ourShader.setMat4(“model”,model);
                  glDrawArrays(GL_TRIANGLES, 0,36);
              }

           }

Expert Answer


Answer to This is OpenGL I need help with displaying cubes in X, Y, and Z cordinates. cubePosition[] // this is what gives you cub…