0
我學習的OpenGL Android上。我已經寫在GlSurfaceView在佈局XML聲明的應用程序(片段...)GlSurfaceView渲染器不會被調用
<FrameLayout
android:id="@+id/framelay"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.nelsondev.myha3ogl.M3View
android:id="@+id/m3SurfView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
...並在其構造的渲染器設置:
public M3View(Context context, AttributeSet attrs) {
super(context, attrs);
renderer = new M3Renderer(context);
setRenderer(renderer);
}
當活動收到onResume/onPause它正確調用GlSurfaceView方法。 但是渲染器從未開始!在斷點onSurfaceCreated()和渲染等方法永遠不會被擊中,並沒有什麼渲染。我怎麼知道這裏發生了什麼?
其實,我只是檢查,我想我的回答你剛纔的問題是錯誤的,實際上,啓動()被調用的GLSurfaceView時首先佈局(即當你調用`的setContentView(framelay)`或`的setContentView(R.layout.graphics)`與GLSurfaceView爲/ framelay的孩子在文件graphics.xml),而不是當'setRenderer`被稱爲 – 2011-12-14 14:01:18