link : http://www.opengl-tutorial.org/kr/beginners-tutorials/tutorial-1-opening-a-window/
첫 챕터에서는 CMake를 설치하고, 튜토리얼 코드들을 빌드하는 과정을 거쳤다.
다른 부분은 모두 간단했는데 컴파일러를 사용할 때 약간 버벅임이 있었다.
많은 컴파일러 중에 하나를 선택해야했는데 아마도 본인의 컴퓨터에 설치되어 있지 않은 컴파일러도 나오는 듯하다.
오류가 계속 발생해서 log를 보니 Visual Studio 2017은 내 컴퓨터에 설치되지 않았는데 사용하려고 하고 있었다는
로그가 보였고, Visual Studio 2015로 변경하니 오류가 해결되었다.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | // Include standard headers #include <stdio.h> #include <stdlib.h> // Include GLEW #include <GL/glew.h> // Include GLFW #include <glfw3.h> GLFWwindow* window; // Include GLM #include <glm/glm.hpp> using namespace glm; int main( void ) { // Initialise GLFW if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); getchar(); return -1; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL); if( window == NULL ){ fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" ); getchar(); glfwTerminate(); return -1; } glfwMakeContextCurrent(window); // Initialize GLEW if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); getchar(); glfwTerminate(); return -1; } // Ensure we can capture the escape key being pressed below glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE); // Dark blue background glClearColor(0.0f, 0.0f, 0.4f, 0.0f); do{ // Clear the screen. It's not mentioned before Tutorial 02, but it can cause flickering, so it's there nonetheless. glClear( GL_COLOR_BUFFER_BIT ); // Draw nothing, see you in tutorial 2 ! // Swap buffers glfwSwapBuffers(window); glfwPollEvents(); } // Check if the ESC key was pressed or the window was closed while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS && glfwWindowShouldClose(window) == 0 ); // Close OpenGL window and terminate GLFW glfwTerminate(); return 0; } | cs |
간단하게 첫 튜토리얼을 따라했고,
윈도우 창을 띄우는데 성공했다.
'Game > Graphics' 카테고리의 다른 글
OpenGL-Tutorial 6 : Keyboard and Mouse (0) | 2018.06.21 |
---|---|
OpenGL-Tutorial 5 : A Textured Cube (0) | 2018.06.20 |
OpenGL-Tutorial 4 : 색깔이 입혀진 육면체 (0) | 2018.06.20 |
OpenGL-Tutorial 3 : 행렬(매트릭스) (0) | 2018.06.20 |
OpenGL-Tutorial 2 : 첫 삼각형 (0) | 2018.06.20 |