Class Button
So from my understanding in order to move a 2d shape you need manipulate the vertices and then update????
If i do need to update the buffer how i would go by doing that?
float xpos = 150 //Cords relative to the window application so let say the window size 480 by 260
float ypos = 60 Where would I plug in position in the vertices array?
float vertices() = {
-.5f,-.5f,0,
.5f,-.5f,0,
-.5f,.5f,0,
.5f,.5f,0
};
shader.setup("Resources/Shaders/shape.vertex", "Resources/Shaders/shape.frag");
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
// note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);
// You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other
// VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.
glBindVertexArray(0);