Advertisement
SashaKarmanov

Untitled

Mar 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. while (!glfwWindowShouldClose(window))
  2. {
  3. GLfloat timeValue = glfwGetTime();
  4. GLfloat greenValue = (sin(timeValue) / 2) + 0.5;
  5. GLfloat vertexColorLocation = glGetUniformLocation(shaderProgram, "tubi");
  6.  
  7. GLfloat vertices[] = {
  8. // Positions // Colors
  9. 0.5f, -0.5f, 0.0f, greenValue, 0.0f, 0.0f, // Bottom Right
  10. -0.5f, -0.5f, 0.0f, 0.0f, greenValue, 0.0f, // Bottom Left
  11. 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, greenValue // Top
  12. };
  13. };
  14. GLuint VBO, VAO;
  15. glGenVertexArrays(1, &VAO);
  16. glGenBuffers(1, &VBO);
  17. // Bind the Vertex Array Object first, then bind and set vertex buffer(s) and attribute pointer(s).
  18. glBindVertexArray(VAO);
  19.  
  20. glBindBuffer(GL_ARRAY_BUFFER, VBO);
  21. glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement