OpenGL显示列表优化 [英] OpenGL Display List Optimizing

查看:292
本文介绍了OpenGL显示列表优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我的应用程序运行一些速度测试,并且我试图找到更多方法来优化我的程序,尤其是通过显示列表.目前我正在得到:

I am currently running some speed tests for my applications and I am trying to find more ways to optimize my program, specifically with my display lists. Currently I am getting:

具有128.2万个顶点的12 FPS

12 FPS with 882,000 vertices

40 FPS,具有234,000个顶点

40 FPS with 234,000 vertices

95帧/秒,具有72,000个顶点

95 FPS with 72,000 vertices

我知道我需要尽量减少拨打电话的次数,所以不要:

I know that I need to minimize the number of calls made, so instead of:

for(int i = 0; i < Number; i++) {
   glBegin(GL_QUADS);
   ...normal and vertex declarations here
   glEnd();
}

一个更好的方法是这样做:

A better way would be to do this:

glBegin(GL_QUADS);
for(int i = 0; i < Number; i++) {
   ...normal and vertex declarations here
}
glEnd();

这确实有助于将我的FPS提高到上面列出的结果,但是,还有其他方法可以优化我的显示列表吗?也许通过使用除嵌套顶点数组之外的其他东西来存储我的模型数据?

This did help increase my FPS to the results listed above, however, are there other ways I can optimize my display lists? Perhaps by using something other than nested vertex arrays to store my model data?

推荐答案

通过切换到 VBO 或至少顶点阵列.

立即模式(glBegin()...glEnd())有很多方法调用开销.通过使用更现代的OpenGL,我已经设法在笔记本电脑上以几百fps的速度渲染了约100万个顶点(如果没有物理引擎/实体系统的开销也将更快).

Immediate mode (glBegin()...glEnd()) has a lot of method call overhead. I've managed to render ~1 million vertices at several hundred fps on a laptop (would be faster without the physics engine/entity system overhead too) by using more modern OpenGL.

如果您想了解兼容性,大约98%的人支持VBO扩展(GL_ARB_vertex_buffer_object) http://feedback.wildfiregames.com/report/opengl/

If you're wondering about compatibility, about 98% of people support the VBO extension (GL_ARB_vertex_buffer_object) http://feedback.wildfiregames.com/report/opengl/

这篇关于OpenGL显示列表优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