1

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;
genpfault
  • 51,148
  • 11
  • 85
  • 139
Burf2000
  • 5,001
  • 14
  • 58
  • 117

1 Answers1

2

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

Olie
  • 24,597
  • 18
  • 99
  • 131
  • This would probably be easiest; another option is if you're using GLSL is to calculate the eye distance (transpose vertex from model->world->eye) and then darken the vertex color accordingly. – geowar Apr 15 '15 at 22:57