コード例 #1
0
    void OnGUI()
    {
        // This function should do input injection (if enabled), and drawing.
        if (_player == null)
        {
            return;
        }

        Event e = Event.current;

        switch (e.type)
        {
        case EventType.Repaint:
        {
            //if (_player.GrabFrame (out sz,out components)) {
            if (_imageGrabed)
            {
                Resize((int)_grabbedSize.x, (int)_grabbedSize.y, _grabbedComponents, 0);
                if (m_Texture[0] == null)
                {
                    Debug.LogError("The GstTexture does not have a texture assigned and will not paint.");
                }
                else
                {
                    _player.BlitTexture(m_Texture [0].GetNativeTexturePtr(), m_Texture [0].width, m_Texture [0].height);
                }
                _imageGrabed = false;
                OnFrameCaptured(0);
            }
            break;
        }
        }
    }
コード例 #2
0
    void OnGUI()
    {
        // This function should do input injection (if enabled), and drawing.
        if (_player == null)
        {
            return;
        }

        Event e = Event.current;

        switch (e.type)
        {
        case EventType.Repaint:
        {
            Vector2 sz;
            if (_player.GrabFrame(out sz))
            {
                Resize((int)sz.x, (int)sz.y);
                if (m_Texture == null)
                {
                    Debug.LogError("The GstTexture does not have a texture assigned and will not paint.");
                }
                else
                {
                    _player.BlitTexture(m_Texture.GetNativeTexturePtr(), m_Texture.width, m_Texture.height);
                }
            }
            break;
        }
        }
    }
コード例 #3
0
 // Update is called once per frame
 void Update()
 {
     if (_imageGrabed)
     {
         Resize((int)_grabbedSize.x, (int)_grabbedSize.y, _grabbedComponents, 0);
         if (m_Texture[0] == null)
         {
             Debug.LogError("The GstTexture does not have a texture assigned and will not paint.");
         }
         else
         {
             _player.BlitTexture(m_Texture[0].GetNativeTexturePtr(), m_Texture[0].width, m_Texture[0].height);
         }
         _imageGrabed = false;
         OnFrameCaptured(0);
         _triggerOnFrameBlitted(0);
     }
 }