How can I improve the performance of my custom OpenGL ES 2.0 depth texture generation?

Based on the recommendations by Tommy, Pivot, and rotoglup, I’ve implemented some optimizations which have led to a doubling of the rendering speed for the both the depth texture generation and the overall rendering pipeline in the application. First, I re-enabled the precalculated sphere depth and lighting texture that I’d used before with little effect, … Read more

GLUT on OS X with OpenGL 3.2 Core Profile

You need at least Mac OS X Lion (OS X 10.7 or higher) for the basic support of OpenGL 3.2. To use the OpenGL 3.2 Core Profile, just add glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | … | …); in your main-function. You can check it by std::printf(“%s\n%s\n”, glGetString(GL_RENDERER), // e.g. Intel HD Graphics 3000 OpenGL Engine glGetString(GL_VERSION) // e.g. … Read more

Drawing a border on a 2d polygon with a fragment shader

All you need are the barycentric coordinates, since you are dealing with triangles. Assign each vertex of the triangle an identity, and then use the hardware’s built-in interpolation between the vertex and fragment stages to figure out the relative distance from each of the vertices in your fragment shader. You can think of the barycentric … Read more