I use Unity(editor 2020.1.8f1). My application use android native .so
lib that use GLES3
. In order to use it first of all I have done these steps :
first: go to Project Settings >>> Player >>> Other Settings. second: find "Auto Graphic API" and uncheck it. third: Now you can see a new panel just below the "Auto Graphic API". It's a list of "Graphics APIs". Remove all graphics APIs and just add "OpenGLES3".
Then in android CMakeList.txt file I marked that I use GLES3
... target_link_libraries( libcocodec GLESv3 <---------------- THIS LINE decoder_engine_lib $ {log-lib} ) ...
And there is a usage :
void RenderAPI_OpenGLCoreES::EndModifyTexture( void* textureHandle, int textureWidth, int textureHeight, int rowPitch, void* dataPtr, bool destroy) { GLuint gltex = (GLuint)(size_t)(textureHandle); // Update texture data, and free the memory buffer glBindTexture(GL_TEXTURE_2D, gltex); GLenum format = GL_RG; glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, textureWidth, textureHeight, format, GL_UNSIGNED_BYTE, dataPtr); if (destroy) delete[](unsigned char*)dataPtr; }
and error message I get is –
2020-11-08 10:51:46.966 1512-1930/com.co.unityandroidplayer E/Unity: OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_OPERATION: Operation illegal in current state (Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 358)
I assume that something wrong with usage of GLenum format = GL_RG;
, because (just for test) – if I use GLenum format = GL_ALPHA;
I don’t get any errors (as well as expected result). Looks like gles3
doesn’t know what is GL_RG
format.
What am I doing wrong?