Your search query "linkto%3A%22PyOpenGL%22" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message


PyOpenGL is a large Python package that wraps most (up to version 1.2) of the OpenGL API. However, it doesn't try to clean up the API and present a more Pythonic interface, so it won't save you (or, more importantly, me) from having to learn the details of OpenGL. It does abstract the API so you call glColor in place of glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, ...

Here's the skeleton for a program that displays something::

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

# The display() method does all the work; it has to call the appropriate
# OpenGL functions to actually display something.
def display():
    # Clear the color and depth buffers

    # ... render stuff in here ...
    # It will go to an off-screen frame buffer.

    # Copy the off-screen buffer to the screen.


# Create a double-buffer RGBA window.   (Single-buffering is possible.
# So is creating an index-mode window.)

# Create a window, setting its title

# Set the display callback.  You can set other callbacks for keyboard and
# mouse events.

# Run the GLUT main loop until the user closes the window.

Unable to edit the page? See the FrontPage for instructions.