The only solution helped me here was to make own shaders.
Const positioned light with GLKBaseEffect
-
10-12-2021 - |
Question
I need to set const spot light position with GLKBaseEffect: so when I change modelview, light stays in the same place. How can I achieve this?
Solution 2
OTHER TIPS
When you set the position of a light using GLKBaseEffect, it uses the value currently stored in its modelviewMatrix property. So, you need to set this value twice, once for the light and once for your object:
self.effect.transform.modelviewMatrix = GLKMatrix4Identity;
self.effect.light1.position = GLKVector4Make(0.0, 1.0, 3.0, 1);
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -3.0f);
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, GLKMathDegreesToRadians(90), 0, 1, 0);
self.effect.transform.modelviewMatrix = modelViewMatrix;
That should do the trick
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow