Tag Info

New answers tagged

0

As suggested in the comments, the precision directives are not supported in the OpenGL version that haxe/lime compiles to. Adding a #version 130 doesn't work either, maybe haxe or lime doesn't read these I don't know. Anyway I found the solution reading through the lime samples: #if !desktop "precision mediump float;" + #end "varying vec4 v_color; void ...


1

You could start by taking a look at the JavaScript code of that page you've linked to figure out how they did it. I'd guess each line is composed by a lot of tiny rounded dots used as decals. That could explain why the lines look dotted when seen from close. I don't think using decals would be the most efficient technique, but it should be the simplest to ...


2

The discard statement comes in handy. You didn't say too much about your decision path, so I'll offer an example using a simple texture lookup: void main() { gl_FragColor = texture2D(u_texture, v_uv) * u_color; if (gl_FragColor.a <= 0.0) discard; } (That's from some sample code I wrote before I learned about alpha blending.)


7

Yes, you can discard in the fragment shader to avoid writing the pixel. Here's a random example I dug up from Google. Note that this may not actually stop the fragment shader from processing (as the GPU tends to process fragments in blocks; only discarding from all fragments in a block will abandon the processing). But the fragment won't be written to the ...



Top 50 recent answers are included