Load texture in multi thread.

Started by chensi, March 25, 2022, 11:57:07

Previous topic - Next topic

chensi

Hello.

I am trying to create my game.

I want to divide thread for render and loading texture.

In main thread, I create new EglContext.

and then, another thread call eglMakeCurrent() using EglContext which i created.

But i faced error.

FATAL ERROR in native method: Thread[Thread-0,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
   at org.lwjgl.opengl.GL11C.nglGenTextures(Native Method)
   at org.lwjgl.opengl.GL11C.glGenTextures(GL11C.java:667)
   at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:2439)
   at com.chensi.pc.PCGL.createTexture(PCGL.kt:158)


Same code is working good in android project.

I don't know what is problem.

Please help!