LINUX 下构建OpenGL ES 3.0

Ubuntu LINUX 下构建OpenGL ES 3.0

Category : OpenGL

LINUX 下构建OpenGL ES 3.0
软件:PowerVRSDKSetup-4.0.run-x64
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
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值