one minor fix to texture pixel assignment code
moved some stuff around to avoid code duplication and finish up gl 2D texture code