Compile your own OpenGL projects stepped pit

  Ideal as a programmer, you certainly do not want this to us Visual Studio IDE bound paved road, one day you want to start from scratch programming. Step on pit road in front of you, as a makefile novice, I hope these stepped pit recorded for later how to climb out of the pit to guide the novice.

  At first we have to learn to write the way Visual Studio Opengl procedures, and here I do not want to go into details, you can refer to learnopengl-CN , or Fu teacher B station video tutorials .

  If you learn Visual Studio OpenGL programming style, we can make the next step. This is my code:

 1 #include <iostream>
 2 #include <GLFW/glfw3.h>
 3 
 4 int main(void)
 5 {
 6     GLFWwindow* window;
 7     if (!glfwInit())
 8         return -1;
 9     window = glfwCreateWindow(1000, 1000, "Hello World", NULL, NULL);
10     if (!window)
11     {
12         glfwTerminate();
13         return -1;
14     }
15     glfwMakeContextCurrent(window);
16     while (!glfwWindowShouldClose(window))
17     {
18         glfwSwapBuffers(window);
19         glfwPollEvents();
20     }
21     glfwTerminate();
22     return 0;
23 }

If you are successful, you will get a black form, entitled hello world, we copy the code to the next new directory

 

Guess you like

Origin www.cnblogs.com/wulc/p/11627778.html