Sign in to follow this  
Gumgo

cg: cgSetMatrixParameterf_

Recommended Posts

Hello, I'm having some trouble understanding which cgSetMatrixParameter function to use in order to pass matrices to a cg shader. I have a 4x4 matrix
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
stored in row-major order:
11 12 13 14 | 21 22 23 24 | 31 32 33 34 | 41 42 43 44
and I need to send it to the shader in the format of a 4x3 matrix. So (correct me if I'm wrong), the entries of this matrix should be (from the previous one):
11 21 31
12 22 32
13 23 33
14 24 34
I've read that cg stores matrices in row-major order as well, so if the 4x3 matrix looks like this:
11 21 31 | 12 22 32 | 13 23 33 | 14 24 34
How does cgSetMatrixParameterfc/r actually work? If I'm setting a 4x3 matrix from a 4x4 one, which entries are mapped to which from the 4x4 one to the 4x3 one? Without knowing this it's hard to figure out what to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this