glEnableVertexAttribArray修改什么对象的状态? [英] What object's state does glEnableVertexAttribArray modify?

查看:73
本文介绍了glEnableVertexAttribArray修改什么对象的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我了解glEnableVertexAttribArray的作用-它激活了程序的特定属性(如果我错了,请纠正我).

I think I understand what glEnableVertexAttribArray does -- it activates a particular attribute of a program (please correct me if I am wrong).

我不明白的是哪个对象存储了此信息.它是程序对象吗?也就是说,如果我这样做:

What I don't understand though is which object stores this information. Is it the program object? That is, if I do:

glUseProgram(program);
glEnableVertexAttribArray(0);

,然后再执行:

glUseProgram(program);
glDrawArray(...);

将启用位置0的属性吗?

will the attribute at location 0 be enabled?

是在修改某些全局状态,需要在每次绘制调用之前每次重新设置? 还是在修改VAO的状态?如果是这样,在没有VAO的OpenGL ES 2.0中怎么办?

Or is it modifying some global state which needs to be reset every time before each draw call? Or is it modifying the state of the VAO? If so, what about in OpenGL ES 2.0, where there are no VAOs?

推荐答案

它会影响顶点数组对象的状态.

It affects vertex array object state.

如果是这样,在没有VAO的OpenGL ES 2.0中怎么办?

If so, what about in OpenGL ES 2.0, where there are no VAOs?

然后它会影响全局上下文状态.成为VAO状态的状态集最初只是全局状态.这就是为什么存在OpenGL绑定修改对象模型的原因.这样,当您添加新对象时,不必更改旧代码.

Then it affect global context state. The set of state that would become VAO state was originally just global state. That's why the OpenGL bind-to-modify object model exists; so that when you add new objects, you don't have to change your old code.

这篇关于glEnableVertexAttribArray修改什么对象的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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