1

誰かがこれを手伝ってくれることを願っています.Opengl es 2.0でライブ壁紙を開発しています. 1箇所を除いて大丈夫です。ユーザーが画面に触れると、その特定のポイントに新しいオブジェクトが表示されるようにします。しかし、私はそれを機能させることができません。

これがレンダラーの私のコードです

    public class Renderer implements GLSurfaceView.Renderer 
{

     private final Context mActivityContext;

     private float x = 0;

     private float y = 0;

     private Object mObject;

    public Renderer(final Context activityContext){ 

    mActivityContext = activityContext;

}

public void onSurfaceCreated(GL10 glUnused, EGLConfig config){


        if (mObject!=null){

            //code below initiates textures and shaders
        mObject.onSurfaceCreated(mActivityContext);

        }

            //view matrix code goes here

}

public void onSurfaceChanged(GL10 glUnused, int width, int height)  {

//setup projection matrix

}

public void onDrawFrame(GL10 glUnused) {


    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

     if (mObject!=null){

     mObject.drawParticle();

     mObject.update();





                }

}

 public void onTouchEvent(MotionEvent me) {

        if (me.getAction() == MotionEvent.ACTION_DOWN) {
        x = me.getX();
        y = me.getY();

        //add new object 
        mObject = new Object (x,y);


}

}
}

画面をタッチしても何も起こりません (オブジェクトが追加されません)。私は何を間違っていますか?

どうぞよろしくお願いいたします。

4

0 に答える 0