<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 在A(yíng)RM Linux上使用OpenGL

在A(yíng)RM Linux上使用OpenGL

作者: 時(shí)間:2016-11-09 來(lái)源:網(wǎng)絡(luò ) 收藏
這兩天在ARM上跑了一個(gè)OpenGL,應該說(shuō)是OpenGL|ES的軟件包,雖然我覺(jué)得可能最后我不會(huì )使用這個(gè)軟件包,但是還是記錄下來(lái)以備忘記。
先全局介紹下,首先,什么是OpenGL和OpenGL|ES。OpenGL是一套繪圖函數的標準,OpenGL|ES是OpenGL中針對嵌入式系統的一套函數子集。OpenGL|ES的官方是http://www.khronos.org/opengles/, 上面有更多的信息。需要注意的是,OpenGL僅僅是標準,而如果你要使用OpenGL,則需要找到可以實(shí)現這些OpenGL標準函數的程序庫或源代碼。 目前,在A(yíng)RM這種一般沒(méi)有圖形加速器的平臺上,OpenGL|ES的實(shí)現都是靠軟件的。主要的OpenGL|ES程序庫有:Klimt,Vincent (ogles),TinyGL等。Google一下,可以看到它們的主頁(yè)。這些實(shí)現基本上都是基于X11、Qt/E這樣的窗口平臺的。我用的軟件包叫做 PicoGL,它是TinyGL的一個(gè)分支,不同之處就在于PicoGL支持直接在Framebuffer上輸出圖像。PicoGL是一位臺灣同胞寫(xiě)的, 他的主頁(yè)http://jserv.sayya.org/。但是這個(gè)軟件包的源碼極其難找,我用的是一位很牛的同事搜到的,地址是http://people.openmoko.org/jserv/graphics/picogl-20051108.tar.bz2。
要使用這個(gè)軟件包還必須有支持軟件浮點(diǎn)的交叉編譯器,我們一般用的arm-linux-gcc 2.95.3/3.3.2/3.4.1等都不支持軟件浮點(diǎn),這需要我們重新編譯一個(gè)。編譯一個(gè)交叉編譯器,引用Crosstool作者Dan Kegel的話(huà),used to be a scary prospect,requiring iron will,days if not weeks of effort……幸好有Crosstool這個(gè)工具,如果你的機器好網(wǎng)速快,輸入個(gè)指令,差不多1個(gè)多小時(shí)就可以編譯出來(lái)。crosstool的主頁(yè)http://kegel.com/crosstool/,下載地址http://kegel.com/crosstool/crosstool-0.43.tar.gz。
首先制作交叉編譯器,先以root用戶(hù)登陸,建立交叉編譯器安裝目錄,而且把目錄所有者改為你的普通用戶(hù)
# mkdir /opt/crosstool
# chown /opt/crosstool lxz
# chgrp /opt/crosstool users
然后以普通用戶(hù)登陸,解壓縮和安裝
# tar xvzf crosstool-0.43.tar.gz
# cd crosstool-0.43
# ./demo-arm-softfloat.sh
crosstool會(huì )從網(wǎng)上下載需要的源碼包,然后編譯,最后安裝。crosstool相關(guān)的資料可以看http://kegel.com/crosstool/current/doc/crosstool-howto.html。然后在/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu里面就會(huì )有支持軟件浮點(diǎn)的交叉編譯器了。
然后解壓縮picogl,修改picogl的代碼。
首先是picogl的一處bug,在backends/vesafb/tk.c的第一行增加宏
#define _FB_TK_
然后把backends/vesafb/glx_impl.h里面的
struct fb_fix_screeninfo FixedInfo;
struct fb_var_screeninfo VarInfo, OrigVarInfo;
修改為
#ifdef _FB_TK_
struct fb_fix_screeninfo FixedInfo;
struct fb_var_screeninfo VarInfo, OrigVarInfo;
#else
extern struct fb_fix_screeninfo FixedInfo;
extern struct fb_var_screeninfo VarInfo, OrigVarInfo;
#endif
這是因為有好幾個(gè)文件調用了backends/vesafb/glx_impl.h,如果不這么改,會(huì )出現多重定義錯誤。
然后,為了讓你的程序使用picogl更方便些,最好再改個(gè)地方include/GL/glx.h
#include GLX_IMPL_HEADER
改為你喜歡的方式,指向backends/vesafb/glx_impl.h
修改backends/vesafb/tk.c中,initialize_fbdev函數有關(guān)VarInfo的設置,改為適合你的LCD的。
然后配置
# cd PicoGL
# CC=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin/arm-softfloat-linux-gnu-gcc ./configure --with-backend=vesafb --host=arm-softfloat-linux-gnu --prefix=/home/lxz/builtPicoGL
說(shuō)明下,CC=設置交叉編譯器的位置,--with-backend=vesafb指定使用FB作為顯示設備,host=arm- softfloat-linux-gnu設定交叉編譯,--prefix=/home/lxz/builtPicoGL設定編譯后庫和示例程序安裝位置。
然后
# make
# make install
在/home/lxz/builtPicoGL/lib里就有PicoGL的庫了,把動(dòng)態(tài)庫文件拷貝到arm-linux根文件系統的/lib 里面,把/home/lxz/builtPicoGL/bin里的程序拷貝到arm-linux文件系統的任何地方,然后制作和燒寫(xiě)文件系統映像(或者使 用NFS),執行,就可以看到結果了。
當你編譯一個(gè)使用PicoGL庫的程序(假設叫做hello.c)時(shí),需要輸入
# arm-softfloat-linux-gnu-gcc -c -I /home/lxz/PicoGL/include -I /usr/include hello.c
# arm-softfloat-linux-gnu-gcc -o hello -L /home/lxz/builtPicoGL/lib/libPicoGL.so -L /home/lxz/builtPicoGL/lib/libPicoGLU.so -lm hello.o /home/lxz/builtPicoGL/lib/libPicoGL.a /home/lxz/builtPicoGL/lib/libPicoGLU.a
今天寫(xiě)得比較粗糙,。



關(guān)鍵詞: ARMLinuxOpenG

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>