Author Topic: framebuffer getPixels()  (Read 9676 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: framebuffer getPixels()
« Reply #30 on: July 03, 2012, 12:15:15 pm »
I'm not sure if i'm still able to follow...

  • S2 and S3 both render black cars when using the custom shader
  • S2 problem goes away if you don't use the custom shader but the default ones of jPCT-AE
  • S3 problem doesn't go away when you disable the shader (100% sure?)
  • S2 problem goes away when updating to Android x.y (which?)


It that correct?

Offline MrAdam

  • int
  • **
  • Posts: 51
    • View Profile
Re: framebuffer getPixels()
« Reply #31 on: July 03, 2012, 01:01:04 pm »
I'm not sure if i'm still able to follow...

  • S2 and S3 both render black cars when using the custom shader
  • S2 problem goes away if you don't use the custom shader but the default ones of jPCT-AE
  • S3 problem doesn't go away when you disable the shader (100% sure?)
  • S2 problem goes away when updating to Android x.y (which?)


It that correct?

S3 is always black, no matter what shader is used/not used.
S2 is always black, no matter what shader is used/not used, except on some versions of Android.
I haven't been able to confirm which versions though :-/

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: framebuffer getPixels()
« Reply #32 on: July 03, 2012, 01:07:41 pm »
S2 is always black, no matter what shader is used/not used, except on some versions of Android.
But then i don't understand this post: http://www.jpct.net/forum2/index.php/topic,2088.msg20457.html#msg20457  ???

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: framebuffer getPixels()
« Reply #33 on: July 03, 2012, 01:12:38 pm »
And please try to add

Code: [Select]
precision highp float;

to the fragment and the vertex shader to see if that changes anything...

Offline MrAdam

  • int
  • **
  • Posts: 51
    • View Profile
Re: framebuffer getPixels()
« Reply #34 on: July 03, 2012, 01:49:51 pm »
And please try to add

Code: [Select]
precision highp float;

to the fragment and the vertex shader to see if that changes anything...
Already tried that when you suggested it in the other thread ;-)
Didn't make a difference

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: framebuffer getPixels()
« Reply #35 on: July 03, 2012, 02:16:09 pm »
Could you please try to disable all custom shaders AND the light sources (and maybe adjust the ambient light)? I never got any reports that the default shaders have problems on Mali GPUs, so find it hard to believe that they should also suffer from this problem.
I also would like to know (as posted above), how this fits into the whole issue: http://www.jpct.net/forum2/index.php/topic,2088.msg20457.html#msg20457
 
If everything fails, i would try to disable GL20 support and revert to 1.1 to see if that helps.

Offline mxar

  • int
  • **
  • Posts: 73
    • View Profile
Re: framebuffer getPixels()
« Reply #36 on: September 24, 2014, 10:59:49 pm »
Hi,

can anybody help me?

I call the following code :

int[] tmpPixels = frameBuffer.getPixels();

renderImage = Bitmap.createBitmap(tmpPixels, frameBuffer.getWidth(), frameBuffer.getHeight(), Config.ARGB_8888);

When i try to load the renderImage Bitmap in ImageView ( calling imageView.setImageBitmap(renderImage))

i see only a black rectangular.


Thanks in advance




Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: framebuffer getPixels()
« Reply #37 on: September 25, 2014, 08:20:47 am »
At which stage are you grabbing the pixels and which render mode are you using (OpenGL ES 1.x or 2.0)? And which device?

Offline mxar

  • int
  • **
  • Posts: 73
    • View Profile
Re: framebuffer getPixels()
« Reply #38 on: September 25, 2014, 09:03:13 am »

Hi,

I use opengle 1.x

I use the following code to build a bitmap from FrameBuffer:

The FrameBuffer is resized to  128x128.

The Bitmap renderImage  is used as a bitmap for an ImageView view.


   public void onDrawFrame(GL10 gl) {
      
      coinObject3D.rotateY((float) (Math.PI/180.0f));
      cube.rotateY((float) (Math.PI/180.0f) * -1);
      
      //cube.translate(x, y, z)
      prevXRot  = xrot;
      prevYRot  = yrot;
      prevZRot  = zrot;
      
            
      fb.clear(back);
      int w = fb.getWidth();
          int h = fb.getHeight();
      
    
       world.renderScene(fb);
      
       int[] tmpPixels = fb.getPixels();
      
       
        renderImage = Bitmap.createBitmap(tmpPixels, fb.getWidth(), fb.getHeight(), Config.RGB_565);

       Log.d("TAG", "width = "  + fb.getWidth());
      Log.d("TAG", "height = " + fb.getHeight());
      
      world.draw(fb);
      
      //fb.runPostProcessors();
      fb.display();
      
      

      if (System.currentTimeMillis() - time >= 1000) {
         Logger.log(fps + "fps");
         fps = 0;
         time = System.currentTimeMillis();
      }
      
      fps++;
   }


Thanks in advance


Offline mxar

  • int
  • **
  • Posts: 73
    • View Profile
Re: framebuffer getPixels()
« Reply #39 on: September 25, 2014, 09:05:30 am »

Sorry,

I forgot to say that i use NEXUS 5.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: framebuffer getPixels()
« Reply #40 on: September 25, 2014, 10:08:18 am »
That's too early... move the call to after the call to display and try again.

Offline mxar

  • int
  • **
  • Posts: 73
    • View Profile
Re: framebuffer getPixels()
« Reply #41 on: September 25, 2014, 11:22:37 am »

it works.

thanks