2012-05-01 5 views
4

나는 아주 간단한 "Hello world"OpenGL 3.3 프로그램을 FreeGLUT을 사용하여 컴파일하려고합니다. 내가 찾은 모든 튜토리얼에는 헤더 "gl3.h"가 포함되어 있습니다. 문제는 헤더 파일이 없다는 것입니다. /usr/include/에서아치 리눅스에 OpenGL 3 헤더 없음

$ ls -l /usr/include/GL/ 
total 2164 
-rw-r--r-- 1 root root 8797 20 janv. 17:44 freeglut_ext.h 
-rw-r--r-- 1 root root 681 20 janv. 17:44 freeglut.h 
-rw-r--r-- 1 root root 26181 20 janv. 17:44 freeglut_std.h 
-rw-r--r-- 1 root root 837247 27 janv. 12:55 glew.h 
-rw-r--r-- 1 root root 656589 21 mars 18:07 glext.h 
-rw-r--r-- 1 root root 84468 21 mars 18:07 gl.h 
-rw-r--r-- 1 root root 128943 21 mars 18:07 gl_mangle.h 
-rw-r--r-- 1 root root 17255 21 mars 18:07 glu.h 
-rw-r--r-- 1 root root 3315 21 mars 18:07 glu_mangle.h 
-rw-r--r-- 1 root root 639 20 janv. 17:44 glut.h 
-rw-r--r-- 1 root root 62741 27 janv. 12:55 glxew.h 
-rw-r--r-- 1 root root 43887 21 mars 18:07 glxext.h 
-rw-r--r-- 1 root root 17170 21 mars 18:07 glx.h 
-rw-r--r-- 1 root root 4706 3 févr. 13:33 glxint.h 
-rw-r--r-- 1 root root 3463 21 mars 18:07 glx_mangle.h 
-rw-r--r-- 1 root root 2086 3 févr. 13:33 glxmd.h 
-rw-r--r-- 1 root root 80979 3 févr. 13:33 glxproto.h 
-rw-r--r-- 1 root root 11246 3 févr. 13:33 glxtokens.h 
drwxr-xr-x 2 root root 4096 14 avril 14:03 internal 
-rw-r--r-- 1 root root 8497 21 mars 18:07 osmesa.h 
-rw-r--r-- 1 root root 51274 21 mars 18:07 vms_x_fix.h 
-rw-r--r-- 1 root root 59403 27 janv. 12:55 wglew.h 
-rw-r--r-- 1 root root 41377 21 mars 18:07 wglext.h 
-rw-r--r-- 1 root root 4468 21 mars 18:07 wmesa.h 

난 단지 GL, GLESGLES2 있습니다. 일부 자습서에서 찾은 바 no GL3입니다.

저는 NVIDIA 그래픽 카드 (닫힌 소스 드라이버 nvidia)가있는 아치 리눅스 x86_64에서 실행됩니다.

#define GL3_PROTOTYPES 1 
#include <GL/gl.h> 
#include <GL/freeglut.h> 

그러나 코드는 컴파일되지 않습니다 : 여기에

내가 내 프로그램에서 OpenGL을하고 FreeGLUT API를 포함하는 방법이다

$ g++ -pipe -g -Wall -Wextra -pedantic -I. -IHeaders -c Sources/Main.cpp -o Temp/Objects/Main.o 
Sources/Main.cpp: In function ‘int main(int, char**)’: 
Sources/Main.cpp:107:59: error: ‘glVertexAttribPointer’ was not declared in this scope 
Sources/Main.cpp:108:30: error: ‘glEnableVertexAttribArray’ was not declared in this scope 
Sources/Main.cpp:114:35: error: ‘glUseProgram’ was not declared in this scope 
Sources/Main.cpp:138:31: error: ‘glDisableVertexAttribArray’ was not declared in this scope 

내가 OpenGL을 2 헤더를 포함 보인다! 그러나 다시, 내 시스템에서 OpenGL 3 헤더를 찾지 못했습니다. 아치 저장소와 AUR을 제대로 보지 못했습니다.

도움 주셔서 감사합니다.

답변

7

GL3.h가 필요 없으며 GL3.h는 사용되지 않는 기능을 모두 제거했습니다. 따라서 gl3.h 대신 gl.h을 포함하십시오. /usr/include/GL/에 다운로드하여 수동으로 복사하는 것은 실제 솔루션이 아닙니다. 그래, 작동하지만 mesa 패키지에 gl3.h을 추가하면 어떻게됩니까? 패키지 관리자가 충돌을 발견하게됩니다. 프로젝트 나 홈 디렉토리에 gl3.h을 추가하고 $ PATh에 추가하거나 -I 플래그를 사용하는 것이 좋습니다.

0

glVertexAttribPointer, glEnableVertexAttribArray, glUseProgram 및 glDisableVertexAttribArray위한 grep 경우, 당신은 그들이 glext.hglew.h에 포함되어 있음을 발견 할 것이다. 이 헤더 중 하나를 포함시키고 다시 컴파일하십시오.

+0

GLEW 라이브러리를 링크해야하기 때문에'glew.h' 코드 만 컴파일하지만 링크하지 않으면 실제로'gl3.h'를 직접 사용하므로 GLEW가 필요하지 않습니다. . 'glext.h'의 경우 오류는 같습니다. –