Sunday 27 April 2014

Getting back into playing with OpenGL

The single most influential thing that got me into programming where games..

My father worked in IT and we had computers at home since before I was born which may not seem special today, but in the late 70ies, in the Netherlands, people owning their own Personal Computer was rare, very rare indeed.

My first memories are playing simple text based computer games on a TRS-80 or somewhat better looking games on an Atari 2600. While I started learning to program in Basic on the TRS-80 at a very young age it wasn't until my father bought an intel 286 based PC with a EGA graphics card that I started getting really interested in graphics programming. Initially still sparked by a wish to learn how to write games but by the later 80ies I would be introduced to the so called Demo Scene and get hooked purely on doing graphics programming for the sake of making cool effects onscreen.

Eventually I would get a job doing "normal" programming (which in an entirely different way is exciting and rewarding in its own right) and doing graphics programming was put onto the back burner. Occasionally I would play around again, learn some of the newer technologies and forget about it for awhile again. Some of my friends did move into writing games and I've stayed in touch which is great as they do not mind letting me know a bit on what goes on under the hood of modern graphics programming.

My interest has recently been sparked again, purely as a hobby mind you, mostly with the popularity of the new Oculus Rift and my age old love of VR. Combine that with having bought a TV that allows stereoscopic viewer and a Retina Macbook that has an HDMI port and voile, the game is set.

So I've dived back into OpenGL. Why OpenGL and not Direct X (which seems the better choice if I ever actually get my hands on a Rift)? Well simply put, I have a Macbook pro and OpenGL is natively supported and the graphics card in my little Macbook is beefy enough for what I do.
I have since read that while OpenGL is well supported on the Linux platform, Microsoft seems to not give it any love because it competes with Direct X and as there is a large game market using that API it always seems to run a generation in front of OpenGL. Alas.

It isn't a big problem as long as this stays a hobby, if something comes out of this in years in the future, well we'll deal with it then:)

The last time I played with OpenGL was, uhm, 10 years or so ago? Yeah probably about that if I don't count my stint with WebGL a few years back, so I decided to start from scratch. Learned a few new things about vertex buffer attributes and brushed up on my GLSL skills and I have my starting point.

I've got a landscape thingy that I'm still working on, but I've put that on ice for a little while. The thing that has driven my wife nuts for the last few days as I've spend hours deep into the night while everyone is asleep was getting a simple wavefront object loader up and running and doing a simple texture mapped shader on which I can start building some cooler things.

I pulled out a trusty old model from one of my favourite games Homeworld to test things with. Here is a nice little screenshot :)

And for those that are able to view things in stereo, a nice little splitscreen screenshot:


This is a good article (imho) on which I based most of the stereo scopic code: Stereo geometry in OpenGL