OpenGL实践之--代码重现

  最近想学习下opengl编程,从图书馆借了本书《OpenGL Programming Guide》中文版,书上的代码从https://github.com/openglredbook/examples下载了,速度不快,但是编译出现了许多错误。后来找到一片博客,博主的解决方法更加彻底,改了些代码,并传到了链接: https://pan.baidu.com/s/15n0t0pMNPzz8bF5BBPkRbg 提取码: w23m,也不是很大,40多M。下载完成后,根据书上的提示,把所有环境和第三方库都搭建完成后,按照代码说明,编译依旧没有成功。我自己也加个:链接: https://pan.baidu.com/s/1R_VbBmQeYlJbuiw0vsknow 提取码: 65n2 后来作了调整:

1、下载百度网pan的代码后,解压

  tar -xvf OpenGL Programming Guide 9th Edition.tar.xz

2、切换到源码目录,我为了方便,多了个改名的步骤,如果无所谓可以不改:

  mv 源代码/  sourceCode

  cd soureCode/OGLPG-9th-Edition/OGLPG-9th-Edition/build

3、cmake

  cmake ..               //最好不要用书上说的cmake -G "Unix Makefile" ..  依旧编译错误

4、make

  make

nication � … � OGLPG-9th-Edition � OGLPG-9th-Edition � build � make
[ 10%] Built target glfw
[ 16%] Built target vermilion
[ 17%] Linking CXX executable ../bin/12-simplecompute
[ 18%] Built target 12-simplecompute
[ 18%] Linking CXX executable ../bin/12-raytracer
[ 19%] Built target 12-raytracer
[ 20%] Linking CXX executable ../bin/12-particlesimulator
[ 20%] Built target 12-particlesimulator
[ 20%] Linking CXX executable ../bin/04-gouraud
[ 21%] Built target 04-gouraud
[ 22%] Linking CXX executable ../bin/03-xfb
[ 22%] Built target 03-xfb
[ 23%] Linking CXX executable ../bin/08-lightmodels
[ 23%] Built target 08-lightmodels
[ 24%] Linking CXX executable ../bin/03-pointsprites
[ 24%] Built target 03-pointsprites
[ 25%] Linking CXX executable ../bin/03-primitiverestart
[ 26%] Built target 03-primitiverestart
[ 27%] Linking CXX executable ../bin/03-instancing3
[ 28%] Built target 03-instancing3
[ 29%] Linking CXX executable ../bin/04-shadowmap
[ 29%] Built target 04-shadowmap
[ 30%] Linking CXX executable ../bin/06-statictexture
[ 30%] Built target 06-statictexture
[ 30%] Linking CXX executable ../bin/11-doublewrite
[ 31%] Built target 11-doublewrite
[ 32%] Linking CXX executable ../bin/04-gouraud-float
[ 33%] Built target 04-gouraud-float
[ 34%] Linking CXX executable ../bin/06-load-texture
[ 35%] Built target 06-load-texture
[ 36%] Linking CXX executable ../bin/09-teapot
[ 37%] Built target 09-teapot
[ 38%] Linking CXX executable ../bin/10-viewport-array
[ 38%] Built target 10-viewport-array
[ 39%] Linking CXX executable ../bin/03-instancing
[ 39%] Built target 03-instancing
[ 39%] Linking CXX executable ../bin/01-triangles
[ 40%] Built target 01-triangles
[ 41%] Linking CXX executable ../bin/03-drawcommands
[ 42%] Built target 03-drawcommands
[ 43%] Linking CXX executable ../bin/01-keypress
[ 43%] Built target 01-keypress
[ 44%] Linking CXX executable ../bin/12-imageprocessing
[ 45%] Built target 12-imageprocessing
[ 45%] Linking CXX executable ../bin/06-mipfilters
[ 46%] Built target 06-mipfilters
[ 46%] Linking CXX executable ../bin/06-texturewrapping
[ 47%] Built target 06-texturewrapping
[ 48%] Linking CXX executable ../bin/10-fur
[ 49%] Built target 10-fur
[ 49%] Linking CXX executable ../bin/06-cubemap
[ 50%] Built target 06-cubemap
[ 50%] Linking CXX executable ../bin/03-instancing2
[ 51%] Built target 03-instancing2
[ 52%] Linking CXX executable ../bin/06-multitexture
[ 53%] Built target 06-multitexture
[ 54%] Linking CXX executable ../bin/06-volumetexturing
[ 55%] Built target 06-volumetexturing
[ 56%] Linking CXX executable ../bin/11-oit
[ 57%] Built target 11-oit
[ 57%] Linking CXX executable ../bin/09-simpletess
[ 58%] Built target 09-simpletess
[ 58%] Linking CXX executable ../bin/10-draw-xfb
[ 59%] Built target 10-draw-xfb
[ 60%] Linking CXX executable ../bin/11-overdrawcount
[ 60%] Built target 11-overdrawcount
[ 61%] Linking C executable ../../../../bin/wave
[ 61%] Built target wave
[ 62%] Linking C executable ../../../../bin/splitview
[ 63%] Built target splitview
[ 63%] Linking C executable ../../../../bin/simple
[ 64%] Built target simple
[ 64%] Linking C executable ../../../../bin/particles
[ 67%] Built target particles
[ 68%] Linking C executable ../../../../bin/heightmap
[ 69%] Built target heightmap
[ 70%] Linking C executable ../../../../bin/gears
[ 70%] Built target gears
[ 71%] Linking C executable ../../../../bin/boing
[ 71%] Built target boing
[ 72%] Linking C executable ../../../../bin/windows
[ 73%] Built target windows
[ 73%] Linking C executable ../../../../bin/title
[ 74%] Built target title
[ 75%] Linking C executable ../../../../bin/clipboard
[ 76%] Built target clipboard
[ 76%] Linking C executable ../../../../bin/msaa
[ 78%] Built target msaa
[ 79%] Linking C executable ../../../../bin/glfwinfo
[ 80%] Built target glfwinfo
[ 81%] Linking C executable ../../../../bin/iconify
[ 82%] Built target iconify
[ 83%] Linking C executable ../../../../bin/reopen
[ 84%] Built target reopen
[ 85%] Linking C executable ../../../../bin/events
[ 86%] Built target events
[ 86%] Linking C executable ../../../../bin/joysticks
[ 87%] Built target joysticks
[ 88%] Linking C executable ../../../../bin/sharing
[ 88%] Built target sharing
[ 89%] Linking C executable ../../../../bin/gamma
[ 90%] Built target gamma
[ 90%] Linking C executable ../../../../bin/monitors
[ 92%] Built target monitors
[ 93%] Linking C executable ../../../../bin/threads
[ 94%] Built target threads
[ 94%] Linking C executable ../../../../bin/cursor
[ 95%] Built target cursor
[ 96%] Linking C executable ../../../../bin/empty
[ 98%] Built target empty
[ 99%] Linking C executable ../../../../bin/tearing
[100%] Built target tearing

  终于成功了,原来我一直都在原地打转。可以看到,可执行文件在../bin中

5、运行

  cd ../bin

  ./gears

  

  

参考文献:https://blog.csdn.net/u012939880/article/details/97545766?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-1.control

人就像是被蒙着眼推磨的驴子,生活就像一条鞭子;当鞭子抽到你背上时,你就只能一直往前走,虽然连你也不知道要走到什么时候为止,便一直这么坚持着。
原文地址:https://www.cnblogs.com/guochaoxxl/p/14303641.html