80,351
社区成员
发帖
与我相关
我的任务
分享
public class ActivityTexture extends Activity {
private GLSurfaceView glSurfaceView;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.glSurfaceView = new GLSurfaceView(this);
this.glSurfaceView.setRenderer(new TextureRenderer());
setContentView(this.glSurfaceView);
}
}
//----------------------------------------------
public class TextureRenderer implements GLSurfaceView.Renderer {
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
//gl.glClear(GL10.GL_COLOR_BUFFER_BIT);//放在这里就会频闪
}
@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
}
@Override
public void onDrawFrame(GL10 gl) {
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);//放在这里就不会频闪
}
}