コード例 #1
0
        private void Clear( )
        {
            mSTVideoCapture = null;

            mGR = null;

            mTextureDataBGR256x256         = null;
            mTextureOpenGLHandleBGR256x256 = 0;

            mVideoLUT256 = null;

            mProcessXMin           = 32;
            mProcessYMin           = 160;
            mProcessXMax           = 96;
            mProcessYMax           = 224;
            mCurrentClassification = (-1);
        }
コード例 #2
0
        Initialize
        (
            GR gr,
            IntPtr hwndParentWindow
        )
        {
            this.Clear( );

            // Cache the GR instance
            this.mGR = gr;


            this.mTextureDataBGR256x256 = new byte[(256 * (256 * 3))];


            this.mSTVideoCapture = new STVideoCapture();

            int capturePeriodMilliseconds = 33; // 33 milliseconds --> 30 frames per second (max)

            // Attempt to initialize video capture
            bool videoCaptureInitializationResult = false;

            videoCaptureInitializationResult =
                this.mSTVideoCapture.Initialize
                (
                    hwndParentWindow,
                    STVideoCapture.STVideoCaptureFormat.BGR320x240,
                    capturePeriodMilliseconds,
                    new STVideoCapture.DelegateClientCaptureCallback(this.ClientCaptureCallback)
                );

            if (false == videoCaptureInitializationResult)
            {
                return(false);
            }



            // Create OpenGL texture object
            int[] temp = new int[1];
            gr.glGenTextures(1, temp);
            this.mTextureOpenGLHandleBGR256x256 = temp[0];


            // Fill the OpenGL texture with initial data
            gr.glBindTexture
            (
                GR.GL_TEXTURE_2D,
                this.mTextureOpenGLHandleBGR256x256
            );

            gr.glTexImage2D
            (
                GR.GL_TEXTURE_2D,
                0,
                3,
                256,
                256,
                0,
                GR.GL_BGR_EXT,
                GR.GL_UNSIGNED_BYTE,
                this.mTextureDataBGR256x256
            );

            // Set texture mapping mode and filtering modes
            gr.glTexParameteri(GR.GL_TEXTURE_2D, GR.GL_TEXTURE_WRAP_S, GR.GL_REPEAT);
            gr.glTexParameteri(GR.GL_TEXTURE_2D, GR.GL_TEXTURE_WRAP_T, GR.GL_REPEAT);

            gr.glTexParameterf(GR.GL_TEXTURE_2D, GR.GL_TEXTURE_MIN_FILTER, GR.GL_LINEAR);
            gr.glTexParameterf(GR.GL_TEXTURE_2D, GR.GL_TEXTURE_MAG_FILTER, GR.GL_LINEAR);


            // deselect the current texture
            gr.glBindTexture(GR.GL_TEXTURE_2D, 0);


            return(true);
        }