Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GLFW/glfw3.h>
- #include <stdlib.h>
- #include <stdio.h>
- int main(void)
- {
- GLFWwindow* window;
- if (!glfwInit())
- exit(EXIT_FAILURE);
- window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
- if (!window) {
- glfwTerminate();
- exit(EXIT_FAILURE);
- }
- glfwMakeContextCurrent(window);
- while (!glfwWindowShouldClose(window))
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glBegin(GL_TRIANGLES);
- glColor3f(1.f, 0.f, 0.f);
- glVertex3f(-0.6f, -0.4f, 0.f);
- glColor3f(0.f, 1.f, 0.f);
- glVertex3f(0.6f, -0.4f, 0.f);
- glColor3f(0.f, 0.f, 1.f);
- glVertex3f(0.f, 0.6f, 0.f);
- glEnd();
- glfwSwapBuffers(window);
- }
- glfwDestroyWindow(window);
- glfwTerminate();
- exit(EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement