728x90
반응형

Visual Studio 2019에서 OpenGL 설치 및 환경설정 방법


  • freeglut 3.0.0 MSVC Package 다운로드

https://www.transmissionzero.co.uk/software/freeglut-devel/

 

freeglut Windows Development Libraries

Introduction Whilst at the University of Essex, I took a module called “Interactive Computer Graphics” (or EE222 as we referred to it). Half of the course consisted of using POV-Ray to create images, and then putting them together to make a high qualit

www.transmissionzero.co.uk

Package를 다운받아 적당한 공간에 .zip 파일을 풀어준다.

 

 

64비트에서 사용할 때는 x64폴더 내에 있는 freeglut.lib을 사용하고 32비트 환경에서 사용할 때는 lib폴더 내에 있는 freeglut.lib을 사용하면 된다.

 

 

include폴더와 lib폴더 그리고 freeglut.lib 파일을 복사하여 사용하고자하는 Visual Studio 환경 폴더에 복사한다.

 

 

C/C++ 일반 → 추가 포함 디렉터리 : ./include 설정

 

 

링커 일반 → 추가 라이브러리 디렉터리 : ./lib/x64 설정

 

 

예제

#include "gl/glut.h"

void display() {

    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);
    
    // 폴리곤 컬러
    glColor3f(1.0f, 0.0f, 1.0f);
 

    // 폴리곤을 그려주는 예
    glBegin(GL_POLYGON);
    glVertex3f(-0.3f, -0.3f, 0.0f);
    glVertex3f(0.3f, -0.3f, 0.0f);
    glVertex3f(0.3f, 0.3f, 0.0f);
    glVertex3f(-0.3f, 0.3f, 0.0f);


    glEnd();
    glFinish();
}

int main(int argc, char** argv)

{
    glutInit(&argc, argv);
    glutCreateWindow

    ("Hello OpenGL");

    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}

728x90
반응형

+ Recent posts