New answers tagged optimization
step is what you are really looking for. step(0.0, back): = 1.0 if (0 < back), or 0.0 otherwise. So the lines become: lowp float aux = step(0.0,back); lowp vec4 color = (1.0-aux) * frontdiffuse + aux * back_diffuse; For a more elegant (and maybe optimized) version with mix: lowp vec4 color = mix(frontdiffuse, back_diffuse, step(0.0,back));
Keep the array free of dead creatures. Here is the API for manipulating arrays. See removeObjectAtIndex You can iterate once over all living creatures and check if their distance from each tower is smaller than the range of the tower. If so decide on the factor you wish to pick the target by. Normally towers pick the target that is closest to the objective. ...
Normally branches dependent on uniforms get handled by the driver. It is possible that a directX layer handles this even before the driver but it is not documented and pure speculation. I have noted using AMD drivers that changing a uniform to the point of that one branch will start to be taken, the first time this happens I can get a severe lockup of the ...
Some things you can try: Don't use a separate position buffer. Instead reconstruct position from the depth buffer (bound as a texture). Use GL_RG10_A2 for your normal buffer. This is half the size of GL_RGB16F and should provide enough accuracy. GL_RGBA8 should provide enough accuracy for your albedo buffer. It should be fairly quick to try different depth ...
Top 50 recent answers are included