Jump to content
  • Advertisement
Sign in to follow this  
_dogo

Cg: float3x3 and float[3][3]

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I write shader in cg, i have to pass a uniform matrix parameter. There is no problem up to 4x4 size-matrices, as they are definied in cg as float 3x3, float4x4, etc., and i can use them perfectly. But float5x5 is NOT, and if i want to pass a float[5][5] matrix, it does not work. The values are not passed. It seems i cannot pass a float[5][5] matrix i have to convert it someway. If i pass tis way, it works: fragpout main(fragin IN, uniform float3x3 convMx) But this way it does not: fragpout main(fragin IN, uniform float convMx[3][3]) I understand they are not equivalent, but i have to use bigger matrices as well... Have you got any ideas?

Share this post


Link to post
Share on other sites
Advertisement
I have the same problem with GLSL. Since there is no arbitrary dimension matrices (> mat4) I had to declare:

float tmp[5][5];

and assign values to each element separately. Is there a 2D array declaration/initialization like in C ?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!