New answers tagged

0

Well, i just figured it out - i just set uniform samplers variables incorrectly.


9

I came back to this today and after some more investigation and trial and error I discovered that the culprit was targetTexture. With some more investigation I learned that reading and writing to the same texture in a shader is bad practice (not surprisingly) and will cause undefined behavior on GPUs. The solution was to copy the target texture to a new ...


0

To fix the aspect ratio (and speed up the shader a bit): void main() { vec2 diff = (v_position + 1.0) * 0.5 - u_mousePosition; diff.x *= u_aspect; // e.g.: (16.0 / 9.0) for 16:9 float distance = dot(diff, diff); // square of distance, saves a square-root if(distance > u_lightRadius_squared)) { discard; } outColor = ...


0

Although according to the OpenGL standard you should be allowed to specify whichever location you want, some drivers have specific locations for legacy uses. Specifying locations may cause conflicts with those. For example: https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/attributes.php NVidia hardware indices are reserved for built-in ...


0

Ok so I've discovered that if I remove the layout qualifiers from the input/output blocks, like this out VS_OUT_GS_IN { vec3 pos; vec3 normal; vec2 texc; } vs_out; and like this in the geometry shader in VS_OUT_GS_IN { vec3 pos; vec3 normal; vec2 texc; } gs_in[]; it produces the expected results. But why does it not work ...


0

It would appear omiting the loop init statement is not formally supported by GLSL, although probably widely implemented. Here is a link to someone else having similar problem: https://bugs.chromium.org/p/angleproject/issues/detail?id=140 I did an honest attempt reading the GLSL grammar section but was unable to make much sense of it. Some token ...


1

The screen coords go from {-1,-1} to {1,1} but you are most likely feeding it {0,0} to {1,1} - hence the fact that only one-quarter of the screen gets rendered. So just to be clear - point {0,0} is not the top-left (or bottom-left, depending on your co-ordinate system) point; it's the center. This also explains the texture coord tranformation that you are ...



Top 50 recent answers are included