pyopengl: Could it replace c++?

Tom picture Tom · Mar 21, 2010 · Viewed 9.7k times · Source

I'm starting a computer graphics course, and I have to choose a language.

Choices are between C++ and Python. I have no problem with C++, python is a work in progress. So i was thinking to go down the python road, using pyopengl for graphics part.

I have heard though, that performance is an issue.

Is python / pyopengl mature enough to challenge C++ on performance?

I realize its a long shot, but I'd like to hear your thoughts, experiences on uses of pyopengl.

Answer

kibibu picture kibibu · Mar 22, 2010

It depends a LOT on the contents of your computer graphics course. If you are doing anything like the introductory course I've taught in the past, it's basically spinning cubes and spheres, some texture mapping and some vertex animation, and that's about it. In this case, Python would be perfectly adequate, assuming you can get around the Unpythonic (and, lets be honest, un-C++) OpenGL state-machine paradigm.

For things like doing your matrix maths you can use Numpy, the core of which is written in C and is really quite quick. You'll be up and running faster, iterate faster and most likely have more fun.

If, however, you are doing some hardcore, cutting edge, millions-of-triangles-per-scene-skinned-animated-everything computer graphics course, stick with C++.

If your class has given you the choice it's probably a safe bet that Python will be ok.

If you want to leverage your knowledge into a real job in computer graphics though, pretty much every game and graphics engine is written in C or C++, while Python (or Lua) is left as a scripting language.