Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


Python OpenGL Graphics Framework

Subscribe to updates I use pg

Statistics on pg

Number of watchers on Github 146
Number of open issues 7
Average time to close an issue about 18 hours
Main language Python
Open pull requests 1+
Closed pull requests 1+
Last commit about 6 years ago
Repo Created over 6 years ago
Repo Last Updated over 2 years ago
Size 4.96 MB
Homepage http://pg.readthe...
Organization / Authorfogleman
Page Updated
Do you use pg? Leave a review!
View open issues (7)
View pg activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating pg for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

pg: The Python Graphics Framework

pg is a lightweight, high-level OpenGL graphics framework for Python. It is a work in progress.


A basic tutorial is available here:



Many OpenGL applications have a lot of features in common, but there's a lot of boilerplate involved when using OpenGL. This high-level framework lets you focus on your application-specific functionality instead.

  • shaders
    • compile and link
    • attributes and uniforms
    • built-in shaders for common use-cases
  • vertex buffers
    • optionally interleaved
  • matrices
    • translate, rotate, scale
    • perspective and orthographic projections
    • transpose, determinant, inverse
  • textures
  • geometric shapes
    • sphere, cuboid, plane, cylinder, cone, axes
  • models
    • .obj and .stl file formats
  • WASD movement
    • built-in!
  • windowing and input
    • glfw-based
    • multiple windows


brew tap homebrew/versions
brew install glfw3
pip install Pillow PyOpenGL


Clone the repository and run main.py to see these and several other examples.

3D Pipes: pipes.py


Gusev Crater: gusev.py


OBJ and STL Models: suzanne.py


Constructive Solid Geometry (CSG): csg.py


pg open issues Ask a question     (View All Issues)
  • over 5 years Example for using with pyopengl or pyglet
  • over 5 years sprites example looks for sprites in /users/fogleman/Desktop/Sprites
  • over 5 years examples/gusev list index out of bounds
  • over 5 years font example can't find font on Linux
  • over 5 years Click in 'cuboids example'
  • over 5 years 64 bit ubuntu - glfw.so not found
pg open pull requests (View All Pulls)
  • Update glfw.py
pg questions on Stackoverflow (View All Questions)
  • In Rails, Ransack search gives the error `PG::UndefinedFunction: ERROR: operator does not exist` when trying to filter by ID
  • How do you connect to a Postgres Database with no password using pg-promise?
  • knex.js + pg specify varchar to be > 255
  • What is the difference between `PG.connect` and `PG::Connection.open` in the Ruby 'pg' gem?
  • pg-promise create custom filters for select query
  • rake aborted! PG::ConnectionBad: Error on Cloud9 when trying to run rake routes
  • Rails PG Unix domain socket "/tmp/.s.PGSQL.5432"? issue
  • How to get results from multiple queries at once with pg-promise?
  • Getting PG::UndefinedFunction: ERROR: operator does not exist: integer ~~* integer
  • rake aborted! PG::ConnectionBad: could not connect to server: Connection refused
  • Can't find the 'libpq-fe.h header when trying to install pg gem
  • TypeError: Object <Object> has no method 'query' with node pg library
  • An error occurred while installing pg (0.17.1), and Bundler cannot continue
  • PG::AdminShutdown: FATAL: terminating connection due to administrator command
  • Code from Deitel c# not working edition 12. Chapter 7 pg 254
  • Same DB, same PG version, different execution plans: what could be the reason?
  • PG::ConnectionBad: FATAL on RDS
  • Installing pg on Windows 12 with PostgreSQL and nodejs
  • PG undefinedtable error relation users does not exist
  • PG::CONNECTION BAD connecting to pgAdminIII cloud 9 IDE
  • PG::UndefinedFunction: ERROR: operator does not exist: - character varying
  • PG::UndefinedColumn: ERROR: column "title" does not exist
  • Heroku: PG::UnableToSend: SSL error: sslv3 alert bad record mac
  • ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: in rails query
  • Dokku error /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory
  • How to retrieve the searched result with Pg gem multisearch
  • Cannot install pg gem in Mavericks with Postgres.app
  • PG::ConnectionBad (rails, solidus, ubuntu 15) Solved
  • PG::UndefinedTable: ERROR: relation "musicians" does not exist
  • Pg search gem doesn't work on Heroku
pg list of languages used
Other projects in Python
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark