Jump to content

position of sprite in shader


Recommended Posts

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.

Link to comment
Share on other sites

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.




Ha! It works!

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...