Improved texture support. Fixed OSX support.