Port over more GL code from Python.