Linux下的opengl庫環境安裝使用

2021-08-02 08:59:24 字數 1194 閱讀 5757

分類: c/c++

安裝幾個庫:

apt-get install freeglut3-dev

apt-get install libxi-dev

apt-get install libxmu-dev

---- **(網上直接借鑑的)

/* light.c

此程式利用glut繪製乙個opengl視窗,並顯示乙個加以光照的球。

*//* 由於標頭檔案glut.h中已經包含了標頭檔案gl.h和glu.h,所以只需要include 此檔案*/

# include

# include

/* 初始化材料屬性、光源屬性、光照模型,開啟深度緩衝區 */

void init ( void )

;glfloat mat_shininess [ ] = ;

glfloat light_position [ ] = ;

glclearcolor ( 0.0, 0.0, 0.0, 0.0 );

glshademodel ( gl_smooth );

glmaterialfv ( gl_front, gl_specular, mat_specular);

glmaterialfv ( gl_front, gl_shininess, mat_shininess);

gllightfv ( gl_light0, gl_position, light_position);

glenable (gl_lighting);

glenable (gl_light0);

glenable (gl_depth_test);

}/*呼叫glut函式,繪製乙個球*/

void display ( void )

/* 定義glut的reshape函式,w、h分別是當前視窗的寬和高*/

void reshape (int w, int h)

/* 定義對鍵盤的響應函式 */

void keyboard ( unsigned char key, int x, int y)

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

3---- 編譯執行(我的檔名是a.c):

命令: gcc a.c -o a. -lgl -lglut

然後ls就可以看到那個編譯後的檔案了:

4---執行:

命令:    ./a 

Linux下elasticsearch環境搭建文件

此處忽略,請自行完成。wget unzip elasticsearch 6.5.4.tar.gz cd elasticsearch 6.5.4 vi config elasticsearch.yml network.host 0.0.0.01 情況 sudo sysctl w vm.max map ...

VC 2008環境下的OpenGL配置

vc 2008環境下的opengl配置 蔣明原 2009 3 7 裡面包含了glut32.lib glut32.dll以及glut.h 2.將glut.h放到c program files microsoft sdks windows v6.0a include gl目錄下 glut32.lib放到...

VC 2008環境下的OpenGL配置

裡面包含了glut32.lib glut32.dll以及glut.h 2.將glut.h放到c program files microsoft sdks windows v6.0a include gl目錄下 glut32.lib放到c program files microsoft sdks wi...