0

I have a requirement to process large array in my android app and currently it has become performance problem. To solve this my plan is to move the array processing in to GPU. I tried do this using Android Render script but that failed due to various reasons so my question is is there a way to move this calculation to GPU using opengl or OpenGL ES ? if someone can give me a idea to fix this it will be grate help.

here is problematic code

for (int i = 0; i <35000; i += 16)
    {
        int lumOne = in[i];
        lumOne += 128;
        pixelData[lumOne]=pixelData[lumOne]+1;

        int lumTwo = in[i+2];
        lumTwo += 128;
        pixelData[lumTwo]=pixelData[lumTwo]+1;

    }

1 Answer 1

1

To use OpenGL ES 2.0 shader programs for general purpose computing means that your input data set will be supplied encoded into textures to OpenGL ES and that the output data set will be stored (rendered) to a texture attached to an FBO, rather than displayed on-screen. You then have to use glReadPixels() to read that image back into an array that you can use. There are some articles here that can help with using FBOs and glReadPixels().

http://montgomery1.com/opengl/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.