Did you include vShader.glsl and pShader.glsl files in your project ? This example is more of a syntax example than a fully working one. Have a look at shader example projects from gideros example collection.
I've started playing with this. Exciting! Can I confirm that nested sprites are not supported?
If I want to blur a game world, for instance, with hundreds of nested sprites inside, would I have to loop through all sprites and apply the shader to each individual one?
@totebo, probably it's simpler in this case to render the sprite hierarchy to a rendertarget and then apply the shader to this rendertarget only (And add this to the stage, not the sprite hierarchy).
i always imagine rendertarget being the equivalent of merging layers in a painting application. (actually it's of course better then merging as you still have the separate layers as well, not just the merged one).
I just remembered the new Viewport, as maybe a more efficient option. My first test failed, however, so probably not supported. I would need to update the blurred background every frame or so, which is why I'm wondering if RenderTarget is up to the task.
As a side note; the blur works on the desktop player, but not on mobile.
iOS:
FragmentShader: ERROR: 0:12: '*' does not operate on 'vec2' and 'int' ERROR: 0:15: Use of undeclared identifier 'tc' ERROR: 0:16: Use of undeclared identifier 'tc' ERROR: 0:18: '/' does not operate on 'vec4' and 'int'
Android:
FragmentShader: ERROR: 0:12: '*' : wrong operand types no operation '*' exists that takes a left-hand operand of type '2-component vector of float' and a right operand of type 'uniform int' (or there is no acceptable conversion) ERROR: 0:18: '/' : wrong operand types no operation '/' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'int' (or there is no acceptable conversion) ERROR: 2 compilation errors. No code generated.
It feels like I've stumbled on a whole new kettle of fish here, and I feel a little lost.
The above errors happen with this code (from the docs):
Comments
This example is more of a syntax example than a fully working one. Have a look at shader example projects from gideros example collection.
Likes: totebo
PS. May be an idea to mention that in the online reference?
If I want to blur a game world, for instance, with hundreds of nested sprites inside, would I have to loop through all sprites and apply the shader to each individual one?
Likes: totebo
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Fragmenter - animated loop machine and IKONOMIKON - the memory game
iOS:
FragmentShader:
ERROR: 0:12: '*' does not operate on 'vec2' and 'int'
ERROR: 0:15: Use of undeclared identifier 'tc'
ERROR: 0:16: Use of undeclared identifier 'tc'
ERROR: 0:18: '/' does not operate on 'vec4' and 'int'
Android:
FragmentShader:
ERROR: 0:12: '*' : wrong operand types no operation '*' exists that takes a left-hand operand of type '2-component vector of float' and a right operand of type 'uniform int' (or there is no acceptable conversion)
ERROR: 0:18: '/' : wrong operand types no operation '/' exists that takes a left-hand operand of type '4-component vector of float' and a right operand of type 'int' (or there is no acceptable conversion)
ERROR: 2 compilation errors. No code generated.
It feels like I've stumbled on a whole new kettle of fish here, and I feel a little lost.
The above errors happen with this code (from the docs):
Likes: totebo
Likes: totebo
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
Likes: totebo