Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting "call to OpenGL ES API with no current context"?

I am new to both openGL and android development so please forgive me if my question is very trivial.

I am trying to build a simple little app that takes input from the user in three EditTexts representing a 0 - 100% value for each component of a RGB color to be displayed in a GLSurfaceView.

The catch is that I need this to use openGL ES 2.0 and I need to pass the data into the shading program using a uniform value so that once I get it working I can move on to what I am really trying to accomplish.

Upon running what I have written I can get the GLSurfaceView to correctly display the first solid color, but whenever I change any of the values and make calls to rebuild the uniform slot in the shading program I get this error in the LogCat:

ERROR/libEGL(14316): call to OpenGL ES API with no current context (logged once per thread)

and of course the GLSurfaceView remains the initial color.

I've been searching all over for a solution to this problem and as best I can tell I might need to be setting up an EGLContext somewhere before setting my renderer. However, I don't see anything in the API demos about this, and the only information I can find online was written before GLSurfaceView was even available.

Do I need to set up an EGLContext still or have I missed something else?


Additional info that may help:

-used an XML file to set up the UI (and as far as I can tell doing it in code doesn't help)

-having the same trouble when I try to load in a new texture from the sd card in a seperate program. I can get the first texture to work fine, but when using the same method to load the second I get the same error and nothing changes.

like image 398
Frank Avatar asked Aug 18 '10 01:08

Frank


1 Answers

You're not calling it from the OpenGL thread. If a different thread is trying to do something with OpenGL, queue that up and call it during your OpenGL thread instead.

like image 184
EboMike Avatar answered Oct 03 '22 16:10

EboMike