2011-07-10

A Simple PyOpenGL-3.0.1 Shader Demo

Alright. Here is that code that I mentioned in an earlier post. Know that you will need to install Python 2.6 and PyOpenGL-3.0.1 in order to run this code. It takes advantage of the new shader convenience module found in 3.0.1. This helped make switching shaders on the fly much easier to implement. Type "," or "." to page through shaders. "n" to toggle normals from "averaged" to "flat". When viewing "no shader" hit "1" or "2" to toggle light0 and light1 on/off respectively. Oh, and can't forget, "r" to start the spheres rotating. The sphere on the left is a glutSolidSphere, the one on the right is a sphere built from a .msh file that Mike wrote.

Look through the code! I hope it's helpful to someone, somewhere.

rendersphere.py
sphere1218.msh

PS. I may update this later and include more information on the dependencies and/or installing the correct versions of PyOpenGL... etc.

PyOpenGL-3.0.1 is only available as a tarball and/or .bz2 package. So... check
out my later post http://ultraopengl.blogspot.com/2011/07/installing-pyopengl-301.html for info on installing it.

No comments:

Post a Comment

Let me know what you think!