Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   Managed DirectX (http://www.xtremevbtalk.com/managed-directx/)
-   -   Display format (http://www.xtremevbtalk.com/managed-directx/307978-display-format.html)

Chris Ara 06-12-2009 10:18 PM

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.

Qua 06-13-2009 12:13 AM

Take a look at this thread that discussed the loader lock exception thrown inside the visual studio environment. In my projects I've disabled the LoaderLock exception inside the Managed Debugging Assistant and I have had no problems running my apps on neither mine or other computers.

It has nothing to do, whatsoever, with you accessing the display format.

Chris Ara 06-13-2009 09:46 AM

I've already through that thread it was helpful. Still however I can't get the format for the defualt device to work. Is there another way of getting the supported formats of a computer other than just process of elimination i.e(trying each one to see what works)


All times are GMT -6. The time now is 06:41 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.