   Performing an operation immediately before first scanline rasterised on presentation
  I am outputting video frames with a presentation interval of one to tie to vsync. As far as I am aware this causes the application to sleep until the video card is ready to accept the next frame.The problem is that I need to update the state of a pair of LCD shutter glasses immediately before the video card starts sending the first scanline of the current frame to the monitor. As I am currently updating the state of the glasses after the Present() call has returned there a few scanlines at the top of the display have already been output.Is it possible to detect when the monitor is about to enter the vertical blanking region and handle that event in a timely fashion?Edit: Not sure what was up with the other thread. It's gone now.   
  I don't think you'll be able to do this reliably with software (unless you're writing a video card device driver).All the shutter glasses I've come across plug directly into the video card for the sync.   ;  Yeah this sort of information isn't available through the D3D layer, and even if you got it from the driver I doubt it would be reliable across different video cards and driver revisions.   ;Quote:Original post by Adam_42All the shutter glasses I've come across plug directly into the video card for the sync.How do those typically signal which eye to open? Most of the designs I've seen alternate the eye every vblank, which will cause problems if a frame is too long and have a button to press to resynchronise. Even when simply alternating two images I haven't been able to get a consistent alternating frame pattern, there's the occasional stutter.Quote:Original post by MJPYeah this sort of information isn't available through the D3D layer, and even if you got it from the driver I doubt it would be reliable across different video cards and driver revisions.There is GetRasterStatus, which seems to work with the following if I set the presentation interval to immediate:while (!this.GraphicsDevice.GetRasterStatus(0).InVBlank) ; // Wait for VBlankthis.LcdShutterGlasses.RtsEnable = (this.Emulator.OpenGlassesShutter == Emulator.GlassesShutter.Left); // Set open eye appropriately.this.GraphicsDevice.Present(); // Present.One problem is that if I run both my LCD and CRT together (cloned) there is a scrolling dark band on the CRT that displays the correct image on one side and is a frame out of sync on the other. If I disable the LCD, the image is (mostly) stable, apart from the occasional flickering where a single source frame is displayed more than once on the screen.   ;Quote:Original post by benryvesOne problem is that if I run both my LCD and CRT together (cloned) there is a scrolling dark band on the CRT that displays the correct image on one side and is a frame out of sync on the other. If I disable the LCD, the image is (mostly) stable, apart from the occasional flickering where a single source frame is displayed more than once on the screen.Video cards cloning output don't (as far as I've seen) genlock the two signals, even if the refresh rates are the same. One of the cards will vsync properly, and the other one will swap buffers at an arbitrary scanline (though I'm not sure why the line would move). The simplest solution would probably be an external VGA splitter (an active box with a power cord going into it, not just a splitter cable).Sort of a funny story how I found out about the image tearing with display cloning, actually.   ;Quote:Original post by SneftelVideo cards cloning output don't (as far as I've seen) genlock the two signals, even if the refresh rates are the same. One of the cards will vsync properly, and the other one will swap buffers at an arbitrary scanline (though I'm not sure why the line would move). The simplest solution would probably be an external VGA splitter (an active box with a power cord going into it, not just a splitter cable).Interesting - one for the readme, I suppose, if I ever get this working. [wink]Of course, being a fool I'd been working with desktop composition enabled, which interferes with the presentation interval (immediate wasn't really immediate). Switching Aero off resulted in severe screen tearing and unsynchronised glasses. Switching back to a presentation interval of one and updating the shutter glasses immediately after presenting seems to work as long as Aero is disabled. Re-enabling Aero appears to insert an additional delay after presenting, which means the glasses are updated some time into the next frame, and it all looks a mess.I'm going to have a hunt around to see how other people achieved good results without a pass-through VGA cable!   