I'm working in iOS and using GLKit to try to perform some simple matrix manipulations. In a nutshell: I'm looking to rotate a number of objects around the centre of the viewport by a certain number of degrees (the objects are not positioned at the centre of the viewport, I'm simply looking for the rotation to pivot around the centre).
From reading, it appears I can achieve this by:
- Translating the object so that it lies at the world coordinate origin
- Performing the rotation
- Translating the object back to it's original position
I have a number of questions though:
- First and foremost: is this the correct approach?
- Is the world coordinate origin always
0, 0, 0, or is it affected by the values used to create my orthographic projection? - To calculate
gl_Positionin my vertex shader I'm essentially doing the following:projectionMatrix * modelViewMatrix * position. Am I correct in assuming it's best to manipulate themodelViewMatrixfor this kind of operation, or would it be best to rotate theprojectionMatrixto handle all objects simultaneously?
