DirectX SDK

Step 2.2: Create the New Surface

[Visual Basic]

The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.

[C++]

Create a new surface for the texture by using the IDirectDraw7::CreateSurface method:

    if( FAILED( hr = pDD->CreateSurface( &ddsd, &pddsTexture, NULL ) ) )
    {
        pDD->Release();
        return NULL;
    }

The first parameter in the CreateSurface method is the address of the DDSURFACEDESC2 structure describing the surface texture object. After the call completes, the second parameter will be set to a the IDirectDrawSurface7 interface pointer for your texture surface

The surface that you will use as your texture surface has now been created, you are ready to copy the bitmap to the texture surface. This step is explained in Step 2.3: Copy to the Render Surface.