Thread: Display format
View Single Post
 
Old 06-12-2009, 10:18 PM
Chris Ara Chris Ara is offline
Centurion
 
Join Date: Feb 2005
Posts: 176
Question Display format

I'm trying to get the display format for my device. I need to know the depth format for the autodepthstencilbuffer. I've tryed using the device manager to get the format for the default adapter but with no luck.

Code:
    Public Sub InitializeDevice()

        Dim PP As New PresentParameters
        Dim Format As Direct3D.Format
        Format = Manager.Adapters(0).CurrentDisplayMode.Format

        With PP
            .Windowed = True
            .SwapEffect = SwapEffect.Discard
            '  .BackBufferFormat = Format.D24S8
            .EnableAutoDepthStencil = True
            ' .AutoDepthStencilFormat = DepthFormat.D24S8
            .AutoDepthStencilFormat = Format
        End With

        Try

            nDevice = New Direct3D.Device(0, DeviceType.Hardware, Window, CreateFlags.SoftwareVertexProcessing, PP)

            nDevice.RenderState.ZBufferEnable = True
            nDevice.RenderState.Lighting = True
            'nDevice.RenderState.Ambient = System.Drawing.Color.White

        Catch ex As Direct3DXException

            System.Windows.Forms.MessageBox.Show(ex.ToString)

        End Try

    End Sub
Here is the code I'm using. When I use this code I keep getting a loader lock error. I'm not even really sure what that is and why I am getting it. Any suggestions ty.
Reply With Quote