首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >什么是opengl当前顶点?

什么是opengl当前顶点?
EN

Stack Overflow用户
提问于 2013-07-31 05:02:43
回答 1查看 719关注 0票数 2

这就是我在opengl文档中发现的:

代码语言:javascript
运行
复制
void glGetVertexAttribfv(GLuint index,  GLenum pname,  GLfloat *params);

GL_CURRENT_VERTEX_ATTRIB
             params returns four
        values that represent the current value for the
        generic vertex attribute specified by index. Generic
        vertex attribute 0 is unique in that it has no
        current state, so an error will be generated if
        index is 0. The initial value
        for all other generic vertex attributes is
        (0,0,0,1).
            glGetVertexAttribdv and glGetVertexAttribfv
            return the current attribute values as four single-precision floating-point values;
            glGetVertexAttribiv reads them as floating-point values and
            converts them to four integer values; glGetVertexAttribIiv and
            glGetVertexAttribIuiv read and return them as signed or unsigned
            integer values, respectively; glGetVertexAttribLdv reads and returns
            them as four double-precision floating-point values.

但我的问题是,我不知道现在的顶点是什么。如何设置当前顶点?我能用它来测试我发送给opengl的属性是否包含正确的数据吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-31 05:20:34

glGetVertexAttrib返回与泛型顶点属性关联的值,该属性可以用glVertexAttrib函数设置。

更详细地说,OpenGL中有两种类型的属性:

  1. 在执行抽签调用(例如,glDrawArrays)时,从启用的顶点数组中对每个顶点更新的顶点。
  2. 这些功能类似于着色制服,用于为没有关联的、启用的set顶点数组的属性提供值。

例如,假设您使用glVertexAttribPointerglEnableVertexAttribArray启用两个用作顶点属性的数组,然后通过调用glDrawArrays( GL_POINTS, 0, NumPoints )来呈现。在这种情况下,绑定的顶点着色器将执行NumPoints次,每次从两个数组中的每一个读取一个新值。

但是,如果仅在数组上启用(例如,顶点数组为零),则可以使用glVertexAttrib函数为属性1设置属性值。如果再次通过调用glDrawArrays( GL_POINTS, 0, NumPoints )进行呈现,则顶点着色器将再次执行NumPoints时间,属性零的值将使用启用的顶点属性数组中的值进行更新,但属性值为“常量”,并设置为glVertexAttrib提供的值。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17961990

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档