i can't find this problem in stack overflow this is a opengl project using glue and glfw with c++ and the code is form https://www.glfw.org/documentation.html. I just want to make triangle with buffer. #TIA
#include <GL/glew.h>
#include <GLFW/glfw3.h>
float positions[6] =
{
-0.5f, -0.5f,
0.0f, 0.0f,
0.5f, -0.5f,
};
unsigned int buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(float), positions, GL_STATIC_DRAW);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLES, 0, 3);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
User contributions licensed under CC BY-SA 3.0