New answers tagged

2

I don't know cocos2d, but the general approach to use for this effect is simply to just render the scene at a lower resolution into an offscreen render buffer (VBO, in OpenGL terminology), and then copy that low-resolution image to the screen, with smoothing turned off. (in OpenGL terms, that'd be performing the copy using GL_NEAREST instead of GL_LINEAR). ...


2

There's really not much room for optimization here, having divergent branches over such a small if body is probably not affecting your performance really at all. You could use something like discard which might convey your intention better, but ultimately will not change your performance. Taking from this post, here's an example usage. if (color.a < ...


0

Use the built-in glsl function step to set any alpha value below 0.5 to 0.0. color.a *= step(color.a, 0.5);


0

opengl-tutorial has: a tutorial http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/ focused on energy bars OpenGL 3.3+ WTF licensed code that just works: https://github.com/opengl-tutorials/ogl/blob/71cad106cefef671907ba7791b28b19fa2cc034d/tutorial18_billboards_and_particles/tutorial18_billboards.cpp Screenshot: ...



Top 50 recent answers are included