SFML community forums
Help => Graphics => Topic started by: Haikarainen on October 14, 2011, 02:02:24 am
-
So I noticed you can't draw shapes using shaders, or they just wont draw. Why is this? This is a huge drawback for me, aesthetically speaking.
If I missed something; I try to render them on a RenderTexture (since I also have fullscreen shaders), wich I then draw on the RenderWindow. This works perfectly using Textures and Sprites, but not Shapes unless I decide to draw those perticular Shapes without shaders.
Also I'm drawing Circles and Lines
-
It should work, as long as you remember that shapes have no texture.
Can you show the shader that you use?
-
Well that's kinda obvious heh, I should've known since i use gl_TexCoord and such. Full shader is below. I guess it would be possible to cache the shapes into textures by rendering them on a rendertexture?
That'll just leaves the problem with the lines. (I'm actually drawing a path with pathnodes represented as circles, and lines between them)
uniform sampler2D screen;
uniform float time;
uniform float divider;
void main(){
vec2 offset = vec2(cos(time/500+gl_TexCoord[0].x*10)/divider, sin(time/500+gl_TexCoord[0].y*10)/divider);
gl_FragColor = vec4(texture2D(screen, gl_TexCoord[0].xy+offset));
}