Why am I getting an “OpenGL ES API call without the current context”?

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

I am trying to create a simple small application that introduces the user from the user into three EditTexts representing 0 - 100% value for each component of the RGB color displayed in GLSurfaceView.

The trick is that I need to use openGL ES 2.0, and I need to pass the data to the shader using a single value, so that as soon as I get it working, I can go on to what I'm really trying to accomplish.

After running what I wrote, I can get GLSurfaceView to correctly display the first solid color, but whenever I change any of the values ​​and make calls to restore a single slot in the shader, I get this error in LogCat:

ERROR / libEGL (14316): OpenGL ES API call without current context (registered once per thread)

and, of course, GLSurfaceView remains the original color.

I’ve been looking for a solution to this problem all the time, and as far as I can tell, I will need to configure EGLContext somewhere before installing my visualizer. However, I don’t see anything in the API demos about this, and the only information I can find on the Internet was written before GLSurfaceView was even available.

Do I still need to configure EGLContext or am I missing something else?


Additional information that may help:

-used XML file for customizing the user interface (and as far as I can tell about this in the code it does not help)

- the same problem occurs when I try to load a new texture from an SD card in a separate program. I can make the first texture work fine, but when using the same method to load the second, I get the same error and nothing changes.

+4
source share
1 answer

You do not call it from an OpenGL thread. If another thread is trying to do something with OpenGL, set up a queue and call it during the OpenGL thread.

+10
source

All Articles