Quote:Original post by lightbringer
Quote:Original post by waZim
actually i was wondering if i can extract the World Matrix from Modelview matix. which i suppose is not "possible"? the only way that was mentioned on the cited thread was to keep track of your Worl matrix seperately..
If you keep track of your view matrix, I am pretty sure you can get back world from modelview. With just the modelview it is not possible as you don't know which part is the model and which part is the view - because it makes no difference to OpenGL, it's all just translations (well, and rotations and scales, but you get the idea).
Yes true,, and i was doing just like that..
when i do the camera setup i also save my modelview matrix. which at that time (i suppose) is just the view matrix. and now lets say i do alot of matrix pushes/pops and multiplications etc.. when now i get the modelview matrix it has some cooridnates and lets say i am just concerned with Translation factor. so
// after camera setupglGetFloatv(GL_MODELVIEW_MATRIX,ViewMatrix);// and Invert the ViewMatrix.............// Later afterDrawObject();glGetFloatv(GL_MODELVIEW_MATRIX,WorldMatrix);Object.x = WorldMatrix[12] - ViewMatrix[12];Object.y = WorldMatrix[13] - ViewMatrix[13];Object.z = WorldMatrix[14] - ViewMatrix[14];
Is this how it should be? i am not getting proper coordinates with this. .they are still in Eye space. or some other "space" :) but not in world.