Description
简单搭建 & 测试下环境和 tool chain
,OpenGL + GLFW + GLEW
Project structure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Project Root ================ │ main.cpp │ makefile ├───include │ ├───GL │ │ eglew.h │ │ glew.h │ │ glxew.h │ │ wglew.h │ │ │ └───GLFW │ glfw3.h │ glfw3native.h │ └───lib glew32d.dll glfw3.dll |
Codes
makefile
1 2 3 4 5 6 7 8 9 |
CC = g++ INCFLAGS = -I include LDFLAGS = -L lib -lglfw3 -lglew32d -lopengl32 all: $(CC) 00_env-setup.cpp -o 00_env-setup $(INCFLAGS) $(LDFLAGS) clean: @del *.o *.exe |
00_env-setup.cpp
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 |
// 00_env-setup.cpp #include <GL/glew.h> #include <GLFW/glfw3.h> void display(){ static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 1.0f}; glClearBufferfv(GL_COLOR, 0, red); } int main(void) { GLFWwindow* window; glfwInit(); window = glfwCreateWindow(800, 600, "Hello, World!", NULL, NULL); glfwMakeContextCurrent(window); glewInit(); while (!glfwWindowShouldClose(window)) { display(); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; } |