Pixel format for primary surface

Started by
-1 comments, last by Mr Cucumber 23 years, 8 months ago
Is it possible to set the pixelformat for the primary surface. I tried this and got a invalid parameters error:
    ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
	ddsd.dwSize = sizeof(ddsd);
	ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT /*| DDSD_PIXELFORMAT*/;
	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
	ddsd.dwBackBufferCount = 1;
	/*DDPIXELFORMAT ddpf;
	ZeroMemory(&ddpf, sizeof(ddpf));
	ddpf.dwSize = sizeof(DDPIXELFORMAT);
	ddpf.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
	ddpf.dwRGBBitCount = 32;
	ddpf.dwRBitMask = 255;
	ddpf.dwGBitMask = 65280;
	ddpf.dwBBitMask = 16711680;
	//ddpf.dwRGBAlphaBitMask = 4278190080;

	ddpf.dwRGBAlphaBitMask = 0;
	ddsd.ddpfPixelFormat = ddpf;*/

	HRESULT hr;
	//Create both the primary and the secondary surfaces with this call

	if( FAILED( hr = lpdd4->CreateSurface(&ddsd,&lpddsprimary,NULL)))
	{
			if(hr == DDERR_INVALIDPIXELFORMAT)
		Message("pixel");
	else if(hr == DDERR_INVALIDPARAMS)
		Message("param");
	}    

This topic is closed to new replies.

Advertisement