Fix segfaults by making gl functions a member