-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (30 loc) · 853 Bytes
/
main.cpp
File metadata and controls
44 lines (30 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <GL/gl.h>
#include "glfw3.h"
int main()
{
GLFWwindow* window;
if (!glfwInit()) return -1;
window = glfwCreateWindow(480, 320, "TestOpenGL", NULL ,NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window))
{
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(0.0, 1.0 ,0.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3f(-1.0, -1.0 ,0.0);
glColor3f(1.0, 0.0, 1.0);
glVertex3f(1.0, -1.0 ,0.0);
glEnd();
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}