   Matrix Problem (Classes)
  I drew a simple house, comprised of a cube and a pyramid (drawn using primatives), in the Draw method of the Game1 class. I then applied a translation and drew another one. All was good. Then it came to putting my drawing into a class and I'm having a problem with the transform matrices.Say the class is called House, and in the Draw method I have the matrix transformations (scale, translate, rotate) to draw the cube, then the second lot of translations to draw the pyramid that acts as a roof.Now my problem is, if I instance the class twice from in the Game1 class, then call House1.Draw(), then apply a translation to draw the house further along the X and Z axis, and call House2.Draw() it's drawing it over the first house. In other words, its not recognising the translation matrix inbetween the two Draw() calls as the original matrix info for arranging the house drawing (inside the class) is being used and I don't know how to get around this. I have tried passing in variables for the translation along the x, y, z but this gives me strange results.I remember in OpenGl that you could use glPopMatrix() and glPushMatrix() to store transformations and then apply a transformation outside this. Is there an equivalent in XNA?I can post the code if the above is not clear. Thanks,S   
  i don't tried xna yet but, i think you can make your own glpushmatrix popmatrix functions. directx has D3DDevice->SetTransform(D3DTS_WORLDMATRIX(matnum),(D3DMATRIX*)mt); function, and has a GetTransform function too. so pushmatrix means gettransform and store it somewhere, pop means restore from that matrix.also i think you may not need these, and you can follow this path;create a d3dmatrix called matrix, load identity to it apply transformation and rotation, settransform to matrix. then call house1.draw(). after that load identity again, apply transformations and rotation again and settransform to this matrix again, then call house2.draw() i think it should work.   ;  XNA doesn't have any sort of "matrix stack" like OpenGL.  This is because in XNA there is no concept of a "global world transform".  Instead you apply a world transform to each individual Effect or BasicEffect that you use for rendering.If you want to accumulate transformations, you'll have to do this yourself.  A common approach is to use a transformation hierarchy that describes how your  scene is laid.  Typically it will have a tree structure, where child nodes inherit the transformation of their parents.  Thus child nodes have a "relative transform" describing their position/orientation relative to their parent, and a "world transform" or "absolute transform" that you determine by traversing the tree from the root node and concatenation transformations along the way.Or if you wanted, you could keep track of a global transform using stack.  It wouldn't be very difficult at all to implement.   