Replaced poor texture loading w/ more robust code

This gets rid of the "dereferencing type-punned pointer"-warning plus
it's endian-neutral.