Thursday, March 26, 2009

Back to the Drawing Board?

Howdy folks, and welcome to another installment of theraje's Game Development.

I found out yesterday that the Khronos Group consortium - the people behind OpenGL - have released the OpenGL 3.1 specification. Of course, this release brings about some major changes to streamline the API, but it also means a lot of old throwbacks have been deprecated.

Naturally, a lot of those "old throwbacks" are things that I've incorporated into Dungeon 3D. Nowadays, you're expected to use shaders - small "programs" that alter the way your graphics card processes things like vertex and fragment data - rather than using the less flexible, but more straightforward, fixed-function pipeline. Before learning about the deprecations in the latest OpenGL spec, I never found any reason to use shaders. Now it seems that if I want my game to be compatible with graphics cards that will be available in the near future, I will have to use them.

So, I had a look in one of my books to find out what shaders are and how to use them. It seemed to only multiply the questions I had. Then I had a look at an online tutorial. That didn't help things much, either. It looks like learning how these shader things work will take a big chunk of my time. Then there is the matter of plugging everything into my project.

A battle is now raging in my mind - do I spend an indefinite amount of time trying to learn about and implement shaders into my game, or do I just finish the game as it is and hope that backwards compatibility saves me?

Of course, simply debating the topic is robbing me of precious productivity. It seems like a lose-lose in my case.

1 comment:

  1. I would think that they are not just going to through backwards capability out the window; then again I'm not familiar with OpenGL's past.

    I haven't touched OpenGL or it's shader language, but I do have a little knowledge with the shaders in DirectX (A LITTLE!).
    As you said your currently using a fixed pipe function, and I didn't see a mention of using a pixel shader; so really you could just create a basic vertex and pixel shader.

    The vertex shader will transform the 3D vertexes against the world matrix, the view matrix, then the projection matrix; this would calculate a vertex to screen coordinates. As for pixel shader, it would multiply the sampler/texture color with the vertex color (I'm guessing that's how you are creating the lighting, by setting each vertex color variance [by distance of light and light color]) returning the result.

    ReplyDelete