Registering for an Apple Developer ID.

20. February 2014

This is one of those things I’ve put off forever but I am finally getting to the point I have to do it.  It’s time to sign up for an iOS developer license.  Without one ( and paying 99$ a year ) you cannot deploy your code to Apple devices.  The Simulator gets you most of the way there but eventually you need to run on an actual device.


I am going to document the process in case it’s helpful for anyone in the future.  If this ends up being obscenely straight forward, I apologize for the dull as toast post. :)


Head to

Click Member Center




Either log in or register.  Registration is free at this point.



Click on Programs & Add-ons




Locate iOS Developer Program and select Join Today



In an exercise in redundant redundancy, now click Enroll Now.



Just in case you haven’t gotten sick of superfluous button clicking, now click Continue.



… ok, this is nowhere near as streamlined as it should be.  Anyways pick if you want to use an existing developer id, or create a new one, even though I imagine 99.99% of people will use existing.




Are you a business or individual?  Individual makes things a heck of a lot easier… you simply need a credit card.  Fill in the credit card details and click continue.



Are you feeling deja-vu?  I certainly am.  Anyway, select iOS Developer Program, then Continue.



Review the details you’ve given and select Continue.



Select Buy Now:





… and, log in again.  Yeah really.  Isn’t Apple the one thats supposed to be all about usability???  Granted, you are logging in to the App Store, so perhaps its a different account for you.



… and now, you need to enter your billing information… AGAIN.  This time with credit card details.  This is getting kind of stupid, as there was a completely redundant few steps earlier it appears.  Once you’ve confirmed or entered your payment details, it’s time to pay the piper.



The department of redundancy comes knocking again.  Apple seriously, don’t see a few opportunities for optimization in this process here?  None at all.



… and assuming your credit is ok...




… now what?

Now you wait apparently.  Unbelievably, this isn’t a completely automated process.  You simply get an email saying your order is being processed.  That’s rather anti-climactic, especially for the “I WANT IT NOW” crowd.


So, about 45 minutes, the following email arrives:



… that said, don’t expect things to be all good just yet.  Log in to Member Center go to Programs and Add-ons and...




Sigh, not quite there yet.  Lame.  A few hours later, still nothing.  I’ll edit in once it is actually ready to go.


EDIT: 4 hours after application the account is now active.  Now if you log in to, you will see an option for certificates.



You need a certificate to run on device.  The easiest way to request a certificate is directly in Xcode, but you can manually request a certificate here as well.

XNA installer released. Easily install XNA on Visual Studio 2012/2013

20. February 2014

We all know XNA is pretty much dead but it is far from useless.  One of the big problems with XNA was it was heavily tied to XNA Studio or Visual Studio 2010.  Now, a few years on and two releases of Visual Studio later, keeping a version of VS2K10 around just for XNA is getting kind of annoying for many.  There is a manual process for installing all the various required components, but as will all “manual processes”, that requires work… who likes doing work?


Fortunately though, for those of us that are labour adverse but want to use XNA in a more modern IDE, there is now a solution.  The XNA Enabler.



I’ve been able to apply these steps to several machines successfully, but manually copying files and running obscure commands gets old after a while.  Taking what I’ve learned from these articles, I wrote a quick utility app that performs the necessary steps to get XNA running with the click of a button.

XNA Enabler

The app scans the registry at start up, looking for any required software.  Specifically, it looks for Visual Studio 2010, 2012, 2013 and the XNA Framework, XNA Game Studio and XNA 4.0 Refresh.  If all XNA components, Visual Studio 2010 and at least one newer version of Visual Studio are found, you can click the “Enable XNA” button to simply copy the files around on your machine.  If XNA and/or Visual Studio 2010 are not present, the “Copy XNA” button unpacks the required XNA files (about 50 megs worth) onto your drive and puts them in the right places.  It also runs several individual XNA installers (framework redistributable, shared components and platform tools).  Either operation will then reset your Visual Studio extension cache and force a rebuild using the “devenv.exe /setup” command line option.


