Implement multiple OpenGL context for background texture loading.
I am in the middle of developing a GearVR Android application, and a native demo app has already built.
In the native app, I used a technique which is described here, since we are handling very large jpg (8k, on local disk) files as textures:
http://higherorderfun.com/blog/2011/05/26/multi-thread-opengl-texture-loading/
By using this technique, when updating textures after everything is ready, the frame rate drop is almost non-noticeable.
However, in Unity, we can not find any similar solution of it, and whenever we drop a new image to display using Texture.LoadImage(), the screen will freeze for seconds, which is not acceptable.
We have some experience of writing native plugin for Unity3d, so if this is the only way out, we will definitely give it a try.
Any suggestion on this will be much appreciated.
Answer by WisockiJr · Jul 03, 2016 at 11:44 AM
I just found the solution for this so awaited feature on Unity3D. besides Unity saying it is not possible to load a texture of this size without blocking the main thread, I found a component that does just that, it is EasyMovieTexture, the component is great and is one huge sucess on unity store, in fact the solution for the problem I found in the 'editor mode' workaround that the component bring to us, it uses ffmpeg to show video frames on Unity, and as we can see, it decodes 4K videos frame by frame and updates a texture, almost 60 times per second, it is amazing, it does a trick that uses the rendering thread to upload the texture, so the main thread is not used at all. But we still need to compile a c++ dll that decode our .jpg in another thread, but thats easy. I have been looking for this solution for years, since Unity 3, we use Vuforia for augmented reality applications, and now Unity 5 is the big player in Virtual Reality, (so Unity must stop saying it is a game engine, it is now the most important VR Application Engine in the market), for me its the future. Let me solve this and then I will send you a sample. thanks to JaeYunLee
Did you ever figure out a way to perform this? I'm working on something similar and it would be a god send if you can help me out!
Your answer
Follow this Question
Related Questions
Problems sharing textures with plugin in Unity 5 0 Answers
creating plugin for android 0 Answers
Unity Android GameObject stop updating after onActivityResult 0 Answers
need help making background texture partially transparent 1 Answer
Hello.I use the Region Capture to create the coloring of augmented reality. 0 Answers