≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
How send JS variable into HLSL fragmentShader part?
Posted by:
(you are not logged in)
Enter the missing letter in: "In?ernational"
(you are not logged in)
Text:
[quote][b]hadoken[/b] wrote: with "abc" as my sample variable from outside this throws me an "undeclared identifier abc" error: [code]var fragmentShader = "struct PS_OUTPUT \n" + "{ \n" + " float4 RGBColor : COLOR0; \n" + "}; \n" + " \n" + "sampler2D tex0; \n" + "sampler2D tex1; \n" + " \n" + "PS_OUTPUT main( float2 TexCoord : TEXCOORD0, \n" + " float4 Position : POSITION, \n" + " float4 Diffuse : COLOR0 ) \n" + "{ \n" + " PS_OUTPUT Output; \n" + " float4 col1 = tex2D( tex0, TexCoord ); \n" + " float4 col2 = tex2D( tex1, TexCoord ); \n" + " float3 rgb = col2.rgb * col2.a + (1 - col2.a) * col1.a * col1.rgb; \n" + " float alpha = abc; \n" + " Output.RGBColor = float4(rgb,alpha); \n" + " return Output; \n" + "}"; myShaderCallBack = function() { var abc = 0.5; ccbSetShaderConstant(2, 'abc', 0, 0, 0, abc); }[/code] Instead of something like [b]float alpha = 0.5;[/b] I would like to make [b]float alpha = abc;[/b] work. So, how would I have to tell the fragmentShader part to accept my variable "abc" from normal javascript part using the myShaderCallBack function in a correct way? Thanks for any professional help in advance ;-)[/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact