   really wierd flicker in fullscreen
  i have a fullscreen d3d9 app that runs fine for the most part. on my laptop, it works great, but on my desktop, the underlying windows show through sometimes. the problem is a lot more pronounced when i turn on any form of anti-aliasing (not through code, but manually from windows).the desktop is running xp pro with a geforce fx 5600 and 512mb of ram. i AM running with 2 monitors, but that really **shouldnt** cause a problem.all i do is create a window, initialize d3d, and go. i did put in the code to initialize direct input in exclusive mode, but that didnt fix anything. =/ i AM creating and destroying windows some before i get to the fullscreen part of my code, but i dont think that''s the problem because i took that out once and it still did the flickering junkwell, heres the code... thanks for reading such a long post...matt-----heres the code to create a window class-----   bool createTheWindowClass(HINSTANCE &hInstance, HWND &hWnd, MSG &msg){WNDCLASSEX winClass;// window class structure (for creating a window)winClass.cbSize= sizeof(WNDCLASSEX);// the size of this structurewinClass.style= CS_HREDRAW | CS_VREDRAW;// style of window - redraws on horizontal or vertical resizes (only in windowed mode)winClass.lpfnWndProc= WndProc;// address of the function that gets the messages - WndProc()winClass.cbClsExtra= 0;// crap we dont needwinClass.cbWndExtra= 0;// (more) crap we dont needwinClass.hInstance= hInstance;// handle to instance of appwinClass.hIcon= LoadIcon(0, IDI_APPLICATION);// handle to the icon of the app (must be a resource)winClass.hIconSm= LoadIcon(0, IDI_APPLICATION);// handle to the small icon of the app (must be a resource)winClass.hCursor= LoadCursor(0, IDC_ARROW);// handle to the cursor of the app (must be a resource)winClass.hbrBackground= 0;// handle to a background brush (we dont need it)winClass.lpszMenuName= 0;// string holding name of menu resource (not needed)winClass.lpszClassName= "excro";// window class name; must be same as the one in CreateWindowEx()if(!RegisterClassEx(&winClass))    // register the class we describedreturn false;    // that''s not good, we give upreturn true;}-----heres the code to create the window-----   bool createTheWindowFS(HINSTANCE &hInstance, HWND &hWnd, MSG &msg){hWnd = CreateWindowEx(WS_EX_TOPMOST, "excro", "Extreme Croquet", WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, gScreenWidth, gScreenHeight, 0, 0, hInstance, 0);if(!hWnd)    // did we get a window?return false;    // no? that''s not good either, we give upShowWindow(hWnd, SW_SHOW);// show the windowUpdateWindow(hWnd);// update the windowSetFocus(hWnd);// focus on the windowSetForegroundWindow(hWnd);// make it the foreground windowreturn true;}-----heres the code to init d3d-----    (minus all the error checking for readability)   bool GRAPHICS::initD3D(HWND hWnd){D3DDISPLAYMODEd3dDisplayMode;D3DPRESENT_PARAMETERSd3dParams;D3DCAPS9d3dCaps;// clear out our variablesZeroMemory(&d3dDisplayMode, sizeof(d3dDisplayMode));ZeroMemory(&d3dParams, sizeof(d3dParams));ZeroMemory(&d3dCaps, sizeof(d3dCaps));d3dObject = Direct3DCreate9(D3D_SDK_VERSION);// create an instance of direct3dd3dObject->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3dDisplayMode);d3dObject->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps);// find out what kind of vertex processing we should useDWORD vertexProcessing = 0;if(d3dCaps.VertexProcessingCaps)vertexProcessing |= D3DCREATE_HARDWARE_VERTEXPROCESSING;elsevertexProcessing |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;d3dParams.Windowed= !gFullscreen;d3dParams.BackBufferWidth= gScreenWidth;d3dParams.BackBufferHeight= gScreenHeight;d3dParams.SwapEffect= D3DSWAPEFFECT_DISCARD;d3dParams.BackBufferFormat= d3dDisplayMode.Format;d3dParams.BackBufferCount= 1;d3dParams.EnableAutoDepthStencil= true;d3dParams.AutoDepthStencilFormat= D3DFMT_D16;d3dObject->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, vertexProcessing, &d3dParams, &d3dDevice);/* set rendering states */d3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);// enable the z-bufferd3dDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(200, 200, 200));// disable ambient lightingd3dDevice->SetRenderState(D3DRS_LIGHTING, true);// enable lightingd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);// disable backface cullingd3dDevice->SetRenderState(D3DRS_NORMALIZENORMALS, true);// disable backface culling/* clamp textures so we dont get that crappy wrap-around */d3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);d3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);/* set filtering settings */d3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);d3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);/* set up our directional light */ZeroMemory(&d3dLight, sizeof(d3dLight));d3dLight.Type= D3DLIGHT_DIRECTIONAL;d3dLight.Diffuse.r= 1.0f;d3dLight.Diffuse.g= 1.0f;d3dLight.Diffuse.b= 1.0f;d3dLight.Direction.x= -0.75f;d3dLight.Direction.y= -1.0f;d3dLight.Direction.z= 0.0f;d3dDevice->SetLight(0, &d3dLight);d3dDevice->LightEnable(0, true);ZeroMemory(&d3dMaterial, sizeof(d3dMaterial));d3dMaterial.Diffuse.r= 1.0f;d3dMaterial.Diffuse.g= 1.0f;d3dMaterial.Diffuse.b= 1.0f;setPerspective(); // call our setPerspective functionreturn true; // yay! everything worked so far!}
  I have the same problem, I also have two monitors.What I did is to handle all the WindowMessages dealing with drawing the screen.It would like something like this:case WM_PAINT:case WM_NCPAINT:case WM_ERASEBKGND:case WM_ICONERASEBKGND:case WM_PAINTICON:ValidateRgn (hWnd, NULL);break;That helped to reduce the amount of flicks I got, but it might caused other problems which I dont remember right now.  ;  When you''re creating the window, use WS_POPUP | WS_VISIBLE. That stopped my flickering problem anyway.   /*I use DirectX 8.1 and C++ (Microsoft Visual C++ 6.0 Professional edition)*/ ;  yeah... for future reference, Programmer16 was right.... using WS_POPUP | WS_VISIBLE seems to have fixed the problem... wierd.thanks :-)matt the MadProgrammeredit... see below   [edited by - MadProgrammer on February 10, 2004 11:14:51 AM];quote:Original post by MadProgrammer  yeah... for future reference, ''The C modest god'' was right.... using WS_POPUP | WS_VISIBLE seems to have fixed the problem... wierd.thanks :-)matt the MadProgrammer   Um, the ''The C modest god'' didn''t say that, I did.quote:Original post by Programmer16  When you''re creating the window, use WS_POPUP | WS_VISIBLE. That stopped my flickering problem anyway. /*I use DirectX 8.1 and C++ (Microsoft Visual C++ 6.0 Professional edition)*/  Just wanted to point that out!  /*I use DirectX 8.1 and C++ (Microsoft Visual C++ 6.0 Professional edition)*/ ;  my bad... editing post.... 