Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (!glfwWindowShouldClose(window))
- {
- GLfloat timeValue = glfwGetTime();
- GLfloat greenValue = (sin(timeValue) / 2) + 0.5;
- GLfloat vertexColorLocation = glGetUniformLocation(shaderProgram, "tubi");
- GLfloat vertices[] = {
- // Positions // Colors
- 0.5f, -0.5f, 0.0f, greenValue, 0.0f, 0.0f, // Bottom Right
- -0.5f, -0.5f, 0.0f, 0.0f, greenValue, 0.0f, // Bottom Left
- 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, greenValue // Top
- };
- };
- GLuint VBO, VAO;
- glGenVertexArrays(1, &VAO);
- glGenBuffers(1, &VBO);
- // Bind the Vertex Array Object first, then bind and set vertex buffer(s) and attribute pointer(s).
- glBindVertexArray(VAO);
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement