refactored gl_buffer, added cuda support