added utility functions and opengl helper functions