Making objects with PyOpenGL

OpenGL is primarily known for drawing different geometrical shapes or primitives, all of which can be used in the creation of scenes for a 3D canvas. We can make multiple-sided shapes (polygons), such as a triangle, quadrilateral, or hexagon. Several pieces of information, such as vertex and edges, should be given to the primitives so that PyOpenGL can render them accordingly. Since the information that's related to the vertex and edges is different for each shape, we have different functions to create different primitives. This is different compared to pygame's 2D function (pygame.draw), which was used to create multiple shapes using the same single function. For example, a triangle has three vertices and three ...

Get Learning Python by Building Games now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.