   checking a pixel of the backbuffer
  i know this is a bad idea, just doing an experiment:if(PureDevice)Error("CDirect3D::IsPixelSet requires non-pure device");D3DVIEWPORT8 vp;if(FAILED(Device->GetViewport(&vp)))Error("IDirect3DDevice8::GetViewport Failed");if(X < 0) return false;if(Y < 0) return false;if(X > vp.Width - 1) return false;if(Y > vp.Height - 1) return false;IDirect3DSurface8 * BackBuffer = NULL;if(FAILED(Device->GetRenderTarget(&BackBuffer)))Error("IDirect3DDevice8::GetRenderTarget Failed");D3DLOCKED_RECT lRect;RECT rcRect;rcRect.left = X;rcRect.top = Y;rcRect.right = X + 1;rcRect.bottom = Y + 1;if(FAILED(BackBuffer->LockRect(&lRect, &rcRect, D3DLOCK_READONLY)))Error("IDirect3DSurface8::LockRect Failed");DWORD BufBits = *((DWORD*)lRect.pBits);if(FAILED(BackBuffer->UnlockRect()))Error("IDirect3DSurface8::UnlockRect Failed");BackBuffer->Release();if(BufBits != 0)return true;return false; its not working, and i can't figure out why. any ideas?edit: yes i did specify the lockable backbuffer flag[edited by - billybob on May 11, 2003 12:34:32 AM]
  G''day!You might want to check out Device->GetBackBuffer(). Stay Casual,KenDrunken Hyena;  i''ve tried it, i figured GetRenderTarget would be more reliable because it would return the current surface in the flip chain?  ;  How do you specify the lockable backbuffer flag?I can''t find it anywhere in the DirectX8 help file. Sorry about interupting your post billybob. ;quote:Original post by Programmer16  How do you specify the lockable backbuffer flag?I can''t find it anywhere in the DirectX8 help file. Sorry about interupting your post billybob.   D3DPRESENTFLAG_LOCKABLE_BACKBUFFER in the Flags member of your D3DPRESENT_PARAMETERS    --Simon O''Connorex  -Creative AsylumProgrammer &Microsoft MVP;  billybob:1) Can you elaborate on "its not working". Does it format your HDD?, blue screen?, etc...2) Does the debug output with the D3D debug runtime tell you anything?. If a D3D call is failing, it *will* tell you why.3) Does this work on the REF device ?4) I''d agree with DrunkenHyena, try GetBackBuffer(). The flag you''ve specified in your present parameters explicitly says "Back Buffer" and not "Render Target". There''s a big chance "stuff" is happening behind the scenes in D3D and the driver to make the lock "work" in all cases with GetBackBuffer() wheras GetRenderTarget() might not have this extra stuff. The stuff could be as extreme as a blit from video memory to system memory, but should work as long as no errors were reported.5) Can you tell us a little more about your setup. For example do you have multisampling enabled --Simon O''Connorex  -Creative AsylumProgrammer &Microsoft MVP