Are you sure that gl context init code will actually work on remote headless servers?From my previous attempts I  always had to create also a dummy PBuffer to get the actual context.In your case you rely upon Window object which is not accessible(at least in my attempts) on the remote servers like those of Amazon EC2 .