Tuesday, September 27, 2011

on BuffersObjects and hair pulling

So, tonight, I finally got the port of the second lesson to work. This was a tricky one. It has been a few days and I was getting some weirdly funny stuff going on in the last couple of days, that really brought to me the fact that I'm working with code wrapping around C native calls, and that OpenGL does NOT mess around!

Lesson 2 is about using VertexBufferObjects (or VBOs) to store the vertex information (position, colour, normal, etc etc) and then drawing the scene using those buffers. By moving the data to the VBOs, they are probably (depending on GFx driver) moved to the graphics card RAM, and hence, offer quite the speedup in terms or drawing. Also, as far as I can tell by looking at future parts of the tutorial, they would make life easier when importing in models generated from 3D modeling software, like Blender, which I think is inevitable if you ever need your game to include something other than triangles, cubes, teapots and chimps!

Getting the code to work however, was not really an easy thing. I am so far into the code right now, that when something goes wrong, I start to freak out and blame myself first. So I kept thinking it was probably the shaders from Lesson 1, or I had done something wrongly, but I guess it was just a case of too little sleep

Fast forward to tonight, when I've had a little bit better sleep than yesterday and a lot more time to pull my hair, and I've finally gotten the code to work. I also made sure I refactored it, and played around with it a little while, to make sure I got more confidence around it. I can now finally say, I know how to use VBOs coupled with shaders to get what I want onto the screen, at least, as far as what I want is a 2D polygon

Stay tuned till the next time when we tackle passing information to shaders whether varied or constant, which should demo how we can add custom colours and fog. Till then

Sunday, September 25, 2011

on Finishing up & exercises

So, I finally got down to completing just the last bits of the first tutorial (I am going at a very slow pace at the moment, but things should pick up a little once I have a little more idea what's going on). I covered all the tutorial work and even changed the code a couple times to match the tutorial exactly in terms of colours & vertex positions

As for the code itself, as I mentioned in my earlier post, I had lost it all to a stupid mistake because I was basically up coding till around 6AM, which is never a good time to use any FORCE flags, specially when coupling it with a git remove!

Anyhow, I think this git mishap might have actually been a good thing, because second time around, I completely wrote down the code from my understanding of it, and I managed to do it this time in a much cleaner and refactored way; which really paid off while doing the exercises, since other code parts could easily be plugged in. Also, what I'm really getting out of this is proficiency with git, whose workflow I'm really begining to like

In other news, I have signed up with a Reddit class about Game Programming which seems to be quite promising, and I think will be a great addition to keep me going forward. It should last 20 weeks, but seriously covers all the areas I've always wanted to read about

I am also trying to get more into the smaller details about Cubic Wars, so that when I know what I need to know, I will know what I want to do with it

Stay tuned... next couple of weeks will probably be interesting for anyone who wants to watch as one employed programmer strives to go indie and live his dream :)

Friday, September 23, 2011

on Basics, Setup & building a wireframe

Finally some time to get some work done, starting with the port of Lesson 1, and I am super happy to have finally some good quality code that I have pushed to the git repo

I had already downloaded & setup LWJGL to be used with eclipse (forever my IDE of choice) through the guides at their wiki (which is quite excellent, I have to say). The process was flawless and quite seemless really, which took about 20 minutes, all in all

Next up, I headed to the OpenGL Modern Programming wikibook, and fired up the first lesson. At first glance, I could quite easily figure out that it was all about the "programmable graphics pipeline (PGP)" which I always kept hearing about, but had absolutely no idea what it was, so this seemed quite a good start. However, reading into 2-3 paragraphs I realised that the PGP was all about shaders, written through the GLSL. More stuff that I've always heard about, but never quite understood, GREAT!

After reading through, I realised that most of the code was just foundation and wireframes to setup the window & initialise OpenGL inside it, then it was all about loading the shaders and using them to draw & colour the scene; this meant I needed to figure out where shaders fit into the picture with LWJGL. Wiki to the rescue, I found out a great tutorial about getting GLSL shaders to work with LWJGL

I have read through said article and have completed building the wireframe, where the code currently does nothing in the render method but sit temptingly waiting to replace the // TODO line. Since I've had a quite long weekend, and since this is the last day of work today, I think I'll be done today thus far, and will continue off on Saturday (weekend in Egypt) and fire up the shaders

Till then

Tuesday, September 20, 2011

on Humble Beginnings

Alright, so I'm finally going to dive head into indie game development. I finally have a very simple idea that I want to work on, and that I think would be fun to play. I will mainly try to target Java game development, so that the transition to developing the games for the Android OS might be a bit easier in the future

To start, I will dive head first into learning OpenGL. I have very (almost no) experience on the topic of graphics programming, and will tackle this first, since this will be the most fun (I hope) to work on. I have found quite the excellent tutorial on the topic of Modern OpenGL (since most are either over complicated, or out-dated) in the form of a Wikibook.

Since I believe the best way to learn something is to try and do it yourself, I will try to port these to the LightWeight Java Gaming Library, and have created a github repo for the ported code and will keep it opensource of course, so that others may alter (read: fix) it or benefit from it

So, if you're interested in OpenGL / graphics programming, java, game development or following along as I try and build my first ever game from scratch (The world's most highly anticipated: Cubic Wars) then keep an eye on this blog as I will be updated it (hopefully) often

Till the next time