Very cool stuff! There is one very important comment from the post that I should draw special attention to.

 It also requires UAC privileges because the “devenv.exe /setup” command fails otherwise.

You can download the complete package here.  Warning, it’s 52MB in size as it contains the required XNA files.

Ok now, what the hell is going on here. Blender and bones are going to be the death of me

18. February 2014

So i’ve posted a lot lately about my recent experiences with working with bones exported from Blender to LibGDX.  I encountered two problems, first only the base of the bone was available once exported.  Second, bones that were external to the mesh weren’t being updated.  The first isn’t really a big deal, except the solution to it seemingly is impacted by the second problem.  There was a thread over on LibGDX forums I posted my experiences on, and Xoppa, the guy behind the 3D portions of LibGDX posted that my observations simply weren’t correct.  This post here is mostly a recap of that thread.  I am not sure if anything in this thread will be of value to any of you, but it does illustrate that sometimes… who knows, it might just be gremlins!


So I set about creating a minimal sample to illustrate the problem I was having.  I have literally done this a few dozen, perhaps hundred, of times the past week.


I created an ultra simple model in Blender, with a bone external to mesh.  In my experiences to this point, every time I try to get the position of this external bone, the results will always be 0,0,0.  All internal bones will work fine, but the external one won’t.


Here is the model:



Simple enough, a mesh with a simple 3 bone armature bound to it.  What you don’t see is I’ve also done a small animation sequence ( as Default Take ).


