您的位置:首页 > 运维架构 > Linux

LINUX 下构建OpenGL ES 3.0

2016-09-20 11:39 281 查看

Ubuntu LINUX 下构建OpenGL ES 3.0

Category :
OpenGL

LINUX 下构建OpenGL ES 3.0
软件:PowerVRSDKSetup-4.0.run-x64

https://community.imgtec.com/developers/powervr/graphics-sdk/
操作系统:Ubuntu 14.04

null@dev:~/desktop$ sudo ./PowerVRSDKSetup-4.0.run-x64
[sudo] password for null:
null@dev:~/desktop$ sudo apt-get install build-essential cmake cmake-curses-gui
null@dev:~/desktop$ ls
opengles3-book-master  opengles3-book-master.zip
null@dev:~/opengles3$ cd opengles3-book-master/
null@dev:~/opengles3/opengles3-book-master$ ls
Android_Java  Chapter_14  Chapter_7  CMakeLists.txt  LICENSE
Chapter_10    Chapter_2   Chapter_8  Common          README.md
Chapter_11    Chapter_6   Chapter_9  External
null@dev:~/opengles3/opengles3-book-master$ mkdir build
null@dev:~/opengles3/opengles3-book-master$ cd build
null@dev:~/opengles3/opengles3-book-master/build$ cmake ../
— The C compiler identification is GNU 4.8.4
— The CXX compiler identification is GNU 4.8.4
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — works
— Detecting C compiler ABI info
— Detecting C compiler ABI info – done
— Check for working CXX compiler: /usr/bin/c++
— Check for working CXX compiler: /usr/bin/c++ — works
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info – done
— Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
— Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so – found
— Looking for gethostbyname
— Looking for gethostbyname – found
— Looking for connect
— Looking for connect – found
— Looking for remove
— Looking for remove – found
— Looking for shmat
— Looking for shmat – found
— Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
EGL_LIBRARY
    linked by target “Common” in directory /home/null/opengles3/opengles3-book-master/Common
OPENGLES3_LIBRARY
    linked by target “Common” in directory /home/null/opengles3/opengles3-book-master/Common
— Configuring incomplete, errors occurred!
See also “/home/null/opengles3/opengles3-book-master/build/CMakeFiles/CMakeOutput.log”.
运行:ccmake ../



enter 进入编辑。
找到
/opt/Imagination/PowerVR_Graphics/PowerVR_SDK/SDK_4.0/Builds/Linux/x86_64/Lib/libEGL.so
/opt/Imagination/PowerVR_Graphics/PowerVR_SDK/SDK_4.0/Builds/Linux/x86_64/Lib/libGLESv2.so



完成配置后按C保存,再按Q退出ccmake。



再执行cmake,生成makefile,然后执行make:
null@dev:~/opengles3/opengles3-book-master/build$ cmake ../
— Configuring done
— Generating done
— Build files have been written to: /home/null/opengles3/opengles3-book-master/build
null@dev:~/opengles3/opengles3-book-master/build$ ls
Chapter_10  Chapter_14  Chapter_6  Chapter_8  CMakeCache.txt  cmake_install.cmake  Makefile
Chapter_11  Chapter_2   Chapter_7  Chapter_9  CMakeFiles      Common
null@dev:~/opengles3/opengles3-book-master/build$ make



准备运行Hello_Triangle。
null@dev:~/opengles3/opengles3-book-master/build/Chapter_2$ cd Hello_Triangle/
null@dev:~/opengles3/opengles3-book-master/build/Chapter_2/Hello_Triangle$ ls
CMakeFiles  cmake_install.cmake  Hello_Triangle  Makefile
null@dev:~/opengles3/opengles3-book-master/build/Chapter_2/Hello_Triangle$ ./Hello_Triangle
段错误 (核心已转储)
设置环境变量也没有解决。
null@dev:~/opengles3/opengles3-book-master/build/Chapter_2/Hello_Triangle$ export LD_LIBRARY_PATH=/opt/Imagination/PowerVR_Graphics/PowerVR_SDK/SDK_4.0/Builds/Linux/x86_64/Lib/
段错误 (核心已转储) 解决办法:

  Linux默认给一个进程分配的栈空间大小为8M。c++申请变量时,new操作申请的变量在堆中,其他变量一般在存储在栈中。因此如果数组开的过大变会出现这种问题。可以用指令ulimit -s XXXX来申请更大的栈空间。

null@dev:/opengles3/opengles3-book-master/build/Chapter_2/Hello_Triangle$
ulimit -a

null@dev:/opengles3/opengles3-book-master/build/Chapter_2/Hello_Triangle$ ulimit -s  102400
null@dev:/opengles3/opengles3-book-master/build/Chapter_2/Hello_Triangle$ sudo ./Hello_Triangle

*****************************************

code: https://github.com/zjucsxxd/opengles3-book
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: