One interface to implement them all…

Last week I mentioned I was planning to develop a new rendering pipeline based on shaders. Let me give you some more details about it.

I’m currently working on four different implementations for OpenGL-based renderers. Two of them are targeted to platforms that support either OpenGL 2 or 3 (i.e. Mac or PC) while the other two are based on OpenGL ES 1 and 2 and are specifically designed for iOS devices (iPhone, iPod Touch and iPad).

The OpenGL 2.1 Renderer implementation is the default one for PC and Mac. It has been constantly updated during the last couple of years and I recently added support for shader programs using GLSL, but for the moment there is no plan on supporting multi-pass effects like rendering to textures, bloom or shadows.

Here are a couple of screenshots. They where rendered using a shader program implementing specular lighting.

(Disclaimer: The ED-209 model has been downloaded from TurboSquid. My Blender skills are not that good yet).

Concerning the OpenGL 3 implementation, there’s still a lot of work to do. Unfortunately, the main issue I’m facing at this point is that I’m using a Macbook Pro as my default development environment and I don’t have the appropriated hardware that can handle the newest additions to OpenGL 3.

Now let me talk a bit about the iPhone renderers. As I said before, I’m working on two implementations, both of them are being rewritten from scratch.

One renderer is based on OpenGL ES 1.x, suitable for first and second generations iPhones and iPod Touches. This renderer is pretty similar to the OpenGL 2.1 implementation, except that it doesn’t support shaders, of course. Still, I managed to add support for dynamic lighting using the fixed-function pipeline. The result can be seen in the following images:

The OpenGL ES 2.x based renderer is completely shader based, at the point of not using the fixed-pipeline at all. Alas, at the time of this writing I haven’t finished the lighting support, but I will publish some screenshots during next week.

My closing comments have to do with the tile. All four renderers are implemented from the same Renderer interface (part of Crimild.Core library), meaning that they are able to support whatever feature is available on the target platform without causing any impact on the rest of the engine features.

As an example, I deliberated used the same model for all the screenshots in this post. Depending on what renderer implementation is being used, the model may be renderer with or without colors (the model is using render states to simulate materials). The same is true for shaders (although it cannot be appreciated in the pictures). If the renderer does not support them (as in the case of the OpenGL ES 1.x implementation), they are completely ignored but the scene is still drawn.

Advertisements