Advertisement Jump to content
Sign in to follow this  
MARS_999

Help needed to get HLSL code frag to GLSL

This topic is 4906 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

I can't get this code of HLSL to convert to GLSL???
float4x4 view_matrix;

// Rotate the basis vectors into view space
   float4 nvector = float4(inNormal.x, inNormal.y, inNormal.z, 0.0);
   float4 tvector = float4(inTangent.x, inTangent.y, inTangent.z, 0.0);
   float4 bvector = float4(inBinormal.x, inBinormal.y, inBinormal.z, 0.0);

   Out.Normal = mul(view_matrix, nvector);
   Out.Tangent = mul(view_matrix, tvector);
   Out.Binormal = mul(view_matrix, bvector);

I have tried the matrixCompMult() and that doesn't work. From what I have found out the mul() in HLSL multiplies matrixes... but float4 is just a vec4 in GLSL?? Any help appreciated.

Share this post


Link to post
Share on other sites
Advertisement
that looks like a straight matrix * vector multiply to me, which is all you need todo in GLSL as well, for example : Normal = view_matrix * nvector;

Share this post


Link to post
Share on other sites
Hmmm. here is what I got and get...

n = view_matrix * gl_Normal;
t = view_matrix * Tangent;
b = view_matrix * Binormal;



invalid operands to mul

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!