Opengl顶点数组对象 [英] Opengl Vertex Array Objects

查看:164
本文介绍了Opengl顶点数组对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VRam中是否存储了OpenGL的顶点数组对象?

Are OpenGL's Vertex Array Objects stored in VRam?

我真正要问的是:如果我加载模型(例如,使用Assimp),然后将顶点和索引数据读取到顶点数组对象"中;我将在Ram中复制数据,还是将其复制到GPU?

What I'm really asking: If I load a model, using Assimp for example, then read the vertex and indice data into Vertex Array Objects; will I be duplicating data in Ram, or copying it to the GPU?

推荐答案

这里似乎缺乏对OpenGL术语的理解.

There seems to be a lack of understanding of OpenGL terminology here.

您不能将顶点和索引数据"读入顶点数组对象.他们实际上并没有存储数据;数据数组存储在缓冲对象中. VAO仅引用. VAO描述了如何格式化这些缓冲区中的数据,以便OpenGL能够理解它们的含义.

You cannot read "vertex and indice data" into Vertex Array Objects. They don't actually store the data; the arrays of data are stored in buffer objects. VAOs only reference them. VAOs describe how the data in those buffers is formatted so that OpenGL can understand what they mean.

如果您要询问客户端顶点数组(请注意,缺少对象"一词,尽管您可以将客户端顶点数组与VAO一起使用),但根据定义,它们不会存储在GPU上.客户端顶点数组的客户端"是用户的代码. IE:您分配,拥有和管理的内存.

If you are asking about client-side vertex arrays (note the lack of the word "object", though you can use client-side vertex arrays with VAOs), then by definition they are not stored on the GPU. The "client" of client-side vertex arrays is the user's code. IE: memory you allocated, own, and manage.

如果您询问使用缓冲对象,是的,缓冲对象存储位于在服务器"上(即:OpenGL实现拥有的内存).您是否可以确定它是否实际上在任何特定时间点都在GPU上.但是在调用glBufferDataglBufferSubData或其他更新缓冲区对象的函数之后,服务器已复制了该数据.

If you're asking about the use of buffer objects, yes, buffer object storage resides on the "server" (ie: memory owned by the OpenGL implementation). Whether it's actually physically on the GPU at any particular point in time is not something you can determine. But after you call glBufferData, glBufferSubData, or other such functions that update buffer objects, the server has copied that data.

这篇关于Opengl顶点数组对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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