I then load it with the following code.  The idea is draw a sphere at the location of each bone.  Pretty much what I expected to see is two two spheres, with the third one missing ( as it will actually be at 0,0,0, the same location as the first one.

package com.gamefromscratch;


import com.badlogic.gdx.ApplicationListener;

import com.badlogic.gdx.Files.FileType;

import com.badlogic.gdx.Gdx;














import com.badlogic.gdx.utils.JsonReader;



import com.badlogic.gdx.math.Vector3;



public class TankDemo implements ApplicationListener {

    private PerspectiveCamera camera;

    private ModelBatch modelBatch;

    private AnimationController animationController;


    private Model model;

    private ModelInstance modelInstance;


    private Model pivot;

    private ModelInstance p1, p2, p3;

    private Node bone1,bone2,bone3;


    private Environment environment;



    public void create() {  

    camera = new PerspectiveCamera(







        camera.near = 0.1f; 

        camera.far = 300.0f;


        modelBatch = new ModelBatch();


        JsonReader jsonReader = new JsonReader();

        G3dModelLoader modelLoader = new G3dModelLoader(jsonReader);

        model = modelLoader.loadModel(Gdx.files.getFileHandle("data/demo.g3dj", FileType.Internal));

        modelInstance = new ModelInstance(model);


        animationController = new AnimationController(modelInstance);

        animationController.animate("Default Take",-1,null,0);


        bone1 = modelInstance.getNode("Bone");

        bone2 = modelInstance.getNode("Bone_001");

        bone3 = modelInstance.getNode("Bone_002");


        ModelBuilder mb = new ModelBuilder();


        pivot = mb.createSphere(0.5f,0.5f,0.5f,10,10,GL20.GL_LINES,new Material(ColorAttribute.createDiffuse(Color.RED)),Usage.Position | Usage.Normal);

        p1 = new ModelInstance(pivot);

        p2 = new ModelInstance(pivot);

        p3 = new ModelInstance(pivot);




        environment = new Environment();

        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.8f, 0.8f, 0.8f, 1.0f));




    public void dispose() {






    public void render() {, 0,,;, 1, 1, 1); | GL10.GL_DEPTH_BUFFER_BIT);



        Vector3 pos = new Vector3();








        modelBatch.render(modelInstance, environment);

        modelBatch.render(p1, environment);

        modelBatch.render(p2, environment);

        modelBatch.render(p3, environment);






    public void resize(int width, int height) {




    public void pause() {




    public void resume() {





Then when I run this code I see:



Or, with the line rendering the main mesh itself commented out to more clearly show the bone locations:



For #$@#$@ing #@$@#$ @#$@$’s sake...


Why the swearing?  Because this is working EXACTLY how it is supposed to.  EXACTLY how I expected it to a week ago.  Exactly how Xoppa said it should.


What it isn’t doing is behaving EXACTLY how it has been for the last 50 or so times I tried the same thing!  Literally every time I did this before, that final bone didn’t update.  No bones in the armature that were external to the mesh itself were updated.  So I thought maybe that’s it…  maybe something about this export caused the third bone to be part of the geometry… maybe that’s it!


No such luck.  The exported g3dj file looks just like any dozen of others I have generated in the past.


This is unbelievably frustrating at this point, as a problem I have been trying furiously to work around simply seems to no longer exist.  At this point I simply have NO idea what I was doing in the past that caused the entire process to break.  And that doesn’t leave me with a warm fuzzy feeling.


Getting content out of Blender has never been the funnest process, but this last week has been an exercise in frustration… and at the end of the day, the source of the frustration seems to no longer exist.


There are a few differences between this example and some of my prior ones.  Generally I load two different Models from disk ( instead of building one using ModelBuilder ), so perhaps once I add another model to the mix I will start seeing the old behaviour ( although that really wouldn’t make much sense ).  Also, I am using a different computer than I normally use ( on my Mac today ), but it is the same version level of Blender and LibGDX, so that shouldn’t be a factor either.


At this point, I just don’t know what to say… maybe the fates simply hated me last week… that would explain the infernal cold they inflicted upon me!

Programming , ,

OpenTK 1.1 released

17. February 2014


OpenTK, a low level C# binding for the OpenGL, OpenAL and OpenCL has just hit a milestone 1.1 release.  It’s a project used behind the scenes by a number ofimage projects such as MonoGame.  Funny enough, they keep a low enough profile everyone always thinks they are dead!  Fortunately for .NET loving OpenGL fans, they are not.



This release brings a number of new goodies, including:

1. support for OpenGL 4.4 and OpenGL ES 3.0
2. strongly-typed enums for OpenGL ES 2.0 and 3.0
3. new, faster OpenGL bindings based on hand-optimized IL
4. a new SDL2 backend for improved platform compatibility
5. new Joystick and GamePad APIs under OpenTK.Input
6. improved startup time and reduced memory consumption
7. inline documentation for all OpenGL and OpenGL ES core functions
8. a greatly expanded math library
9. numerous bugfixes for Mac OS X, Windows 8 and Linux
10. ANGLE support for Windows systems without OpenGL drivers
11. support for Retina / high-DPI monitors
12. monolinker can now be used to reduce the size of OpenTK.dll
13. precompiled binaries for optional dependencies (OpenAL, SDL2, monolinker)


You can read the full release notes here and download the full package here.  OpenTK is an open source project hosted on Github here.

News ,

No bones about it. Bones in LibGDX and Blender

14. February 2014

This is one of those things I’ve been fighting with for the past few days so I thought I would share a bit.


First a bit of a primer for those of you that aren’t all that familiar with bones yet.  Bones are a common way of animating 3D geometry.  Essentially you add an armature (skeleton) to your scene and bind it to the geometry of your mesh.  Moving the bones the compose your armature will then update the bound geometry.


Let’s take a look at an example in Blender.  Here is the anatomy of skeletal animation in Blender:



Each bone in turn has a “weight”.  This is the amount of influence the bone’s movements have on the geometry.  First you need to parent the mesh to the armature.  Simply select the mesh, then shift select the bones and press Ctrl+P.


Each bone then has a certain weight attached to it.  The colour determines how much influence a bone has over the geometry.  Consider the following, it’s the weight mapping for the top most bone in that example:



So now, if in pose mode, I rotate that bone, we see:


As you can see, moving the bone changes the surrounding geometry based on the bones influence area.  In a nutshell, that is how bone animation works in Blender.  I cover more of the “how to” in the Blender to LibGDX tutorial if you want details.



So that’s bones in Blender, lets take a look at the LibGDX side of the equation.  Here is how the skeleton is represented in a g3dj file:

{"id": "Armature", 

"rotation": [-0.707107,  0.000000,  0.000000,  0.707107], 

"scale": [ 1.000000,  1.000000,  1.000000], 

"translation": [ 0.012381, -0.935900, -0.017023], 

"children": [

  {"id": "Bone", 

  "rotation": [ 0.500000, -0.500000,  0.500000,  0.500000], 

  "scale": [ 1.000000,  1.000000,  1.000000], 

  "children": [

    {"id": "Bone_001", 

    "rotation": [ 0.000000,  0.009739, -0.000000,  0.999953], 

    "scale": [ 1.000000,  1.000000,  1.000000], 

    "translation": [ 1.000000,  0.000000,  0.000000], 

    "children": [

      {"id": "Bone_002", 

      "rotation": [-0.000000, -0.013871,  0.000000,  0.999904], 

      "scale": [ 1.000000,  1.000000,  1.000000], 

      "translation": [ 1.575528,  0.000000,  0.000000]}






You can also see the bones as part of the geometry node as well, like so:

{"id": "Cube",
   "translation": [-0.012381, -0.017023, 0.935900],
   "parts": [
   {"meshpartid": "shape1_part1",
   "materialid": "Material",
   "bones": [
      {"node": "Bone",
      "translation": [ 0.012381, 0.017023, -0.935900, 0.000000],
      "rotation": [ 0.500000, -0.500000, 0.500000, 0.500000],
      "scale": [ 1.000000, 1.000000, 1.000000, 0.000000]},

      {"node": "Bone_002",
      "translation": [ 0.012381, 0.047709, 1.639329, 0.000000],
      "rotation": [ 0.502062, -0.502062, 0.497930, 0.497930],
      "scale": [ 1.000000, 1.000000, 1.000000, 0.000000]},

      {"node": "Bone_001",
      "translation": [ 0.012381, 0.017023, 0.064100, 0.000000],
      "rotation": [ 0.495107, -0.495107, 0.504846, 0.504846],
      "scale": [ 1.000000, 1.000000, 1.000000, 0.000000]}
   "uvMapping": [[]]}


The later are the bones that are contained in the mesh “Cube”.  This will be relevant in a minute.  Instead lets look at the Armature composition.


Each bone within the hierarchy is basically just a series of transforms relative to its parent.  The armature itself has a rotation, scale and translation, as do each child.  In your ModelInstance, the Armature is a hierarchy of Nodes, like so:



Animations then are simply a series of transforms applied to bones over a period of time, like so:



These values correspond with the keyframe values you set in Blender.


Now there are a couple gotchas to be aware of!

First off, in LibGDX a bone is probably more accurately called a joint.  Remember what a bone looked like in Blender:


Only the “bone head” is used.  The tail effectively doesn’t exist.


So, positioning relative to a bone will bring you to the base, not the tail.  Therefore, if you want to say… use bones for positioning other limbs, you need to create an extra one, and this lead to a problem.

Say I want to create a bone then that I can search for in code to mount a weapon upon.  I would then have to do something like this:



This allows me to locate the very tip of my geometry.  But there is a catch.  If I export it, I can see the new bone Bone_003 is part of my armature:



That said, remember the entry for “Cube” showed the bones it contains… yeah well, that’s a problem.


See… the new bone isn’t actually contained within the geometry.

As a direct result, when working with it in code in LIbGDX, it just doesn’t work.  It never returns the proper position, or at least the position I would expect.  I’ve also had some weird behaviour where an exported model with only a single bone can’t be programmatically updated as well.  I need to investigate this further.


As a result, I’ve decided that bones simply aren’t the way to go about it.  Instead what i’ve started doing is putting a null objet in where I want weapon mounts to appear.  It doesn’t seem to have the gotchas that bones have so far.


Sorry for the slow rate of updates, I am sick as a dog right now.  So if that post seemed a little incoherent, that’s why! :)


Programming , ,