天天看點

openGL配置總結

opengl配置總結

  • 在官網下載下傳如圖檔案 點選跳轉.
openGL配置總結
  • 在visual studio建立的項目中添加檔案夾

    Dependecies\GLFW

openGL配置總結
  • 将下載下傳的glfw中的如圖檔案夾添加至上述建立檔案夾中
    openGL配置總結
openGL配置總結
  • 選擇項目的屬性
    openGL配置總結
  • 添加附加目錄
    openGL配置總結
    openGL配置總結
    openGL配置總結
  • 重新生成
openGL配置總結
  • 測試結果
    openGL配置總結
  • 測試文檔
#include <GLFW/glfw3.h>

int main(void)
{
   GLFWwindow* window;

   /* Initialize the library */
   if (!glfwInit())
       return -1;

   /* Create a windowed mode window and its OpenGL context */
   window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
   if (!window)
   {
       glfwTerminate();
       return -1;
   }

   /* Make the window's context current */
   glfwMakeContextCurrent(window);

   /* Loop until the user closes the window */
   while (!glfwWindowShouldClose(window))
   {
       /* Render here */
       glClear(GL_COLOR_BUFFER_BIT);

       /* Swap front and back buffers */
       glfwSwapBuffers(window);

       /* Poll for and process events */
       glfwPollEvents();
   }

   glfwTerminate();
   return 0;
}	

           

繼續閱讀