hashi Posted June 9, 2014 Share Posted June 9, 2014 How to know about position of sprite in fragment shader program? I can pass data to shader as uniforms, but it happens only once, when filter is created. I need to know, always current, position of sprite in shader program. Also depending on it, pass appropriate textures. Quote Link to comment Share on other sites More sharing options...
xerver Posted June 10, 2014 Share Posted June 10, 2014 You can update the uniforms at any time, including the updateTransform method. hashi 1 Quote Link to comment Share on other sites More sharing options...
hashi Posted June 14, 2014 Author Share Posted June 14, 2014 Also is it possible to add new uniforms any time? I'm gonna send array to shader and create uniforms like this:this.uniforms = { "some_array[0]" : {type: "1i", value: 0}, "some_array[1]" : {type: "1i", value: 0} };and later:this.uniforms["some_array[2]"] = {type: "1i", value: 2};and then always update uniform that say about length of this array too. EDIT: Ha! It works! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.