2

python编程(编写opengl程序)

 3 years ago
source link: https://blog.csdn.net/feixiaoxing/article/details/114543389
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

python编程(编写opengl程序)

费晓行 2021-03-08 18:52:03 65

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

    opengl作为跨平台的代表,本身使用很多。记得云风,也就是之前网易的主程,他写过一个ejoy2d的游戏引擎,本身使用的就是opengl。因为不管是windows、linux,还是macos,本身都支持opengl接口,所以使用opengl还是非常方便的。传统的opengl只需要包括gl函数、glu函数、glut函数,就可以做很多的事情,使用起来还是非常方便的。

    本身opengl支持很多语言的开发,当然最简洁的还是python开发。本次开发是基于python 2.7的版本,本身并不能通过pip install PyOpenGL直接安装,需要通过到第三方url下载安装完成。整个的流程是这样的,

1、下载pyopengl安装包

https://pypi.python.org/pypi/PyOpenGL/3.0.2

2、安装exe文件,注意只安装到2.7的环境当中

文件名是PyOpenGL-3.0.2.win32.exe

3、安装完成后,还要添加glut32.dll库

下载地址为

http://user.xmission.com/~nate/glut/glut-3.7.6-bin.zip

4、将下载好的glut32.dll拷贝到

C:\Windows\SysWOW64

5、用一个pyopengl的代码示例查看下

比如,这里就有很多

https://blog.csdn.net/u013232740/article/details/47355927

或者直接用一个旋转的茶壶验证下

6、用pycharm输入,查看是否可以正确运行,如果没有问题,效果应该是这样的


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK