kuuuurija Posted August 2, 2016 Share Posted August 2, 2016 Hi, I am playing with Shaders (filters). Below is my shader code I am not able to swizzle rgba values (https://www.opengl.org/wiki/GLSL_Optimizations). Can someone help? precision mediump float; varying vec2 vTextureCoord; varying vec4 vColor; uniform sampler2D uSampler; uniform float customUniform; void main(void) { vec2 uvs = vTextureCoord.xy; vec4 fg = texture2D(uSampler, vTextureCoord); // THIS doesn't work // fg.rg = 0.0; fg.r = 0.0; fg.g = 0.0; gl_FragColor = fg; } Quote Link to comment Share on other sites More sharing options...
kuuuurija Posted August 2, 2016 Author Share Posted August 2, 2016 my bad .. it works Should typecast to vec2 fg.rg = vec2(0.0); 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.