GNOME Bugzilla – Bug 740239
glshader receives no input from the pipeline
Last modified: 2014-11-17 18:46:30 UTC
When using glshader, you can output image but there is no input. Does it still expect the (deprecated) glupload? This gives black image, though it should be a zero effect and just output the input. gst-launch-1.0 videotestsrc ! video/x-raw, width=1280, height=720 ! glshader location=minimal.frag ! glimagesink Where minimal.frag is: #extension GL_ARB_texture_rectangle : enable uniform sampler2DRect tex; void main() { gl_FragColor = texture2DRect(tex, gl_TexCoord[0].xy); } This (correctly) gives blue image: gst-launch-1.0 videotestsrc ! video/x-raw, width=1280, height=720 ! glshader location=blue.frag ! glimagesink Where blue.frag is: #extension GL_ARB_texture_rectangle : enable uniform sampler2DRect tex; void main() { gl_FragColor = vec4(0,0,255,1.0); } This just works like it should: gst-launch-1.0 videotestsrc ! video/x-raw, width=1280, height=720 ! gleffects effect=4 ! glimagesink sync=false
(In reply to comment #0) > When using glshader, you can output image but there is no input. Does it still > expect the (deprecated) glupload? > > This gives black image, though it should be a zero effect and just output the > input. > > gst-launch-1.0 videotestsrc ! video/x-raw, width=1280, height=720 ! glshader > location=minimal.frag ! glimagesink > > Where minimal.frag is: > #extension GL_ARB_texture_rectangle : enable > uniform sampler2DRect tex; > void main() { > gl_FragColor = texture2DRect(tex, gl_TexCoord[0].xy); > } > > > This (correctly) gives blue image: > gst-launch-1.0 videotestsrc ! video/x-raw, width=1280, height=720 ! glshader > location=blue.frag ! glimagesink > > Where blue.frag is: > #extension GL_ARB_texture_rectangle : enable > uniform sampler2DRect tex; > void main() { > gl_FragColor = vec4(0,0,255,1.0); > } None of the gl elements use rectangle textures anymore and the use of gl_TexCoord[i] references the fixed function pipeline which is also not supported. The use of integers in the vec4 definition are also not spec compliant (which suggests you have an nvidia card) and are clamped to the [0.0f, 1.0f] range anyway. Try going with: #ifdef GL_ES precision mediump float; #endif varying vec2 v_texcoord; uniform sampler2D tex; uniform float time; uniform float width; uniform float height; void main () { gl_FragColor = texture2D(tex, v_texcoord); }
Ok! This works! Thanks! Will blog about it soon. It's a matter of documentation now. I googled like crazy, but could not find this.