我的應用程序中有2個GLSurfaceViews(android,opengles 2.0)。其中兩個重疊,所以我可以使用它的頂部作爲預覽。我的問題是,當我啓動應用程序時,頂部glsurfaceview的內容消失了(我設置了與背景glview不同的背景顏色,因此我可以在短時間之後區分內容消失或整個GLview)。我不知道從哪裏開始尋找問題。我的代碼如下。GLThread或GLSurfaceview重疊問題?
在此先感謝。
package jp.android.MyProject;
import android.app.Activity;
import android.widget.TextView;
import android.view.ViewGroup.LayoutParams;
import android.os.Bundle;
public class MyProjectActivity extends Activity {
MyOpenGLView myGLView;
PreviewGLView previewView;
private int sizeofPreview = 300;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
myGLView = new MyOpenGLView(this);
setContentView(myGLView);
myGLView.requestFocus();
myGLView.setFocusableInTouchMode(true);
previewView = new PreviewGLView(this);
addContentView(previewView,new LayoutParams(sizeofPreview, sizeofPreview));
previewView.setBackgroundColor(0xFF000000);
myGLView.textWindow = new TextView(this);
addContentView(myGLView.textWindow,new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
myGLView.touchWindow = new TextView(this);
addContentView(myGLView.touchWindow, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
myGLView.touchWindow.setY(600.0f);
}
@Override
protected void onResume(){
super.onResume();
myGLView.onResume();
previewView.onResume();
}
@Override
protected void onPause(){
super.onPause();
myGLView.onPause();
previewView.onPause();
}
}