Alright so I did this thing today in class, programming a rotating square. So it all works good, but when I change the view matrix to move side to side, it scews from the side? Like, its on a grid, and so the grid hits the right side of the display, and continues on the otherside, but scewed?
I know this is a pretty vague question, but im unsure how it works, very new to graphics programming.
//Create View
View = XRotation4x4(XRotation);
View = YRotation4x4(YRotation)*View;
View = ZRotation4x4(ZRotation)*View;
View = TranslationMatrix4x4(CamPos.x, CamPos.y, CamPos.z)*View;
//Inverse view
View = View.Inverse();
//Projecting my feelings
Projection = ProjectionMatrix4x4(90, Width, Height, 0.1, 10);
//Draw calls
VertexShader = ApplyWVP;
PixelShader = NULL;
WorldMatrix = Identity4x4;
DrawGrid(GridH, GridV, 22, 22, GridColor);
WorldMatrix = TranslationMatrix4x4(0, 0.25, 0);
WorldMatrix = WorldMatrix*YRotation4x4(Timer->TotalTime() * 20);
DrawCubeWireframe(Cube, CubeColor,true);
Before:
After moving to the left: