Read correct type argument

```
0: gl
1: [height, width]
2: format
3: type
```
Merge pull request #6 from timoxley/patch-1

Read correct type argument