Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - ScienceHill

Pages: [1]
Support / Will serialization decrease the faces of a .obj file?
« on: December 13, 2017, 11:14:36 pm »
Hello. Suppose I have an .obj file which has 10,000 faces (polygons). After I serialized it with the jPCT-AE Mesh Serializer at here: , I got a .ser file. And I can render it on my Android phone. I just wonder whether the number of faces of this .ser file is also 10,000? In other words, will the number of faces of the .obj model decrease after serialization? Thanks in advance.

Support / Re: How can I get a bitmap from fb.getpixel()?
« on: December 02, 2017, 11:55:58 pm »
Thank you for your reply! And I had figured out why it didn't work. You are right. My frame buffer was empty. To solve this problem, I just put the getPixels() method in the onDrawFrame like this:
public int[] tmpPixels;// Global variance
public void onDrawFrame(GL10 gl) {
            tmpPixels = fb.getPixels();

Then I convert the int array (tmpPixels) to bitmap and save it in my dispatchKeyEvent like this way:
                if (action == KeyEvent.ACTION_DOWN) {
                    Bitmap lastImage = Bitmap.createBitmap(fb.getWidth(), fb.getHeight(), Bitmap.Config.ARGB_4444);

                    File sdCard = Environment.getExternalStorageDirectory();
                    File dir = new File (sdCard.getAbsolutePath() + "/my_jpg_test");
                    Log.i("JPCT","My File path" + sdCard.getAbsolutePath() + "/my_jpg_test");

                    String fileName = String.format("The.jpg");
                    File outFile = new File(dir, fileName);
                    FileOutputStream outputStream = null;
                    try {
                        outputStream = new FileOutputStream(outFile);
                        int quality = 100;
                        lastImage.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);

                    } catch (FileNotFoundException e) {
                    } catch (IOException e) {
And it works!
By the way, obviously, the program becomes extremely slow by using tmpPixels to record the pixel of image on onDrawFrame in this way. Of course I will use some flags to control this process. Thanks again!

Support / How can I get a bitmap from fb.getpixel()?
« on: November 29, 2017, 06:41:28 am »
Hello. Currently I am trying to take a screenshot use fb.getpixel() function. And here is my code:
int[] my_pixels = fb.getPixels();
Bitmap bitmap = Bitmap.createBitmap(fb.getWidth(), fb.getHeight(), Bitmap.Config.ARGB_4444);
But I just got a black image. And I also tried this:
int[] tmpPixels = fb.getPixels();
for (int i = 0; i < tmpPixels.length; i++){
   int tmpInt = ((tmpPixels & 0xf8) >> 3);
   tmpInt += ((tmpPixels & 0xfc00) >> 5);
   tmpInt += ((tmpPixels & 0xf80000) >> 11);
  tmpPixels = tmpInt;
Bitmap lastImage = Bitmap.createBitmap(tmpPixels, fb.getWidth(), fb.getHeight(), Bitmap.Config.RGB_565);
But it still did not work. I know that the fb.getPixels() function return an int array. And it contains R, G and B channels value. But how can I actually use it? Any answer is appreciated and thanks in advance.

Pages: [1]