1
Graphics / Re: fragment shader question
« on: December 24, 2015, 07:32:06 pm »
Hapax, you were right:) it works like a charm, simple and elegant.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
auto foo = target.mapCoordsToPixel(_pos);
_shader.setParameter("posx", foo.x);
_shader.setParameter("posy", foo.y);
and in shader I use:uniform float width;
uniform float height;
uniform float posx;
uniform float posy;
void main(void) {
vec2 position = vec2(posx, posy) / vec2(width, height);
//...
and have unpleasant results.
gl_FragCoord is an input variable that contains the window relative coordinate (x, y, z, 1/w) values for the fragment., therefore I guess it won't work in my scenario, because the rectangle's position uses absolute world coordinates. These are the two different things. Please correct me if I am wrong.