OpenGL compare algorithm