glBufferData如何知道要在哪个VBO上工作? [英] How does glBufferData know which VBO to work on?

查看:64
本文介绍了glBufferData如何知道要在哪个VBO上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是glBufferData的正式声明,用于填充VBO:

Here is the formal declaration for glBufferData which is used to populate a VBO:

void glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);

但是,令人困惑的是,您可以有多个VBO,但是此功能不需要特定VBO的句柄,那么它如何知道您打算使用哪个VBO?

What is confusing, however, is that you can have multiple VBOs, but this function does not require a handle to a particular VBO, so how does it know which VBO you are intending?

target参数可以是GL_ARRAY_BUFFERGL_ELEMENT_ARRAY_BUFFER,但是我的理解是,每个参数可以有多个.

The target parameter can be either GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER but my understanding is that you can have more than one of each of these.

类似的glBufferSubData方法也是如此,该方法打算在VBO上随后被调用-它如何知道要处理哪个VBO?

The same is true of the similar glBufferSubData method, which is intended to be called subsequent times on a VBO -- how does it know which VBO to handle?

推荐答案

这是OpenGL中常见模式将对象绑定到目标并通过发出没有句柄的函数调用对其执行操作.同样适用于纹理.

This is a common pattern in OpenGL to bind object to a target and perform operations on it by issuing function calls without a handle. The same applies to the textures.

这篇关于glBufferData如何知道要在哪个VBO上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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