My progress #1.

I’m hoping to post 2 blogs a week, one every Monday, regarding my personal progress with my own research and learning progression, and one on Thursday, with some kind of tutorial, tip, rant, etc… about something that is interesting to me.  I may not completely stick to that format, it depends on how much progress I make, and how much I have to say, but that’s the plan as of now.  And with that

My progress #1.

Let’s make a window!

My fiance’ says that I’m an extreme person.  When I go on a “diet” it means I don’t eat and run until my legs fall off.  Inversely, when I order a pizza, I must get the 48″ one with triple of every topping.  Ok, maybe I am a bit extreme.  So when I decided to start working with native C++ code, I wanted to learn EVERYTHING.  Start out with a window that the project makes for you, and it’s nice little toolbar?  Fuck that shit.  If I didn’t explicitly know how it got there, I didn’t want it.  And so I started out with a console window.  Just a little black box with some white text.  If the text had been green I could have written it on an Apple IIe.  I have a lot of prior .net programming knowledge, so I was familiar with typical programming structures, it’s just that C++ was completely foreign to me.

You know, I have to say, .net is a far better platform than I think a lot of snob programmers give it credit for.  Even now, with a hefty amount of C++ under my belt, I still turn to C# if I need to write some little business app to modify a bunch of Excel files or something.  For RAD it’s still a really nice tool to have a good handle on.  But I digress.

So with no C++ skill to speak of, and a background in languages that were way more easy to read, writing C++ felt like jumping into the deep end, only the deep end is filled with sharks and I’m covered in chum.  Shit, I didn’t even really know what a pointer was, the closest I’d ever come to really understanding that concept was the byref keyword in .net.  It was clear to me that at first, even making a window was going to be a challenge.  There were tutorials to do this, but the code was at least 100 lines long, and it was filled with asterisks an strange keywords and hashtags.  I couldn’t figure out why these people were tweeting their code.

I followed the tutorials, line by line, word by word, and I analyzed them.  If, in my analysis, I found something new I didn’t understand, I researched that.  I tumbled down as many recursive rabbit holes as it took.  When I popped back out, I went on to the next line.  Within a few days I knew what #includes were, what #defines were, what unsigned meant.  I took hours and poured over explanations of pointers, this one was especially helpful.  Go read it like 8 times, at least.

Before I knew it, I had worked through the tutorial on opening a window.  I ran my code for about the 4,632nd time, and up popped a window, with a white background and absolutely nothing else in it.  It was fucking glorious.  I can only equate it to what giving birth feels like for a woman.  That moment when you first hold your baby, and you know, you made this.  It was exactly like that.  Exactly.

Opengl.

Once I made a window the obvious next step was to just make a full blown game.  If you read all the tutorials that’s what it says.  “Once you make a window, just add the game() function, and you’re good to go.”  With my recent triumph in the realm of blank window making, I decided to see what all I could accomplish as far as getting opengl to work.  As it turns out, opengl is not all that tough.  Don’t get me wrong, it’s still a low level graphics library, you still need to know your shit in order to use it for anything worthwhile, but in terms of getting the library, using it, and getting it to do something, it’s not all that tough.  Plus there are a lot of great resources out there, like these excellent tutorials.  Within about a week of futzing around, I had a window that actually displayed a an infinitely changing background color.  Still not much, but it was progress.

Once I had clearly mastered opengl, I decided that it was time to start bending it to my will.  I followed some more tutorials, and struggled for a few more days, and made me a big ole fat triangle.  The shit had 3 sides and everything.  I was even able to write a little shader program that changed the triangle’s color.

A good start.

So, after this first week, I feel like I’ve made some progress.  I’m not lighting the world on fire or anything, but it’s something right?  It’s forward movement, which is all I can hope for.  By the end of next week I hope to have something a bit more solid.

Leave a comment