我知道他们已被弃用,但这两个是等价的吗?
1
glBegin(GL_LINES);
glVertex2f(x1, y1);
glVertex2f(x1, y2);
glVertex2f(x1, y2);
glVertex2f(x2, y2);
glVertex2f(x1, y1);
glVertex2f(x2, y1);
glVertex2f(x2, y1);
glVertex2f(x2, y2);
glEnd();
2
glBegin(GL_LINES);
glVertex2f(x1, y1);
glVertex2f(x1, y2);
glEnd();
glBegin(GL_LINES);
glVertex2f(x1, y2);
glVertex2f(x2, y2);
glEnd();
glBegin(GL_LINES);
glVertex2f(x1, y1);
glVertex2f(x2, y1);
glEnd();
glBegin(GL_LINES);
glVertex2f(x2, y1);
glVertex2f(x2, y2);
glEnd();
答案 0 :(得分:3)
等同于行为?是。
性能相当吗?不。当然,你正在处理即时模式,所以它会很慢。但即使是立即模式,也有慢,而且慢。您需要拨打的glBegin
次呼叫越少越好。