voste Posted July 14, 2017 Share Posted July 14, 2017 Hi , I have problem to pass matrix to uniform variable in shader ! Can anyone tell me what is worng. I try by using "getUniformLocation" but when using this webgl function i get error that i not using current web gl programm. Thanks !!! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 14, 2017 Share Posted July 14, 2017 Try that one, without "value": "ShaderFilter.uniforms.projectionMatrix = getMatrix(180);" Also I do not recommend to change "projectionMatrix", it is used by pixi. Add one more matrix and use "projectionMatrix * myMatrix" inside your shader. EDIT: One more thing: uniforms list can be formed automagically, you dont have to pass it to constructor. But projectionMatrix and some other variables wont be there because they are reserved by pixi itself. Quote Link to comment Share on other sites More sharing options...
voste Posted July 14, 2017 Author Share Posted July 14, 2017 16 minutes ago, ivan.popelyshev said: Try that one, without "value": "ShaderFilter.uniforms.projectionMatrix = getMatrix(180);" Also I do not recommend to change "projectionMatrix", it is used by pixi. Add one more matrix and use "projectionMatrix * myMatrix" inside your shader. EDIT: One more thing: uniforms list can be formed automagically, you dont have to pass it to constructor. But projectionMatrix and some other variables wont be there because they are reserved by pixi itself. It didn't help. Same situation again I passed incorrect matrix to shader and he reports error ! That means that passing matrix to shader works . Do i need something to do to update position of object after shader finish. Or I missing something ! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 14, 2017 Share Posted July 14, 2017 Are you sure that shader was compiled successfully? Are there any errors about it? If you are so sure, make a fiddle (https://fiddle.jshell.net/) and I'll tell you whats wrong with it. Quote Link to comment Share on other sites More sharing options...
voste Posted July 14, 2017 Author Share Posted July 14, 2017 1 hour ago, ivan.popelyshev said: Are you sure that shader was compiled successfully? Are there any errors about it? If you are so sure, make a fiddle (https://fiddle.jshell.net/) and I'll tell you whats wrong with it. https://fiddle.jshell.net/cvjkf9r3/6/ Yes shader is successfully compiled! But when I add filter graphic disappear ! In example when you uncomment "Rect.filters = [ShaderFilter];"(51 line) graphic disappear. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 14, 2017 Share Posted July 14, 2017 https://fiddle.jshell.net/wke8vv3w/ It works. I just added projectionMatrix back and removed "value". Make sure that you read https://github.com/pixijs/pixi.js/wiki/v4-Creating-Filters . Dont forget that filter is using extra framebuffer. If you want to use a shader on sprite instead, look at https://github.com/pixijs/pixi-plugin-example I know both filters and shaders are pain for v4, so I made examples with those two things. Like this post. voste 1 Quote Link to comment Share on other sites More sharing options...
voste Posted July 18, 2017 Author Share Posted July 18, 2017 On 7/14/2017 at 6:11 PM, ivan.popelyshev said: https://fiddle.jshell.net/wke8vv3w/ It works. I just added projectionMatrix back and removed "value". Make sure that you read https://github.com/pixijs/pixi.js/wiki/v4-Creating-Filters . Dont forget that filter is using extra framebuffer. If you want to use a shader on sprite instead, look at https://github.com/pixijs/pixi-plugin-example I know both filters and shaders are pain for v4, so I made examples with those two things. Like this post. Thank you ivan.popelyshev 1 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.