Dave Touretzky edited this page Mar 7, 2018 · 6 revisions

There are many graphics packages offered for Python. Many of these are broken or don't work in Python 3.5. OpenGL does work, and provides full 3D graphics capabilities.

Installing Python OpenGL on Linux

You can install OpenGL and the Python bindings for it with just two shell commands:

 $ apt-get install freeglut3
 $ pip3 install PyOpenGL PyOpenGL_accelerate

Your Python program should contain these lines:

    from OpenGL.GLUT import *
    from OpenGL.GL import *
    from OpenGL.GLU import *

Installing Python OpenGL on Windows

You need two packages: PyOpenGL and PyOpenGL_accelerate. The windows versions on PyPI aren't good (as of March 2018). Instead, get the whl files from here:


Make sure to get the right size (64 bits) and version that matches your Python version. These wheels include the freeglut DLL file, so you don't need to install it separately.

If you're writing your own OpenGL code, not just running someone else's, note that on Windows PyOpenGL doesn't want Python string arguments 'foo', it wants bytes, which can be obtained from b'foo' or bytes('foo','utf-8').

OpenGL Tutorials

  • OpenGL Programming book
    • A readable, fairly comprehensive introduction to OpenGL.
  • OpenGL tutorial
    • The pulldown menus along the top of the page offer a variety of tutorials demonstrating how to accomplish basic or intermediate effects, from opening a window to texture mapping and 3D rotations.
  • OpenGL Programming Guide
    • Known informally as "the red book", this guide to OpenGL version 1.1 is still a good introduction to modern OpenGL.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.