In OpenGL ES 2.0 / GLSL, where do you need precision specifiers?

You don’t need precision specifiers on constants/literals since those get compile time evaluated to whatever they are being assigned to. In vertex shaders, the following precisions are declared by default: ( 4.5.3 Default Precision Qualifiers) precision highp float; precision highp int; precision lowp sampler2D; precision lowp samplerCube; And in fragment shaders you get: precision mediump … Read more

Drawing a border on a 2d polygon with a fragment shader

All you need are the barycentric coordinates, since you are dealing with triangles. Assign each vertex of the triangle an identity, and then use the hardware’s built-in interpolation between the vertex and fragment stages to figure out the relative distance from each of the vertices in your fragment shader. You can think of the barycentric … Read more

How can I do these image processing tasks using OpenGL ES 2.0 shaders?

I just added filters to my open source GPUImage framework that perform three of the four processing tasks you describe (swirling, sketch filtering, and converting to an oil painting). While I don’t yet have colorspace transforms as filters, I do have the ability to apply a matrix to transform colors. As examples of these filters … Read more

How to render Android’s YUV-NV21 camera image on the background in libgdx with OpenGLES 2.0 in real-time?

The short answer is to load the camera image channels (Y,UV) into textures and draw these textures onto a Mesh using a custom fragment shader that will do the color space conversion for us. Since this shader will be running on the GPU, it will be much faster than CPU and certainly much much faster … Read more