framebuffer getPixels()

Started by haijin, May 27, 2011, 09:38:36 PM

Previous topic - Next topic

EgonOlsen

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?

MrAdam

Quote from: EgonOlsen 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?

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 :-/

EgonOlsen

Quote from: MrAdam on July 03, 2012, 01:01:04 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  ???

EgonOlsen

And please try to add


precision highp float;


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

MrAdam

Quote from: EgonOlsen on July 03, 2012, 01:12:38 PM
And please try to add


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

EgonOlsen

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.

mxar

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




EgonOlsen

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?

mxar


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


mxar


Sorry,

I forgot to say that i use NEXUS 5.

EgonOlsen

That's too early... move the call to after the call to display and try again.

mxar