Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw a bitmap on Android using OpenGL

I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.

It seems that OpenGL ES doesn't have a single API that will do, it true?

If true, how can I do this?

PS: Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?

Thank you all!

like image 812
MaratSafinWang Avatar asked Aug 30 '10 01:08

MaratSafinWang


1 Answers

bmp is a really bad format to start off with, you should use png files. They are smaller and offer the same quality. They're also easy to work with using openGL.

You can easily do it in Android. You'll want to look into texture loading. Here's a link: http://qdevarena.blogspot.com/2009/02/how-to-load-texture-in-android-opengl.html

like image 191
Miguel Morales Avatar answered Nov 16 '22 07:11

Miguel Morales