- Home /
Native rendering plugin OpenGL device type not being set.
The example project at http://docs.unity3d.com/Manual/NativePluginInterface.html doesn't work for me with the OpenGL Core profile selected, using Unity 5.2.1f1. The texture does not get updated from the plugin. Is OpenGL Core supported in the new native plugin interface?
Further, I've noticed in my own RenderingPlugin that the device type is not being set when using OpenGL.
s_DeviceType = s_Graphics->GetRenderer();
returns '4', which corresponds with 'kUnityGfxRendererNull', not 'kUnityGfxRendererOpenGL'.
Everything working as expected in D3D11. Has anyone else had similar issues?
Thanks
I am experiencing the exact same behaviour when testing on android devices.
I tested to set the s_DeviceType manually, as i know my testing hardware device is opengles2.0 and the texture gets updated but the triangles won't show up.
Answer by TomasJ · Oct 19, 2015 at 10:41 AM
Error in Unity code base. Will fix asap. Bug reference 737451.
Thanks for the reply and confir$$anonymous$$g this bug. I will wait for 5.3.
You can nevertheless use and do something in the plugin if you know which platform you are on, as the "device" is just an enumerator variable for OpenGl and OpenGlES. You could even pass the plattform from your unity code via a custom function to the plugin.
Still the same on Unity 5.3. Android rendering doesn't work. The example doesn't work on $$anonymous$$ac anymore either (though it did with 5.2.1p3). I need a way to render to unity texture using android 's mediaplayer video stream as a source and the example actually gives the approach to accomplish this. Except it's not working. Any chances to make it work?
The native plug in example as been updated. There is a bug with the current manual pages which point to the example for 5.2. It's being fix.
I have updated the native plug in example with OpenGL core support here: https://oc.unity3d.com/index.php/s/z3IlBy4A7v4tgQ4
Thanks a lot for your quick response and for the link. The project from the link works fine for mac however it still doesn't render a "plasma" effect nor drawing a triangle for android build (running on Nexus 5.1 Lollipop). Do you think there are any working examples for android on how to perform rendering from native plugin? Thanks again
Answer by groovounet · Oct 19, 2015 at 10:41 AM
OpenGL core in 5.2 doesn't support the RenderingPlugin. It's being fixed for 5.3.
Thanks, Christophe
The updated native plug-in example for Unity 5.3 is available here: https://oc.unity3d.com/index.php/s/z3IlBy4A7v4tgQ4
Though the above attached example still returns kUnityGfxRendererNull for s_Graphics->GetRenderer() call on Unity 5.3 for android devises, I was able to make it render the triangle by setting s_DeviceType to kUnityGfxRendererOpenGLES20 manually AND setting 'Graphics APIs' to OpenGLES2 only (removed OpenGLES3) under Unity 'Player Settings' The next issue however is that the triangle disappears again once 'Virtual Reality supported' tick is checked to run the build for GearVR. Any chances to make it work for android in VR (I'm using Samsung Galaxy S6 in case it makes any difference)
$$anonymous$$y final goal is to render 2D movie to GearVR using external texture to render video to and a unity side texture which is bound to FBO to copy the external texture to display frames further. To make it work it's essential to be able to perform glDrawArrays/Elements. Probably there is another way to accomplish it though. If anyone has an idea or is able to share a working example, it would help greatly (it should be open source without any kind of precompiled so/jars/etc though)
Though s_Graphics->GetRenderer() still returns kUnityGfxRendererNull on Unity 5.3 using the attached example above for andorid, I was able to make it render the triangle on Samsung Galaxy S6 by manually setting s_DeviceType = kUnityGfxRendererOpenGLES20 AND setting Graphics APIs to OpenGLES2 only (removed OpenGLES3) in Unity 'Player Settings' The next issue however is that the triangle disappears once 'Virtual Reality supported' tick is checked to use the build with GearVR. Any chances to render the triangle in VR?
$$anonymous$$y final goal is to be able to render a 2D video from android plugin to GearVR using external texture with a movie frame and destination texture bounded to a FBO - to make it work it's essential to be able to perform glDrawArrays/Elements which is not working according to the sample app. Probably there is a better way to do this? If anybody has a link to a working example which is open source (without any kind of precompiled so/jars/etc) that would be really helpful!
Though the attached example still returns kUnityGfxRendererNull for s_Graphics->GetRenderer() call on Unity 5.3 for android devises, I was able to make it render the triangle by setting s_DeviceType to kUnityGfxRendererOpenGLES20 manually AND setting 'Graphics APIs' to OpenGLES2 only (removed OpenGLES3) under Unity 'Player Settings'
The next issue however is that the triangle disappears again once 'Virtual Reality supported' tick is checked to run the build for GearVR. Any chances to make it work for android in VR (I'm using Samsung Galaxy S6 in case it makes any difference)
$$anonymous$$y final goal is to render 2D movie to GearVR using external texture to render video to and a unity side texture which is bound to FBO to copy the external texture to display frames further. To make it work it's essential to be able to perform glDrawArrays/Elements. Probably there is another way to accomplish it though. If anyone has an idea or is able to share a working example, it would help greatly (it should be open source without any kind of precompiled so/jars/etc though)
Your answer
Follow this Question
Related Questions
OpenGL Context from Plugin 1 Answer
External terrain renderer 0 Answers
Native Rendering Plugin with Oculus Rift 0 Answers