Jonathan Benedicto wrote:
Quote
Set PresentationParameters to D3DPRESENT_INTERVAL_ONE.
HTH
Jon
Hi Jon,
Yep, that's in there. Here's what (I think) I know at this point...
My main message processing loop calls my rendering function which displays the
left or right picture on the screen via Present(). As the PresentationInterval
is INTERVAL_ONE, it should work... and does. But, my guess is, every so often,
my program get forced out of the CPU (WinAmp does this very reliably) and
therefore misses a vSync from the monitor, resulting in my left and right images
reversing and my eyes effectively crossing.
I was thinking about checking each successive call into my ShowSynchronizedFrame
against the Windows TickCount and estimating which image (left or right) I
should be displaying. Alternatively, if I could somehow get the number of vSyncs
that have elapsed, I could easily determine the proper image to display based on
oddness or evenness of this number...
I figure this is 3D {*word*143} 101 because if you can't get your display to stay in
sync, you get killed pretty fast by the guys you're trying to shoot. ;)
Unfortunately, I have little experience with DirectX.
Thanks,
Rob
...
// DirectX painting of backbuffers
void ShowSynchronizedFrame()
{
// flip front and back buffers - this displays new image data
if (g_pd3dDevice->Present(NULL, NULL, g_hWnd, NULL) != D3DERR_WASSTILLDRAWING)
{
// flip left/right surface
PaintLeftFrame = !PaintLeftFrame;
}
}
...
// configure Direct3D Present() parameters
d3dpp.BackBufferWidth = bmInfo->bmiHeader.biWidth;
d3dpp.BackBufferHeight = bmInfo->bmiHeader.biHeight;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = 0;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = NULL;
d3dpp.Windowed = false;
d3dpp.EnableAutoDepthStencil = false;//true;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.Flags = 0;
d3dpp.FullScreen_RefreshRateInHz = 120;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
...
// main event loop for page flipping window
do
{
// process all events
if (PeekMessage(&uMsg, NULL, 0, 0, PM_REMOVE))
{
// standard message dispatch...
TranslateMessage(&uMsg);
DispatchMessage (&uMsg);
}
// display proper back buffer
ShowSynchronizedFrame();
}
while (uMsg.message != WM_QUIT);
{smallsort}