Exemplo n.º 1
0
        public static void ReceiveBeforeOpaque(wvr.render.utils.PreAllocatedQueue queue)
        {
#if UNITY_EDITOR
            bool isEditor = true;
            if (isEditor)
            {
                return;
            }
#endif
            if (contextRTOnly.textureId == 0)
            {
                Log.w(TAG, "Single pass textures are not ready");
                return;
            }

            int colorAttachment = (int)UGL.GLenum2.GL_COLOR_ATTACHMENT0;
            int depthAttachment = (int)UGL.GLenum3.GL_DEPTH_STENCIL_ATTACHMENT;
            int target          = (int)UGL.GLenum3.GL_DRAW_FRAMEBUFFER;

            UGL.FramebufferTexture2D(target, colorAttachment, (int)UGL.GLenum2.GL_TEXTURE_2D, 0, 0);
            UGL.FramebufferRenderbuffer(target, depthAttachment, (int)UGL.GLenum2.GL_RENDERBUFFER, 0);

            if (contextRTOnly.antialiasing > 1)
            {
                UGL.FramebufferTextureMultisampleMultiviewOVR(target, colorAttachment, contextRTOnly.textureId, 0, contextRTOnly.antialiasing, 0, 2);
                UGL.FramebufferTextureMultisampleMultiviewOVR(target, depthAttachment, contextRTOnly.depthId, 0, contextRTOnly.antialiasing, 0, 2);
            }
            else
            {
                UGL.FramebufferTextureMultiviewOVR(target, colorAttachment, contextRTOnly.textureId, 0, 0, 2);
                UGL.FramebufferTextureMultiviewOVR(target, depthAttachment, contextRTOnly.depthId, 0, 0, 2);
            }

            // The Unity engine will clear but only the left eye.  We have to clear it by ourself.
            UGL.Clear((uint)(UGL.GLenum2.GL_COLOR_BUFFER_BIT | UGL.GLenum2.GL_DEPTH_BUFFER_BIT | UGL.GLenum2.GL_STENCIL_BUFFER_BIT));

            contextRTOnly.textureId = 0;
            contextRTOnly.depthId   = 0;
        }