public DoubleBuffer()
        {
            // allocate buffers
            m_arrbuffers = new ChangeBuffer[2];
            m_arrbuffers[0] = new ChangeBuffer();
            m_arrbuffers[1] = new ChangeBuffer();

            //Create WaitHandlers
            m_RenderFrameStart = new AutoResetEvent(false);
            m_RenderFrameEnd = new AutoResetEvent(false);
            m_UpdateFrameStart = new AutoResetEvent(false);
            m_UpdateFrameEnd = new AutoResetEvent(false);

            // reset the values
            Reset();
        }
        public void StartRenderProcessing(out ChangeBuffer renderBuffer, out GameTime gameTime)
        {
            // wait for the green light
            m_RenderFrameStart.WaitOne();

            // ensure data is pushed to memory
            Thread.MemoryBarrier();

            // get the current render Buffer
            renderBuffer = m_arrbuffers[m_nCurrentRenderBuffer];

            // get the time
            gameTime = m_Gametime;
        }