Hi
I'm really new to direct3d and have done lots of googling and have made some progress, but I'm now totally stuck with something and after lots more googling I can't find how this works. I posted this on Xbox live, but as I'm writing for a windows PC I think that was the wrong place
I'm using direct3d9 to render some animations to screen - they are nothing fancy, just geometric shapes and text, however, they do have to be rendered as the screen refresh rate and they need to avoid tearing which is why I'm using direct3d. The other thing is that I need to render to two screens each with different refresh rates and render at their particular refresh rate independently. My test case is my laptop with it's screen at 60 Hz, plus an external monitor at 75 Hz.
My progress so far is that I have created a single IDirect3d9 interface and two frames (one for each screen), I've enumerated the displays and created two IDirect3d9Devices from my interface and associated one with each display. However, if I use D3DPRESENT_INTERVAL_ONE, then both displays get rendered at 60 Hz.
So I went back a step and just created a single device and tested it on either monitor. In this case I get either 60 or 75 Hz on the two screens. After some playing I also discovered that I could directy check where in the refresh cycle my monitors are so I found if set D3DPRESENT_INTERVAL_IMMEDIATE then use something like
D3DRASTER_STATUS rStatus;
m_deviceD3D9->GetRasterStatus(0, &rStatus);
while (rStatus.InVBlank)
{
m_deviceD3D9->GetRasterStatus(0, &rStatus);
}
while (!rStatus.InVBlank)
{
m_deviceD3D9->GetRasterStatus(0, &rStatus);
}
before my present call. Then I get the native resolution for each monitor when used on their own. However again I hit problems when running on two screens. Now I only get between 45 and 55 fps, presumably because my code spends so long in the while loops.
I wondered if I could triple buffer and write to the third buffer while in the while loops in another thread, but I don't see how to get and write to the third buffer, i.e. what code do I actually need to call?
Any help much appreciated
Phil