背景:#EDF0F5 #FAFBE6 #FFF2E2 #FDE6E0 #F3FFE1 #DAFAF3 #EAEAEF 默认  
阅读内容

Linux下编写OpenGL程序的前置工作

[日期:2007-12-15] 来源:Linux公社  作者:Linux [字体: ]


Linux下编写OpenGL程序的前置工作

需要用到的软件包有两个,glut 和tmake,分别可以从以下两个网址下载:

http://www.opengl.org/resources/libraries/glut/glut-3.7.tar.gz

ftp://ftp.trolltech.com/freebies/tmake/tmake-1.8.tar.gz

下载后的文件假设都放在/usr/src中

首先是安装glut库,以下是从www.linux.com找到的编译glut库的手册。

Install GLUT 3.7 Distribution (optional)

If you installed the MesaDemos/MesaLib package, then you have already installed GLUT 3.7 since it is included with MesaDemos. However, you may be interested in installing the GLUT

manpages and you can skip right to the "Install GLUT manual pages", below ...

Installing GLUT is a bit tricky. I'm not too familiar with imake, the program that it uses to manage the Makefiles, and didn't quite see how to get GLUT to install to where I wanted it (/usr/lib,

but MesaDemos will do this without any trouble though). It can be done manually anyhow:

cd /usr/src

 tar -xvzf glut-3.7.tar.gz

 cd glut-3.7

Read the file: README.linux

 cd linux

 READ the file: README

 cp Glut.cf ..

 cd ..

 Edit Glut.cf: remove any Mesa references.

 Replace any -lMesaGL -lMesaGLU with -lGL -lGLU if needed.

 In particular, replace:

  OPENGL = $(TOP)/../lib/libMesaGL.so

  GLU = $(TOP)/../lib/libMesaGLU.so

 with:

  OPENGL = -lGL

  GLU = -lGLU

./mkmkfiles.imake

 cd lib/glut

 cp /usr/src/glut-3.7/linux/Makefile .

 Edit the Makefile: remove any Mesa references.

 Replace any -lMesaGL -lMesaGLU with -lGL -lGLU if needed.

 In particular, replace:

  OPENGL = $(TOP)/../lib/libMesaGL.so

  GLU = $(TOP)/../lib/libMesaGLU.so

 with:

  OPENGL = -lGL

  GLU = -lGLU

make

 ln -s libglut.so.3.7 libglut.so

 ln -s libglut.so.3.7 libglut.so.3

 cp -d libglut.* /usr/lib

 cd ..

 cd gle

 # make a shared lib for libgle

 make

 gcc -shared -o libgle.so.3.7 *.o

 ln -s libgle.so.3.7 libgle.so

 ln -s libgle.so.3.7 libgle.so.3

 cp -d libgle.* /usr/lib

 cd ..

 cd mui

 # make a shared lib for libmui

 make

 gcc -shared -o libmui.so.3.7 *.o

 ln -s libmui.so.3.7 libmui.so

 ln -s libmui.so.3.7 libmui.so.3

 cp -d libmui.* /usr/lib

# Install the GLUT manual pages (not included with MesaDemos)

 cd /usr/src/glut-3.7

 make SUBDIRS=man Makefile

 cd man/glut

 make install.man

 ldconfig

cd ../../progs/demos/ideas

 # edit the Makefile, change OPENGL = -lGL and GLU = -lGLU

 makecd de

 ./ideas

 # test compiling some demos

 # take a look at which libraries have to be linked (-lX11 ...) in

 # the Makefiles.  Qt's tmake program available at www.troll.no

 # is a quick way to make a Makefile but you have to edit it

 # and add the -l needed.

ideas如果运行成功的话,说明glut已经可以用了。

12下一页  GO


相关资讯      
本文评论       全部评论
发表评论
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款


点评: 字数
姓名:

L
I
N
U
X


GOOGLE搜索
Google