Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is PyOpenGL a good place to start learning opengl programming?

I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble?

I know C++ gives better performance, but for just learning can I go wrong with PyOpenGL?

like image 701
Isaiah Avatar asked Jun 03 '10 00:06

Isaiah


People also ask

Is OpenGL hard to learn?

OpenGL isn't any harder to learn than any other API. The hardest part for newbies seems to be understanding rotations and the projection and modelview matrices in general.

Is PyOpenGL worth learning?

With the caveat that I have done very little OpenGL programming myself, I believe that for the purposes of learning, PyOpenGL is a good choice. The main reason is that PyOpenGL, like most other OpenGL wrappers, is just that: a thin wrapper around the OpenGL API.

Can OpenGL be used with Python?

First off, PyOpenGL is just some Python bindings (some Python code that acts like a sort of wrapper around native code), so you can manipulate OpenGL within the context of Python. OpenGL is a cross-language API, so you can take your knowledge of OpenGL to other languages.

Does pygame use OpenGL?

Pygame doesn't even have OpenGL bindings; you'd need to use PyOpenGL with it. If your goal is to learn OpenGL, my suggestion would be to use PyOpenGL, with Pygame. The API is closer to actual OpenGL.


1 Answers

With the caveat that I have done very little OpenGL programming myself, I believe that for the purposes of learning, PyOpenGL is a good choice. The main reason is that PyOpenGL, like most other OpenGL wrappers, is just that: a thin wrapper around the OpenGL API.

One large benefit of PyOpenGL is that while in C you have to worry about calling the proper glVertex3{dfiX} command, Python allows you to just write glVertex3(x,y,z) without worrying about telling Python what type of argument you passed in. That might not sound like a big deal, but it's often much simpler to use Python's duck-typing instead of being overly concerned with static typing.

The OpenGL methods are almost completely all wrapped into Python methods, so while you'll be writing in Python, the algorithms and method calls you'll use are identical to writing OpenGL in any other language. But since you're writing in Python, you'll have many fewer opportunities to make "silly" mistakes with proper pointer usage, memory management, etc. that would just eat up your time if you were to study the API in C or C++, for instance.

like image 189
Mark Rushakoff Avatar answered Oct 05 '22 00:10

Mark Rushakoff