5
レンダラーオブジェクトが呼び出されても、が呼び出されないような問題が発生しています。デバッガは、関数内でブレークポイントに到達することはありません。したがって、私の四角形は描画されません。ここにコードがある、あなたが何かを必要とするなら、私が知っている:AndroidでonDrawFrameが呼び出されていない
public class renderer implements GLSurfaceView.Renderer {
Square square;
public void onDrawFrame(GL10 unused) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
square.Draw();
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}
public void onSurfaceCreated(GL10 unused, int width, int height) {
GLES20.glViewport(0, 0, width, height);
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
square = new Square(5, 5);
}
主な活動は次のとおりです。
public class gameActivity extends Activity {
/** Called when the activity is first created. */
private GLSurfaceView mGLView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
staticHolder.context = getApplicationContext();
mGLView = new GLSurface(this);
setContentView(mGLView);
}
@Override
protected void onPause() {
super.onPause();
// The following call pauses the rendering thread.
// If your OpenGL application is memory intensive,
// you should consider de-allocating objects that
// consume significant memory here.
mGLView.onPause();
}
@Override
protected void onResume() {
mGLView.onResume();
}
class GLSurface extends GLSurfaceView
{
renderer r = new renderer();
public GLSurface(Context context)
{
super(context);
setEGLContextClientVersion(2);
setRenderer(r);
setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}
}
}
現在、画面が黒くなります。 OpenGLが正しくレンダリングされない理由はありますか?
プログラム内の他のブレークポイントは機能しますか?あなたが 'glClearColor(1,0,1,1)'をonDrawFrameの最初の行に追加すると、それはまだ黒ですか?他のレンダラーコールバックのいずれかが起動しますか? – Tim
GLES20.glClearColor(1,0,1,1);何もしません –
他のレンダラーコールバックが呼び出されますか? onSurfaceCreatedまたはonSurfaceChanged? – Tim