Original Post
Hey,
I''m having a problem when orientating objects using custom matrices. What I do is pass the rendering core the up and front vectors of the object, and it''s position. This core then builds a matrix out of this, and does a simple glMultMatrixf to apply the transform.
Here''s what I do:
1. Apply camera transformation ( uses gluLookAt )
2. Calculate side vector as front x up
3. Recalculate up as side x front ( to make sure you have an orthogonal frame )
4. Setup matrix as:
[Fx,Sx,Ux,Px]
[Fy,Sy,Uy,Py]
[Fz,Sz,Uz,Pz]
[0,0,0,1]
5. Apply custom matrix
Now, for some reason, this screws up the backface culling on the objects. Any ideas on why? Here''s the exact code for you to take a look at, just incase I made a coding mistake...
Any help is appreciated.
- Phil.
Death of one is a tragedy, death of a million is just a statistic.
camera->ApplyTransformation(); // uses gluLookAt CVector side = front * up; up = side * front; float m[16]; m[0] = front.dx; m[1] = front.dy; m[2] = front.dz; m[3] = 0.0f; m[4] = side.dx; m[5] = side.dy; m[6] = side.dz; m[7] = 0.0f; m[8] = up.dx; m[9] = up.dy; m[10] = up.dz; m[11] = 0.0f; m[12] = pos.dx; m[13] = pos.dy; m[14] = pos.dz; m[15] = 1.0f; glMultMatrixf( m );

