I'm trying to setup a D3D windowed app (to draw 2D-sprites, but still). Generally it works ok, you can draw images n stuff.
However, I get an annoying frame with random pixels around the drawing area. What causes this?
By random pixels, I mean it shows what was rendered at that point before (like when you move the window those parts aren'tupdated). That frame is about 1 pixel wide.
This is how I set things up. I thought it looked ok:
Code://Creates a Direct3D object Direct3D = Direct3DCreate9(D3D_SDK_VERSION); //Aborts if Direct3D creation failed if(Direct3D == NULL) { return FALSE; } //Sets the present parameters ZeroMemory(&PresentParameters, sizeof(D3DPRESENT_PARAMETERS)); PresentParameters.BackBufferWidth = 0; PresentParameters.BackBufferHeight = 0; PresentParameters.BackBufferFormat = D3DFMT_UNKNOWN; PresentParameters.BackBufferCount = 1; PresentParameters.SwapEffect = D3DSWAPEFFECT_COPY; PresentParameters.Windowed = TRUE; PresentParameters.EnableAutoDepthStencil = TRUE; PresentParameters.AutoDepthStencilFormat = D3DFMT_D16; PresentParameters.hDeviceWindow = WindowHandle; PresentParameters.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; //Creates a Direct3D device object if(FAILED(Direct3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, TargetWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &PresentParameters, &Direct3DDevice))) { return FALSE; }