Creating an OpenGL Context in SDL 2

June 18th, 2013

Filed under: OpenGL, SDL | 5 comments

SDL 2.0 has been released, which changes the way you create OpenGL contexts. This post details the changes so you can convert your old SDL/OpenGL code to SDL 2. If you are new to SDL and OpenGL, you should also read my SDL and OpenGL article, as that article covers some topics that aren’t covered […]


GL_QUADS Replacement

January 24th, 2013

Filed under: OpenGL | Be the first to comment!

When writing a 2D game in OpenGL, you generally draw texture-mapped quads. The most straightforward way to draw a texture-mapped quad with vertex arrays is to supply GL_QUADS as the first argument to glDrawArrays(). But GL_QUADS is not available on OpenGL ES so if you want to port your game to mobile devices you can’t […]


Creating a Custom Orthographic Projection With Pyglet

February 21st, 2012

Filed under: Game Development, OpenGL | Be the first to comment!

When you create a pyglet window, pyglet sets up an OpenGL orthographic projection for the window. The size of the projection matches the size of the window. If the window is 640 pixels wide and 480 pixels wide, the orthographic projection is 640 units wide and 480 units high. Pyglet’s default behavior works well in […]


Installing Pyglet on 64-bit Macs

January 16th, 2012

Filed under: Game Development, OpenGL | 4 comments

Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the pyglet site, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn’t work with 64-bit applications. Not working with 64-bit applications is a […]


OpenGL Driver Instrument

December 12th, 2011

Filed under: Instruments, OpenGL | Be the first to comment!

Researching Instruments for Xcode Tools Sensei allowed me to become familiar with most of the built-in instruments. Due to the high number of instruments, there was no way for me to cover them all in the book. I focused on the most commonly used instruments in the book. I can use this blog to explain […]


SDL OpenGL Typedef Redefinition Error on Mac OS X 10.7

November 7th, 2011

Filed under: Game Development, Mac Development, OpenGL, SDL | 3 comments

If you build a SDL OpenGL application for Mac OS X using SDL 1.2.14 (using the binary installer at the SDL site) and the Mac OS X 10.7 SDK, you can get the following error: typedef redefinition with different types (‘unsigned int’ vs ‘void *’) The SDL header file SDL_opengl.h and the OpenGL header file […]


OpenGL Profiler Workaround

January 10th, 2010

Filed under: Mac Development, OpenGL | Be the first to comment!

I ran into a problem with OpenGL Profiler 4.2 on Snow Leopard. I would profile an application and pause profiling so I could look at the OpenGL statistics. When I opened the statistics window, it was blank. The trace window was also blank, and I had selected the Collect Trace checkbox in OpenGL Profiler’s main […]