screen is blinking

Started by Vziuh, December 03, 2011, 12:11:51 PM

Previous topic - Next topic

Vziuh

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:


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


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:



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
}

}








EgonOlsen

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.

Vziuh

#2
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 ?

EgonOlsen

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...

Vziuh