12/26/2011

How to install OpenGL in Window OS and Visula C++ 2008

You can download OpenCV 3.7 version on this web address http://www.opengl.org/resources/libraries/glut/glut37.zip
The Zip file has below files.



1) You have to copy these file into right directories.


x86  (32bit)
glut32.dll   = C:\Windows\System32
glut.dll       = C:\Windows\System32

x64 (62bit)
glut32.dll   = C:\Windows\sysWOW64
glut.dll       = C:\Windows\sysWOW64

glut.h        = C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl

glut.lib      = C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
glut32.lib = C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib

※  If you met some errors, Copy files additional folder.
C:\Program Files\Microsoft Visual Studio 9.0\VC\lib
C:\Program Files\Microsoft Visual Studio 9.0\VC\include
copy glut.lib, glut32.lib and glut.h into additional folders.

2) Visual Studio Setting
Linker->input, Additional Dependencies -> opengl32.lib glu32.lib glut32.lib

This is example source code.

#include 
void Draw()
{
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(1.0f, 0.0f, 1.0f);
    glBegin(GL_QUADS);
        glVertex3f(-0.5f, 0.5f, 0.5f);
        glVertex3f(0.5f, 0.5f, 0.5f);
        glVertex3f(0.5f, -0.5f, 0.5f);
        glVertex3f(-0.5f, -0.5f, 0.1f);
    glEnd();

    glFlush();
}

void main()
{
    glutCreateWindow("NeMo");
    glutDisplayFunc(Draw);
    glutMainLoop();
}

This setting process is normal course, but I met the this errors message in the Visual Studio 2008.
1>NeMo.obj : error LNK2001: __imp____glutCreateWindowWithExit@8 μ™ΈλΆ€ 기호λ₯Ό 확인할 수 μ—†μŠ΅λ‹ˆλ‹€.
1>C:\Users\mare\Documents\λ„€μ΄νŠΈμ˜¨ 받은 파일\NeMo\Debug\NeMo.exe : fatal error LNK1120: 1개의 확인할 수 μ—†λŠ” μ™ΈλΆ€ μ°Έμ‘°μž…λ‹ˆλ‹€.

SO, I have solved this problem. I made OpenGL Folder at C:\OpenGL. The Folder has DLL, Lib, Header sub-folders. (DownLoad)
 

I have done directory setting in the Visual Studio options.
And you have to change #include <~> to #include "~" on the source code.

I want to suceess to complie OpneGL Project on your machine.
Thanks you.







No comments:

Post a Comment