问题描述
有
glVertexAttribPointer()
glVertexAttribIPointer()
glVertexAttribLPointer()
据我所知,可以使用glVertexAttribPointer
代替其他两个.
As far as I know, glVertexAttribPointer
can be used instead of the other two.
如果是,为什么存在I
和L
变体?
If so, why do the I
and L
variations exist?
推荐答案
我在OpenGL Insights中了解了这一点
I read about this in OpenGL Insights
使用glVertexAttribPointer()
时,所有内容都将转换为浮点数. glVertexAttribIPointer()
仅可以公开存储整数的顶点数组,而glVertexAttribLPointer()
仅用于双精度.
When using glVertexAttribPointer()
everything gets cast to a float. While glVertexAttribIPointer()
can only expose vertex arrays that store integers and glVertexAttribLPointer()
is only for doubles.
经此 OpenGL.org页面上的引用确认:
对于glVertexAttribIPointer,仅整数类型GL_BYTE GL_UNSIGNED_BYTE,GL_SHORT,GL_UNSIGNED_SHORT,GL_INT, GL_UNSIGNED_INT值始终保留为整数 值.
For glVertexAttribIPointer, only the integer types GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT are accepted. Values are always left as integer values.
glVertexAttribLPointer指定通用顶点属性的状态 与用64位声明的着色器属性变量关联的数组 双精度组件.类型必须是GL_DOUBLE.索引,大小, 和步幅的行为与glVertexAttribPointer和 glVertexAttribIPointer.
glVertexAttribLPointer specifies state for a generic vertex attribute array associated with a shader attribute variable declared with 64-bit double precision components. type must be GL_DOUBLE. index, size, and stride behave as described for glVertexAttribPointer and glVertexAttribIPointer.
这篇关于为什么存在glVertexAttribPointer的不同变体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!