OpenGL:VAO和VBO是否适合大型多边形渲染任务? [英] OpenGL: Are VAOs and VBOs practical for large polygon rendering tasks?

查看:188
本文介绍了OpenGL:VAO和VBO是否适合大型多边形渲染任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您想一次在视锥中绘制一个具有数千个多边形的大型景观,并且用户的视点不断变化,那么使用VAO或VBO实用吗?

If you wanted to render a large landscape with thousands of polygons in the viewing frustum at a time as well as the user's viewpoint changing constantly, is it practical to use VAOs or VBOs?

我的意思是,每次玩家的位置或摄像机旋转角度发生变化时,您都必须重新计算顶点数据,以正确剔除不再可见的任何顶点或场景,以保持良好的FPS计数.但是这样做,您的FPS计数会减少,因为您正在不断地重新打包所有缓冲区.

I mean, every time the player's position or camera rotation changed, you would have to recompute the vertex data in order to properly cull any vertices or scenes which are no longer seen in order to keep a good FPS count. But in doing this, your FPS count would go down because you are, well, repacking all the buffers constantly.

那么在即时模式下使用这两种方法仍然有好处吗?

我的猜测是肯定的,因为使用立即模式",您还会以略有不同的方式重新计算每帧的所有顶点.令人遗憾的是,我没有太多背景知识,而且我很困惑,因为互联网对此主题的信息不一.

My guess is yes because with Immediate Mode, you are also recomputing all the vertices every frame, just in a slightly different way. Sadly, I don't have much background with any of this, and I am confused because the internet has a mixed message on this topic.

推荐答案

答案是,VBO适用于大型多边形渲染任务.不应该使用立即模式,因为它是固定功能管道的一部分,并且不建议使用FFP.

The answer is yes, VBO's are practical for large polygon rendering tasks. Immediate mode should not be used because it's part of the fixed function pipeline and the FFP is deprecated.

但是您不应该每帧重新计算格局并将其再次存储在缓冲区中.有一些方法可以处理这种情况,但是您应该避免每帧更新一个VBO,因为这可能导致资源冲突.

But you should not recompute the landscape every frame and store it in the buffers again. There are some ways to handle such situations but you should avoid to update a VBO each frame because this could lead to resource conflicts.

  • 使用某种LOD.有多种方法可以执行此操作(看这里以获得图像如何工作,但不必).通常,当场景与查看器的距离较远时,可以减少多边形.如果您具有2D地形(没有悬垂的地形),则非常简单.如果您的地形较复杂,则很难解决,但仍然可以实现.
  • 将所有缓冲区保留在RAM中,这可能会在片刻后可见(但不必如此),与LOD方法相比,这非常消耗内存.如果地形线段不在视野范围内,则将其删除.
  • 流式传输数据,并使用双缓冲VBO(这意味着:对于一个段,您有2个VBO,一个正在渲染,一个已写入).
  • Use some kind of LOD. There are different ways to do this ( Look here to get a image how this could work, but don't have to ). Generally you reduce polygons when the scene has a large distance to the viewer. If you have a 2D Terrain ( No overhanging terrain ) it's very simple. If your terrain is more complex it is harder to handle this but still possible.
  • Keep all the buffers in RAM which may be visible in a few moments ( but don't have to ), this is very memory consuming compared to the LOD approach. If the terrain segment is out of view range remove it.
  • Stream the data and with double buffered VBO's ( This means: For one segment you have 2 VBO's one which is rendering and one which is written to )

这篇关于OpenGL:VAO和VBO是否适合大型多边形渲染任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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