좋아, 그래서 윈도우 7에서 비주얼 스튜디오 C++ 10을 설치하면 "OpenGL superbible 5th edition"에서 샘플 progams를 실행할 수 있지만 GLTools와 freeglut을 얻으려면 몇 가지 중요한 문제가 있습니다.
여기 있습니다glu.h 문제가 발생했습니다.
: 지금까지 모든 것을 설정하는 방법 .........................
주먹 내가 온라인있어 다음 단계를 따라 먼저 너는 glut 또는 freeglut을 다운로드하고, 그 다음에 ofc를 압축 해제합니다.
는 -이 들어가, VisualStudio2008라는 폴더가 있어야 freeglut 폴더에서 http://www.starstonesoftware.com/OpenGL/
에서 zip 파일에서이 있어요.
freeglut이라는 VS 프로젝트 파일이 있어야하며 이것을 실행하고 변환 창이 나타나면 완료를 클릭하십시오. 컴파일을 끝내면 시작할 수 없다고 말하면 괜찮습니다.
이제 동일한 폴더에 Debug라는 새 폴더가 있어야합니다.
내부에는 freeglut.dll이 있습니다. 이것은 당신의 system32 폴더 나 SysWOW64에 들어가야합니다.
마찬가지로이 파일에는 freeglut이라는 파일이 있으며 그 유형은 Object File Library입니다. 이것은 Visual Studio에서 lib 폴더로 이동해야합니다.
이제 메인 자유 유리 폴더로 돌아갑니다. Include라는 폴더가 있어야합니다. 이 폴더 안에는 GL이라는 폴더와 두 개의 파일이 있습니다. 이러한 파일은 Visual Studio의 Include 폴더에 복사해야합니다.
lib 폴더와 Include 폴더는 Microsoft Visual Studio 10.0의 기본 Visual Studio 폴더에있는 VC 폴더 안에 있습니다. .
이 컴퓨터에 대한 관리자 권한이 필요합니다 :이 :)
는`
그럼 내가 GLTools과 freeglut를 설정하려면 다음 단계를 따라 갔다.
i. .h로 끝나는 freeglut 헤더 파일을 모두 C : \ Program Files \ Microsoft Visual Studio 10.0 \ VC \ include \ GL \
ii 폴더에 복사합니다. 모든 GLTools 헤더 파일 (.h로 끝나는)을 C : \ Program Files \ Microsoft Visual Studio 10.0 \ VC \ include \
iii으로 복사하십시오. Visual Studio 10.0 \ VC \ lib \
iv :C : \ Program Files \ Microsoft로 freeglut 및 GLTools 라이브러리 파일을 모두 복사하십시오. lib 폴더에 GLTools.lib 을 복사 했더라도 프로젝트를 컴파일 할 때 GLTools.lib 파일 을 사용하도록 VS2010에 지시해야 할 수도 있습니다. 메뉴 옵션 보기 → 속성 관리자에서 속성 관리자 (이 작업을 수행하려면 프로젝트가 열려 있어야 함)를 엽니 다. 왼쪽의 VS IDE의 손 모양이 으로 변경되어 속성 관리자가 표시됩니다. 크기를 조정하면 더 쉽게 읽을 수 있습니다.전체 목록은 에 Microsoft.Cpp.Win32.user 링크가 사용자 속성 대화 상자를 엽니 다 중 하나에 미도, 두 번 클릭 경우 프로젝트를 확장합니다. 속성 관리자에서 링커 → 입력을 선택한 다음 추가 종속성을 클릭하십시오 (아래 참조). 대화 상자에서 "GLTools.lib"를 추가하면 또한 feeglut_static.lib를 추가했습니다!
#include <GLTools.h> // OpenGL toolkit
#include <GLShaderManager.h> // Shader Manager Class
#ifdef __APPLE__
#include <glut/glut.h> // OS X version of GLUT
#else
#define FREEGLUT_STATIC
#include <GL/glut.h> // Windows FreeGlut equivalent
#endif
GLBatch triangleBatch;
GLShaderManager shaderManager;
///////////////////////////////////////////////////////////////////////////////
// Window has changed size, or has just been created. In either case, we need
// to use the window dimensions to set the viewport and the projection matrix.
void ChangeSize(int w, int h)
{
glViewport(0, 0, w, h);
}
///////////////////////////////////////////////////////////////////////////////
// This function does any needed initialization on the rendering context.
// This is the first opportunity to do any OpenGL related tasks.
void SetupRC()
{
// Blue background
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
shaderManager.InitializeStockShaders();
// Load up a triangle
GLfloat vVerts[] = { -0.5f, 0.0f, 0.0f,
0.5f, 0.0f, 0.0f,
0.0f, 0.5f, 0.0f };
triangleBatch.Begin(GL_TRIANGLES, 3);
triangleBatch.CopyVertexData3f(vVerts);
triangleBatch.End();
}
///////////////////////////////////////////////////////////////////////////////
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
GLfloat vRed[] = { 1.0f, 0.0f, 0.0f, 1.0f };
shaderManager.UseStockShader(GLT_SHADER_IDENTITY, vRed);
triangleBatch.Draw();
// Perform the buffer swap to display back buffer
glutSwapBuffers();
}
///////////////////////////////////////////////////////////////////////////////
// Main entry point for GLUT based programs
int main(int argc, char* argv[])
{
gltSetWorkingDirectory(argv[0]);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
glutInitWindowSize(800, 600);
glutCreateWindow("Triangle");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(RenderScene);
GLenum err = glewInit();
if (GLEW_OK != err) {
fprintf(stderr, "GLEW Error: %s\n", glewGetErrorString(err));
return 1;
}
SetupRC();
glutMainLoop();
return 0;
}
그리고 마지막으로 마지막으로, 여기에 오류 메신저 recieveing이야을 :
좋아, 그래서 여기에 드디어 내가 실행하는 데 묶는거야 코드의
1>------ Build started: Project: Triangle, Configuration: Debug Win32 ------
1> Triangle.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(225): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(225): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(226): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(226): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(226): error C2086: 'int GLAPI' : redefinition
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(225) : see declaration of 'GLAPI'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(227): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(227): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(227): error C2086: 'int GLAPI' : redefinition
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\gl\glu.h(225) : see declaration of 'GLAPI'
오류 C1003 : 오류 수가 100을 초과; 컴파일
정지이 영원히 계속 그리고 난 같은 문제가있을 수있는 방법을 모른다, 그리고 왜 GLU.h에서 일어나고! 나는 일주일 동안이 문제가 있었는지 잘 모르겠다. Please Help Hert =)
감사의 말을하고 질문이 있으시면 언제든지 부탁드립니다.
귀하의 VC++ 2,010분의 2,008 문은 단지 잘못된 줄에서 시작하는 우리에게 GL/glu.h의 블록을 표시해야합니다. VS2005만큼 C/C++ 속성 페이지에는 "추가 포함 디렉터리"속성이 있고 링커 페이지에는 "추가 라이브러리 디렉터리"속성이 있습니다. 예, 컴퓨터 전체의 디렉토리 설정도 있지만 부스트와 같은 것입니다. – MSalters
@MSalters : 실제로 Visual C++ 1 (Visual Studio의 거대 조상)에 추가 포함 및 라이브러리를 설정할 수 있습니다. 나는 아직도 디스켓을 가지고있다. 그리고 Visual C++ 4와 5는 CD를 가지고 있기 때문에 누구나 정말 원하는 증거가 있다면 VM에 설치하고 비디오를 녹화합니다. – datenwolf
@MSalters : No. 2010 년에는 컴퓨터 전체의 디렉터리 설정이 없습니다. 최소한 Microsoft C/C++ 컴파일러 7.0 (Visual C++은 사용하지 않음) 이후로 include 디렉토리를 설정하는 명령 행 옵션을 사용할 수있었습니다. GLUT와 같은 라이브러리는 부스트와 같은 라이브러리와 어떻게 다른가요? 사실이 일반 유틸리티 라이브러리는 컴퓨터 전반 (또는 적어도 사용자 프로필 전체)에서 구성 가능하며 더 이상 VC2010에 없습니다. 그러나 파일을 Microsoft 포함 디렉토리에 복사하는 것은 좋은 해결책이 아닙니다. –