【问题标题】:GLKit GLKVertexAttribColor: Dynamically changing coloursGLKit GLKVertexAttribColor:动态改变颜色
【发布时间】:2012-07-01 02:16:07
【问题描述】:

所以随着物体离我越来越远,我想应用淡入淡出。 对象是有纹理的。

我相信对象的颜色是通过这条线控制的

glVertexAttribPointer(GLKVertexAttribColor, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid *) offsetof(Vertex, Color));

不是从顶点数组中获取颜色,而是在其中插入颜色?

我试过设置 glColor4 等并设置

effect.useConstantColor = YES;
effect.constantColor =  self.color;

【问题讨论】:

    标签: ios opengl-es glkit eaglview texturing


    【解决方案1】:

    另一种方法是使用雾。查看GLKBaseEffect fog property的文档

    【讨论】:

    • 这可能是最简单的;如果您使用 GLSL,另一种选择是计算眼睛距离(从模型->世界->眼睛转置顶点),然后相应地使顶点颜色变暗。
    猜你喜欢
    • 2018-12-31
    • 2011-10-19
    • 2012-10-17
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多