PDA

Click to See Complete Forum and Search --> : Simple 3D display OCX


Laine
Oct 22nd, 2002, 07:29 AM
Greetings.

I am a beginning code developer, long-time basic user, but just becoming familiar with .NET environment and application development.

I am beginning PhD work in metrology. One application we are looking at is using laser to measure surface points of a part. This results in a set of 3D points (Point cloud - 100 to 1000000 independent coordinates).

I would like to find or create an ActiveX control to display this set of points in manipulable 3D environment window (with size, position and rotation controls).

I would like to investigate finding source for purchased OCX of this type, but also will develop a simple model so I understand the mechanics.

Can anyone give me benefit of their experience with simple 3D graphic display and/or OCX outsourcing?

I have also asked this in "Graphics Inquiry" thread.

Thanks!

CornedBee
Oct 22nd, 2002, 09:57 AM
I think Direct3D in VB is easy enough that you can use it directly.

Laine
Oct 22nd, 2002, 06:39 PM
Thanks for the quick response.

Any links to simple examples?

Machaira
Oct 22nd, 2002, 10:57 PM
Great tutorials here - http://www.directx4vb.com/

Zaei
Oct 22nd, 2002, 11:03 PM
Originally posted by Machaira
Great tutorials here - http://www.directx4vb.com/

Jack Hoxley is actually a member here... though he doesnt post very much... Im sure DX4VB keeps him quite busy =).

I would have to agree, the site is simply wonderful for the tutorials =).

Z.

Laine
Oct 23rd, 2002, 03:51 PM
Thank you. My next questions will be much more detailed.

- L

Laine
Oct 27th, 2002, 03:25 PM
I am currently undertaking DirextX8: DirectX Graphics: Getting Started tutorial from directx4vb.com (recommended from vbworld.com). As this tutorial is written in VB6, I have had to do some translation.

Most is ok, but I am hitting a runtime error in the Initialise function, particularly the line

Set D3DDevice = D3D.CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, FrmMain.Hwnd, _
D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow)

Which I translated to VB.Net as

D3DDevice = D3D.CreateDevice(DxVBLibA.CONST_D3DCONST.D3DADAPTER_DEFAULT, DxVBLibA.CONST_D3DDEVTYPE.D3DDEVTYPE_HAL, Nothing, DxVBLibA.CONST_D3DCREATEFLAGS.D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow)

The error text is

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Laines 3D Display.exe
Additional information: Exception from HRESULT: 0x8876086C.


Am I missing something in the .Net translation? Has anyone submitted .Net translations to any of these basic graphics tutorials? (I feel I can translate ok, it's just tedious)

Also, are there existing OCX controls that utilize D3D, something I could incorporate directly to my project without having to manually code the whole thing?


btw, these tutorials look like the best on the net!

Sastraxi
Oct 27th, 2002, 03:50 PM
DX8 doesn't have 'fully handled .NET code' or something like that. That may be your problem, I don't know.

CornedBee
Oct 27th, 2002, 04:24 PM
You need a hwnd to pass. You can't just pass Nothing, you need a fully qualified HWND. You can get one from any Control object using the Handle property, but you'll most likely want to use the main Form of your app.

Laine
Oct 27th, 2002, 05:30 PM
ok, now I used the main form.activeform.handle.toint32 property


my error is more simple now:

An unhandled exception of type 'System.NullReferenceException' occurred in Laines 3D Display.exe

Additional information: Object reference not set to an instance of an object. (occurs at


how do I create a new instance of the hardware adapter (I think this is a peculiarity of .NET)?

I have attached my code (translation of Jack's tutorial lesson).

Thanks for the help with what i'm sure are simple questions for you!

Laine

CornedBee
Oct 28th, 2002, 04:33 AM
(occurs at


Does it say where?

Laine
Oct 28th, 2002, 07:18 AM
excuse please


the error occurs in the line used to create the hw adapter:

'//This line will be explained in detail in a minute...
'??? D3DDevice = New DxVBLibA.Direct3D8()

D3DDevice = D3D.CreateDevice _(DxVBLibA.CONST_D3DCONST.D3DADAPTER_DEFAULT, _
DxVBLibA.CONST_D3DDEVTYPE.D3DDEVTYPE_HAL, _
Form1.ActiveForm.Handle.ToInt32, _
DxVBLibA.CONST_D3DCREATEFLAGS.D3DCREATE_SOFTWARE_VERT _
EXPROCESSING, D3DWindow)


I need to create a new instance of the adapter.
This is runtime error; compile is ok.



On a broader subject, am I barking up the wrong tree trying to go this in VB.NET? It looks to me like current state of online support is strong in VB6, with little or no .NET support. What do you think?

CornedBee
Oct 28th, 2002, 09:42 AM
Yes, absolutly. VB.NET is too young for that many people to pick it up well enough that they can explain it to others.

Are you sure
Form1.ActiveForm
isn't Nothing?
Try
Form1.Handle
instead.

Laine
Oct 28th, 2002, 11:38 AM
handle.toint32 returns a valid value
but now i'm back to the original error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Laines 3D Display.exe
Additional information: Exception from HRESULT: 0x8876086C.

which occurs at the same line of code:

D3DDevice = D3D.CreateDevice(DxVBLibA.CONST_D3DCONST.D3DADAPTER_DEFAULT, DxVBLibA.CONST_D3DDEVTYPE.D3DDEVTYPE_HAL, Handle.ToInt32, DxVBLibA.CONST_D3DCREATEFLAGS.D3DCREATE_SOFTWARE_VERTEXPROCESSING, D3DWindow)


i'm searching local help now


btw, i ordered vb6 standard today

L

CornedBee
Oct 28th, 2002, 02:16 PM
D3DERR_INVALIDCALL
The method call is invalid. For example, a method's parameter may have an invalid value.

CornedBee
Oct 28th, 2002, 02:16 PM
But don't ask me which.