0

I'm attempting to work with openGL in visual studio 2010, and so far my code looks like so

#include<gl\GLU.h>
#include<gl\GL.h>

int main(int argc, char**argv){

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(640, 480);
    glutCreateWindow("Simple GLUT application");

    glutMainLoop();

}

Visual studio is not recognizing any of the glut methods and is throwing errors such as "glutInit not recognized"

I know it is some error with how I linked the libraries, but I am new at this, so please be kind. Anyone know how to get this example working properly?

4

2 回答 2

5

您需要包含过剩标题。Glut 是“GL 实用工具包”,是建立在 OpenGL 之上的独立库,而不是 OpenGL 本身的一部分。

如果您将它们与您的其他包含在同一目录中,它将读取

#include<gl\GLUT.h>

欲了解更多信息:这里

于 2012-09-20T17:19:38.287 回答
-1

您是否确保将 glut32.dll 复制到 %windir%\system 并将 glut.h 复制到 %VSdir%\VC\include\GL 并将 glut32.lib 复制到 %VSdir%\lib?如果你做对了,那么你将在智能感知中看到 Open GL 方法。

于 2012-09-20T17:25:33.167 回答