سؤال

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