Fix some issues in gl state management. Add methods for logging state information.
Texture parameters are configure prior to drawing.