This enables thread available not only for the main thread but also
any threads.
This is a preparation for iOS Metal, that runs drawing functions on
a particular thread.
Updates #737
Attribute variables are often optimized out and it is really hard
to prevent this.
Instead of implicit indices of attribute variables, use explicit
indices by glBindAttribLocation.
Bug: #816
Now ReplacePixels command is called only when necessary.
This also ensures that DrawImage must be called after ReplacePixels
is called since there is a potential problem that rendering images
on a texture without initializing by replacing pixels might cause
problems (escpecially on Metal. Perhaps #593 might be related).