Tag Info

New answers tagged

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 ...


2

It is typical to use a 32-bit depth-buffer: GL_DEPTH_COMPONENT32F //internal format GL_DEPTH_COMPONENT //depth only GL_FLOAT //float(32-bit depth) If you also wish to utilize the stencil buffer, it is typical to dedicate 8 of those 32-bits to the stencil: GL_DEPTH24_STENCIL8 //internal format GL_DEPTH_STENCIL //depth + stencil ...


0

By speculation - this is what it looks like to me. The arrows seem to, as others say, have an extra variable to determine their height. It looks like an X and Y velocity of the dart might be determined by the direction and power of the power bar, with a predetermined height. I'm not sure if the darts are shot at an upward angle. If not then the flight time ...



Top 50 recent answers are included