noskill
Lurker
I have set up a custom GLSurfaceView and its Renderer successfully.
I have another thread that handles the game logic and I would like to be able to dynamically add new objects to the scene.
However, it appears that the OpenGL ES 2.0 GLES20 context only exists in the three methods (onSurfaceCreated, onSurfaceChanged and onDrawFrame) of GLSurfaceView.Renderer class.
How can I use GLES20 functionality in the game thread? If I do this after the Renderer is running...
int shader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
...it will always return the value 0.
If all programs, shaders and hooks must be defined in "onSurfaceCreated()", how is it possible to dynamically add e.g. new objects with hooks (matrix, color etc.) to the scene?
I have another thread that handles the game logic and I would like to be able to dynamically add new objects to the scene.
However, it appears that the OpenGL ES 2.0 GLES20 context only exists in the three methods (onSurfaceCreated, onSurfaceChanged and onDrawFrame) of GLSurfaceView.Renderer class.
How can I use GLES20 functionality in the game thread? If I do this after the Renderer is running...
int shader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
...it will always return the value 0.
If all programs, shaders and hooks must be defined in "onSurfaceCreated()", how is it possible to dynamically add e.g. new objects with hooks (matrix, color etc.) to the scene?