本文介绍了glBindBuffer中的GL_ARRAY_BUFFER目标是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对VBO感到困惑,

  glGenBuffers(1,& positionBufferObject); 
glBindBuffer(GL_ARRAY_BUFFER,positionBufferObject);

除GL_ARRAY_BUFFER外,还有其他目标类型:GL_ATOMIC_COUNTER_BUFFER,GL_COPY_READ_BUFFER ...



然而,Opengl手册未提及这些目标的含义。我检查了glew.h:

  #define GL_ARRAY_BUFFER 0x8892 

这是否意味着目标(如GL_ARRAY_BUFFER)是地址?



目标 - GL_ARRAY_BUFFER在glBindBuffer中的含义是什么?

解决方案

一般



大多数必须绑定到OpenGL上下文中称为目标的位置以供它们使用。一个目标不过是一个地方的对象绑定的上下文。



不同的对象类型(缓冲区,纹理等)有不同的目标集。一般而言,每个目标具有特定的含义:将一个对象绑定到一个目标意味着您想以任何目标使用绑定到它的对象的方式使用该对象。



将对象绑定到一个目标不会影响对象是否绑定到另一个目标(除非它是一个纹理对象;它们以不同的方式处理目标)。

修改对象或从绑定对象查询数据。他们采取了一个目标,他们正在修改/查询的对象已被绑定。



GL_ARRAY_BUFFER



code> GL_ARRAY_BUFFER target for 表示。然而,仅仅依靠这个目标是无能为力的。这只是打电话给,该绑定使用绑定到该目标的任何缓冲区作为该属性的属性数据。


I was confused about the VBO,

glGenBuffers(1, &positionBufferObject);
glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject);

Besides GL_ARRAY_BUFFER, there are other target types: GL_ATOMIC_COUNTER_BUFFER, GL_COPY_READ_BUFFER...

However, the Opengl manual doesn't mention what these targets mean. I checked the glew.h:

#define GL_ARRAY_BUFFER 0x8892

Does this mean the targets (like GL_ARRAY_BUFFER) are addresses?

What does the target--GL_ARRAY_BUFFER mean in glBindBuffer?

解决方案

In General

Most OpenGL objects must be bound to locations in the OpenGL context called "targets" for them to be used. A target is nothing more than a place in the context where objects are bound.

Different object types (buffers, textures, etc) have different sets of targets. Generally speaking, each target has a specific meaning: to bind one object to one target means that you want to use that object in whatever manner that target uses objects bound to it.

Binding an object to one target does not affect whether the object is bound to another target (unless it's a texture object; they treat targets differently).

There are functions that modify objects or query data from bound objects. They take a target to which the object they are modifying/querying has been bound.

GL_ARRAY_BUFFER

The GL_ARRAY_BUFFER target for buffer objects represents the intent to use that buffer object for vertex attribute data. However, binding to this target alone doesn't do anything; it's only the call to glVertexAttribPointer (or equivalent functions) that uses whatever buffer was bound to that target for the attribute data for that attribute.

这篇关于glBindBuffer中的GL_ARRAY_BUFFER目标是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 10:40