Using OpenGL from the main thread on Android

后端 未结 1 1151
走了就别回头了
走了就别回头了 2021-02-03 11:40

I would like to call a GLES20 method when an item from the options menu is selected.

public boolean onOptionsItemSelected(MenuItem item) {
    switc         


        
相关标签:
1条回答
  • 2021-02-03 12:02

    I found the answer on my own:

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.clear:
                // GLSurfaceView.queueEvent
                surface.queueEvent(new Runnable() {
                    @Override
                    public void run() {
                        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
                    }
                });
                break;
            // ...
        }
    }
    
    0 讨论(0)
提交回复
热议问题