Using Vertex and Index Buffers with PyOpenGL: Part 1

Over the past several days, I have been upgrading an application I wrote (because of performance issues) using PyOpenGL from a fixed-function pipeline to a more modern architecture using vertex / index buffers, and GLSL shaders.  I had been using the (now deprecated) immediate mode because it’s really easy to get things up and running.  But performance issues warranted me to bite the bullet and make the switch.  Abandoning a fixed-function pipeline for a more modern architecture using shaders requires a lot of ground work, but it is worth the effort.

Interleaved Buffers

There are multiple ways you can define how the data in your vertex and index buffers are stored.  I decided to interleave my data so that I would only have one vertex and index buffer per mesh.  For the vertex buffer, this means that for every vertex, I lay out the position, normal, texture coordinates and any other data I want for each vertex contiguously.  For example:

Continue reading

Discussion 1 Comment Category Python, Uncategorized

Site Re-Design

The site is currently going through a re-design.

Discussion Leave a comment Category Uncategorized