Author Topic: screen is blinking  (Read 3750 times)

Offline Vziuh

  • byte
  • *
  • Posts: 13
    • View Profile
screen is blinking
« on: December 03, 2011, 12:11:51 pm »
hi people
i had problem
i need to output blue screen, and everything seems to be ok, but it's blinking =(

here's the link on vido ( i've recorded this blinking )
http://dl.dropbox.com/u/30723020/Video1.avi

thank you in advance for your help

main class:

Code: [Select]
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class Main extends Activity
{

View_container vc = null ;

//=====================================
    public void onCreate(Bundle savedInstanceState)
    {
           super.onCreate(savedInstanceState);
       
           vc = new View_container ( this  ) ;
     
           setContentView( vc.glsv );
    }
}


this is class with GLSurfaceView object

Code: [Select]
public class View_container
{
public GLSurfaceView glsv = null ;

private Renderer      rend = null ;

public View_container ( Context context  )
{
glsv = new GLSurfaceView( context  ) ;

glsv.setEGLConfigChooser(
new GLSurfaceView.EGLConfigChooser()
{
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display)
{
// Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
// back to Pixelflinger on some device (read: Samsung I7500)

int[] attributes = new int[] {
   EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE
};
   EGLConfig[] configs = new EGLConfig[1];
   
   int[] result = new int[1];
   egl.eglChooseConfig(display, attributes, configs, 1, result);
   
   return configs[0];
}
}
   );

rend = new Renderer () ;

glsv.setRenderer( rend ) ;   
}
}



render class:

Code: [Select]

public class Renderer implements GLSurfaceView.Renderer
{

private FrameBuffer fb = null ;

@Override
public void onDrawFrame(GL10 gl)
{
fb.display() ;
}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height)
{
fb = new FrameBuffer  ( gl , width , height ) ;
fb.clear( new RGBColor ( 75 , 150 , 225 ) ) ;
}

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
// TODO Auto-generated method stub
}

}







Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: screen is blinking
« Reply #1 on: December 03, 2011, 07:58:15 pm »
It blinks, because that is what you've coded. Keep in mind that you have double buffering, i.e. one frame is visible while the hidden frame will be drawn to. After onDrawFrame(), the frames will switch. You clear one frame with some shade of blue, the other one will be black and because you are not doing anything in onDrawFrame(), you constantly switch between a blue and a black screen...and that's what you see.

Offline Vziuh

  • byte
  • *
  • Posts: 13
    • View Profile
Re: screen is blinking
« Reply #2 on: December 04, 2011, 09:10:41 am »
thx for reply

i didn't know that if i won't call gl function, the frame will be drawn anyway.
is there any methods to output only one framebuufer, FrameBuffer object from jPCT-AE ?
« Last Edit: December 04, 2011, 09:58:41 am by Vziuh »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: screen is blinking
« Reply #3 on: December 04, 2011, 08:47:15 pm »
The switching isn't part of jPCT-AE, it's part of the GLSurfaceView.Renderer. You can modify it's update behaviour from continuously to on demand, but i can't remember how ATM. Searching the Android docs should help to find out...

Offline Vziuh

  • byte
  • *
  • Posts: 13
    • View Profile
Re: screen is blinking
« Reply #4 on: December 05, 2011, 02:38:06 pm »
thanks alot