问题描述
下面描述的是一个三维立方体的蹩脚的Photoshop模型。
以下是我的参数:解决方案必须...
- ...使用Windows仿真器如wine
- 编译并运行在我的小巧但忠实的Macbook Air 上 ...在运行时产生一个看起来与上述模型相当接近的窗口
- ...仅使用免费工具(speech中的free和啤酒)
- ...使用C(而不是C ++或C#)
- ...能够渲染从在编译时,可能带有预处理器宏
- ...使用GPU
We!!
潜在资源:
解决方案NeHe教程已过时,并且无法编译,所以我写了用我的问题回答我自己的问题,它遵循我的问题的所有参数。
它可以在OS X 10.9.2上编译像这样:
$ gcc -Wall -framework OpenGL -framework GLUT -o my3dcube my3dcube.c
它很大程度上取决于中的代码, NeHe教程链接到Mark Stevens的答案中。
Depicted below is a crappy Photoshop mockup of a three-dimensional cube.
Here are my parameters: The solution must...
- ... compile and run on my dinky but faithful Macbook Air without using Windows emulators like wine
- ... produce a window that looks reasonably close to the above mockup when run
- ... use only free tools ("free" as in "speech" and "beer")
- ... use C (not C++ or C#)
- ... be capable of rendering the cube viewed from different angles defined at compile-time, perhaps with preprocessor macros
- ... make use of the GPU
Weee!
Potential resources:
- http://www.gamedev.net/topic/579689-sdl--opengl-rendering-a-cube/
- http://www.evl.uic.edu/arao/cs594/sdlglsl.html
解决方案The NeHe tutorials are outdated and do not compile, so I wrote this gist to answer my own question with a working snippet that obeys all the parameters of my question.
It can be compiled on OS X 10.9.2 like so:
$ gcc -Wall -framework OpenGL -framework GLUT -o my3dcube my3dcube.c
It is adapted heavily from the code in this gist and the NeHe tutorials linked to in Mark Stevens' answer.
这篇关于使用单个光源渲染3D立方体的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!