Why FloatBuffer instead of float[]?

The main reason is performance: ByteBuffers and the other NIO classes enable accelerated operations when interfacing with native code (typically by avoiding the need to copy data into a temporary buffer). This is pretty important if you are doing a lot of OpenGL rendering calls for example. The reason for creating a ByteBuffer first is … Read more

Should I ever use a `vec3` inside of a uniform buffer or shader storage buffer object?

NO! Never do this! When declaring UBOs/SSBOs, pretend that all 3-element vector types don’t exist. This includes column-major matrices with 3 rows or row-major matrices with 3 columns. Pretend that the only types are scalars, 2, and 4 element vectors (and matrices). You will save yourself a very great deal of grief if you do … Read more

Android OpenGL Texture Compression

There are mainly four texture compression types supported on Android: ETC1 (Ericsson texture compression). This format is supported by all Android phones. But, it doesn’t support an alpha channel, so can only be used for opaque textures. PVRTC (PowerVR texture compression). Supported by devices with PowerVR GPUs (Nexus S, Kindle fire, etc.). ATITC (ATI texture … Read more

Subtract Blend Mode using ColorMatrixFilter in Android?

Long story short There is no subtract color blending out of the box in the Android SDK, however you still can make it work with use of OpenGL rendering API. Here you can find the implementation of such a solution, incapsulated in the BlendingFilterUtil class, which can be used like this: BlendingFilterUtil.subtractMatrixColorFilter(bitmap, new float[]{ 0.393f, … 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

GLSurfaceView inside fragment not rendering when restarted

Here’s how I have my GLSurfaceView setup in a fragment: onCreateView() { glSurfaceView = new GLSurfaceView(getActivity()); … } onPause() { if (glSurfaceView != null) { glSurfaceView.onPause(); } … } onResume() { if (glSurfaceView != null) { glSurfaceView.onResume(); } … } } So, similar to what you’d do in an activity. This works in my use … Read more

Rendering SVG with OpenGL (and OpenGL ES)

My answer is going to about displaying vector graphics wtih OpenGL in general, because all solutions for this problem can support rather trivially SVG in particular, although none support animated SVGs (SMIL). Since there was nothing said about animation, I assume the question implied static SVGs only. First, I would not bother with anything OpenVG, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)