Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am currently using DirectX 9 on a machine with two GPUs and three monitors. I am currently trying to draw a triangle on each monitor using vertexbuffers; A directx helloworld with multiple monitors if you will. I am familiar with some DirectX coding, but new to multiple monitor DirectX coding. I may be going about this the wrong way, so please do correct me if I'm doing something wrong. I have created a Direct3D Device for each enumerated adapter sharing the same Form handle. This allows me to successfully use all three monitors in full-screen mode.

For Each Adapter In Direct3D.Adapters
    Dim PresentParameters As New PresentParameters
    'Setup PresentParameters
    PresentParameters.Windowed = False
    PresentParameters.DeviceWindowHandle = MainForm.Handle

    Dim Device as New Device(Direct3D, Adapter.Adapter, DeviceType.Hardware, PresentParameters.DeviceWindowHandle, CreateFlags.HardwareVertexProcessing, PresentParameters)

    Device.SetRenderState(RenderState.Lighting, False)

I can also draw text to each device successfully using a different Font for each Device.

When I render a triangle using a different VertexBuffer for each Device, only two monitors display the triangle. One of the two monitors on the same GPU, and the monitor on it's own GPU display properly.

VertexBuffer = New VertexBuffer(Device, 4 * Marshal.SizeOf(GetType(ColoredVertex)), Usage.WriteOnly, VertexFormat.None, Pool.Managed)

Dim Verts = VertexBuffer.Lock(0, 0, LockFlags.None)
    New ColoredVertex(-.5, -.5, 1, ForeColor),
    New ColoredVertex(0, .5, 1, ForeColor),
    New ColoredVertex(.5, -.5, 1, ForeColor)


VertexDeclaration = New VertexDeclaration(Device, {
    New VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
    New VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),

Render Code:

Device.SetStreamSource(0, VertexBuffer, 0, Marshal.SizeOf(GetType(ColoredVertex)))
Device.VertexDeclaration = VertexDeclaration
Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1)

I have to assume the fact that they share the same physical card comes into play. Should I use multiple buffers on the same card, and if so, how? Or what is the way I should access the VertexBuffer across Devices?

Another thought I had was the non working monitor acts like there are no lights. Is turning off lighting on each device on the same card causing issues somehow?

share|improve this question

closed as off-topic by Josh Petrie Dec 16 at 2:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.