Вопрос

So As objects get further away from me I want to apply a fade. The objects are textured.

I believe the colour of the object is controlled via this line

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

Instead of the colour being taken from the Vertex array, is there away to insert a colour in to this?

I have tried setting glColor4 etc and setting

effect.useConstantColor = YES;
effect.constantColor =  self.color;
Это было полезно?

Решение

Another way to do this is to use fog. Check out the docs for the GLKBaseEffect fog property

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top