   OpenGL Weird Bahavior Scaling
  Edit: Solved, removed unneccessary source codeOk so I have a basic OpenGL scene with just a simple 3d cube.  I have separate projection, model, view matrices and I have functions to translate, scale, rotate the model matrix.All of my transformation functions appear to be working correctly except when I try to scale the model matrix in the z-plane.  This is what happens when I try to scale in the z-plane:- The z-scale will be equal to whatever my x-scale is.- If I alter the z-scale from 1.0 to 2.0, the entire cube will be halved in size in each plane (x, y, z).-If I set z-scale to 0.5, the cube gets doubled in size in each planeI'm having a really hard time trying to figure out what would cause this to happen.Thanks for looking.  If anyone has even a rough guess about what's going on, please let me know.[Edited by - X Abstract X on April 23, 2010 1:25:19 AM]
  Are you sure your projection matrix is good? I don't know where you got your formula but it doesn't look anything like the formulas from gluPerspective (if that is what you are trying to mirror). Your zeros aren't even in the same place, so I'm a little skeptical that it is correct.;  Thanks again - you have replied to a lot of my topics and I appreciate it.  The formula I was using is different because it is compatible with an asymetrical viewing volume.  Anyway, I did try the exact formula you provided and I have the exact same results as before.   ;  I share some code :)void PerspectiveMatrix(   float matrix[16],   float fovy,   int viewportWidth,   int viewportHeight,   float znear,   float zfar){   float aspect = float(viewportWidth) / float(viewportHeight);   float fovy2r = fovy * MATH_PI_360;   float cotan = cosf(fovy2r) / sinf(fovy2r);   matrix[0]  = cotan / aspect;   matrix[1]  = 0.0F;   matrix[2]  = 0.0F;   matrix[3]  = 0.0F;   matrix[4]  = 0.0F;   matrix[5]  = cotan;   matrix[6]  = 0.0F;   matrix[7]  = 0.0F;   matrix[8]  = 0.0F;   matrix[9]  = 0.0F;   matrix[10] = (zfar + znear) / (znear - zfar);   matrix[11] = -1.0F;   matrix[12] = 0.0F;   matrix[13] = 0.0F;   matrix[14] = (2.0F * znear * zfar) / (znear - zfar);   matrix[15] = 0.0F;}void ScaleMatrix(float m[16], const float v[3]){   m[0]  *= v[0];   m[1]  *= v[0];   m[2]  *= v[0];   m[3]  *= v[0];   m[4]  *= v[1];   m[5]  *= v[1];   m[6]  *= v[1];   m[7]  *= v[1];   m[8]  *= v[2];   m[9]  *= v[2];   m[10] *= v[2];   m[11] *= v[2];};  Damn, I finally figured out the problem was with my shaders.  It turns out in my vertex shader I was multiplying in the wrong order!I was doing: projection * model * view * vertexInstead of: projection * view * model * vertex   