Question

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;
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top