DirectX SDK

Step 4.3: Update the Display

[C++]

This section pertains only to application development in Visual Basic. See Direct3D Immediate Mode C/C++ Tutorials.

[Visual Basic]

Once a scene has been rendered to the render-target surface, you can show the results on screen. A windowed application usually does this by blitting the content of the render-target surface to the primary surface. A full screen application that employs page-flipping would simply flip the surfaces in the flipping chain. Because it runs in a window, the Triangle tutorial application uses the former method, using the following code:

        g_dx.GetWindowRect Me.hWnd, g_rcDest
 
        j = g_ddsPrimary.Blt(g_rcDest, g_ddsBackBuffer, g_rcSrc, DDBLT_WAIT)

The preceding DirectDrawSurface7.Blt method simply blits the entire contents of the render target surface to the window on the desktop. This tutorial code tracks the destination rectangle for the blit in the g_rcDest global variable.

While your application is running, you will need to ensure that control is relinquished to the operating system periodically, which is the topic of Step 4.4: Call DoEvents.