Jump to content
  • Advertisement
Sign in to follow this  
long_xz

how to use glProgramLocalParameter

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

this is my CG program: // flat.cg uniform float4 flatScale : flatScale; uniform float4 dmapScale : dmapScale; float isFlat(float3 a, float3 b, float3 c, float3 d, float disp, float dscale2) { float3 v1, v2; float distance; distance = flatScale.x * (b.z + c.z + dscale2); if (distance < flatScale.y) distance = flatScale.z - distance; distance -= disp; v1 = a + c - 2*b; v2 = b + d - 2*c; return (float) (dot(v1, v1) + dot(v2, v2) < distance*abs(distance)); } float2 cvt(float index) { float2 result; result.y = index; result.x = frac(index)*1024; return result; } float4 main(float4 offsetCoord : TEX0, float4 dstCoord : WPOS, float4 epCoord : TEX1, uniform samplerRECT srcTexMap : TEXUNIT0, uniform samplerRECT epTexMap : TEXUNIT1, uniform samplerRECT offsetTexMap : TEXUNIT2) : COL { float4 s0, s2, s3, s4, s5, s7, s10; float4 srcCoords = dstCoord.xyxy + texRECT(offsetTexMap, offsetCoord.xy); float2 srcCoord = srcCoords.xy; s0 = texRECT(srcTexMap, srcCoord + float2(0, -1)); s2 = texRECT(srcTexMap, srcCoord + float2(-1, 0)); s3 = texRECT(srcTexMap, srcCoord); s4 = texRECT(srcTexMap, srcCoord + float2(1, 0)); s5 = texRECT(srcTexMap, srcCoord + float2(2, 0)); s7 = texRECT(srcTexMap, srcCoord + float2(0, 1)); s10 = texRECT(srcTexMap, srcCoord + float2(0, 2)); if (s0.w > 1) s0 = texRECT(epTexMap, cvt(s0.w)+epCoord.xy); if (s10.w > 1) s10 = texRECT(epTexMap, cvt(s10.w)+epCoord.xy); if (s2.w > 1) s2 = texRECT(epTexMap, cvt(s2.w)+epCoord.xy); if (s5.w > 1) s5 = texRECT(epTexMap, cvt(s5.w)+epCoord.xy); return float2(isFlat(s2.xyz, s3.xyz, s4.xyz, s5.xyz, d.x, d2), isFlat(s0.xyz, s3.xyz, s7.xyz, s10.xyz, d.w, d2)).xyxy; } how to use glProgramLocalParameter to set the parameters "flatScale" and "dmapScale" in my c++ program? or is there any other way to set the parameters? my CG progrma is not use Dynamic loading,i complie it in a .bat file

Share this post


Link to post
Share on other sites
Advertisement
I think you must use 'cgSetParameter*()' though I have not worked on CG. For this, you need to pass a 'CGparameter' which you may get by using either getParameterByName() or getParameterBySemantic(). Since you re using high level shader, this (using named parameters instead of register numbers) looks ideal.

Regards,
KumGame07

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!