Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I'm almost lost in this. I started with GDI+ but it is very slow on the alpha effects. So I just started with DirectX9 for Visual Basic .Net. So I tried to setting up a Device with DirectX3D, but I get a error.

 

Imports Microsoft.DirectX

Imports Microsoft.DirectX.Direct3D

 

Public Class Form1

Inherits System.Windows.Forms.Form

 

Dim createdevice As Device

Dim presentpara As New PresentParameters()

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

Me.FormBorderStyle = FormBorderStyle.None

Me.Text = ""

Me.WindowState = FormWindowState.Maximized

System.Windows.Forms.Cursor.Hide()

presentpara.Windowed = True

createdevice = New Device(0, DeviceType.Software, Me, CreateFlags.SoftwareVertexProcessing, presentpara)

 

End Sub

End Class

 

I get a error in the last Cretedevice line, can someone tell me why ?

 

Thanks,

Miura

Posted

First, Read the tutorial on Direct3D9 at http://www.directx4vb.com

Secondly, those display parameters are incorrect:

'Windowed Mode Display parameters
With displaypara
      .Windowed = True 'Windowed Mode
      .SwapEffect = SwapEffect.Discard
      .BackBufferCount = 1 '1 Back Buffer
      .BackBufferFormat = D3DManagerObj.Adapters(0).CurrentDisplayMode.Format 'Use current Depth
      .BackBufferWidth = Me.ClientSize.Width() 'Set render area to
      .BackBufferHeight = Me.ClientSize.Height() 'form width/height
End With
'Now create Device

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

Thanks,

 

How do you know that these lines are incorrect or missing. I just

got an error how tells that someting it incorret or missing in line

 

createdevice = New Device(0, DeviceType.Software, Me, CreateFlags.SoftwareVertexProcessing, presentpara)

 

Where can I see what there is missing and incorrect ?

 

Regards,

Miura

Posted

You MUST specify the current screen color depth(if not in fullscreen) along with the the BackBuffer Sizes and count

 

There doesn't seem to be anything wrong with that line but it is telling you that some of the information IN the line is incorrect and the presentation parameters are the only things that seem incorrect

.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
  • *Experts*
Posted

To see more detailed error messages, including parameters that are missing or invalid, use the dbmon tool.

 

1. Run DBMon (found in C:\DXSDK\Bin\DXUtils\dbmon.exe)

2. Run your application in VS.NET

3. When your program halts with an exception, look at the command window opened by dbmon - you should see a good description of what went wrong.

 

You can also have error information spewed out to your VS.NET Output window though you'll get a LOT more than just DirectX information. To turn it on, goto you project properties and select the "Configuration Properties" folder, then the "Debugging" subitem. Change "Enable Unmanaged Debugging" to True. Now in your Output window you'll see something like (I cut out 50 lines of "loading DLL..." information):

<snip>
D3DX: (INFO) Using SSE2 Instructions
Miss rate before optimization: 1.000000
Miss rate after optimization: 1.000000
Miss rate before optimization: 2.571141
Miss rate after optimization: 1.214765
D3DX: (INFO) Using SSE2 Instructions
The thread '.NET SystemEvents' (0x33c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x33c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x2f0) has exited with code 0 (0x0).
The program '[3972] Billboard.exe' has exited with code 0 (0x0).
The program '[3972] Billboard.exe: Native' has exited with code 0 (0x0).

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...