OpenGL之再向虎山行[3]:OpenGL DisplayList,还得被超越

OpenGL Displaylist是学OpenGL是都要碰到的东西。但是与VBO相比,我们不能进行修改数据,这也就决定了用它来处理静态不变的物体尚可,如果想支持Dynamic Object,就捉襟见肘了。

------------------------------------------------------------

Display list is one of the fastest methods to draw static data because vertex data and OpenGL commands are cached in the display list and minimize data transmissions from the client to the server side. It means that it reduces CPU cycles to perform the actual data transfer.

------------------------------------------------------------

但是,不幸的是,它与glBegin/glEnd一样,并未被纳入OpenGL ES的范畴。

------------------------------------------------------------

OpenGl ES specification 1.0

5.4 Display Lists
Display lists are not supported. Display lists are used by many applications—sometimes to achieve better performance and sometimes for convenience. The implementation complexity associated with display lists is too large for the implementation targets envisioned for this profile.
------------------------------------------------------------

所以,对于DisplayList,也许还得超越,毕竟,对OpenGL ES的支持是开发者们不得不思考的问题。

创建与引用DisplayList的基本过程如下:

// create one display list
GLuint index = glGenLists(1);

// compile the display list, store a triangle in it
glNewList(index, GL_COMPILE);
glBegin(GL_TRIANGLES);
glVertex3fv(v0);
glVertex3fv(v1);
glVertex3fv(v2);
glEnd();
glEndList();


// draw the display list
glCallList(index);


// delete it if it is not used any more
glDeleteLists(index, 1);


Reference:

http://www.songho.ca/opengl/gl_displaylist.html

原文地址:https://www.cnblogs.com/piaoger/p/2184485.html