Fix bug where a texture was created before opengl was initialized (found on osx).