Vertex buffer triangle

This commit is contained in:
Tom
2021-05-31 14:18:46 +02:00
parent cac26262b4
commit e56d8370ff
8 changed files with 6 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -9,10 +9,9 @@ int main(void){
return -1;
}
//Main window
//Main window creation
GLFWwindow* window;
//Window creation
window = glfwCreateWindow(640, 480, "OpenGl practice", NULL, NULL);
if (!window){
std::cout << "Window could not be created!" << std::endl;
@@ -43,6 +42,11 @@ int main(void){
glBindBuffer(GL_ARRAY_BUFFER, buffer); //binding the buffer
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), positions, GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbinding the buffer
//Main loop
while (!glfwWindowShouldClose(window)){
/* Render here */