Archived

This topic is now archived and is closed to further replies.

VB.NET and Directx8.1

This topic is 5618 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi i''m trying to convert some example (made in vb6) that i found and i have one problem for the moment. This is how the sub look in vb.net Public Sub DrawPrimitiveUP(ByVal PrimitiveType As DxVBLibA.CONST_D3DPRIMITIVETYPE, ByVal PrimitiveCount As Integer, ByVal VertexStreamZeroDataArray As IntPtr, ByVal VertexStreamZeroStride As Integer) I call the sub in vb6 that way and it worked fine: D3DDevice.DrawPrimitiveUP(DxVBLibA.CONST_D3DPRIMITIVETYPE.D3DPT_TRIANGLESTRIP, 2, TriStrip(0), Len(TriStrip(0))) but in VB.Net it doesn''t accept TriStrip(0). It needs a System.IntPtr Anyone knows how i can get the intptr of TriStrip(0) ? Thanks in advance. NTSC

Share this post


Link to post
Share on other sites
quote:
Original post by NTSCNTSC
Hi i''m trying to convert some example (made in vb6) that i found and i have one problem for the moment.

This is how the sub look in vb.net

Public Sub DrawPrimitiveUP(ByVal PrimitiveType As DxVBLibA.CONST_D3DPRIMITIVETYPE, ByVal PrimitiveCount As Integer, ByVal VertexStreamZeroDataArray As IntPtr, ByVal VertexStreamZeroStride As Integer)

I call the sub in vb6 that way and it worked fine:

D3DDevice.DrawPrimitiveUP(DxVBLibA.CONST_D3DPRIMITIVETYPE.D3DPT_TRIANGLESTRIP, 2, TriStrip(0), Len(TriStrip(0)))

but in VB.Net it doesn''t accept TriStrip(0). It needs a System.IntPtr

Anyone knows how i can get the intptr of TriStrip(0) ?

Thanks in advance.

NTSC



Do yourself a favor and wait for DX9. It will make your life much easier (and much faster).

Sorry can''t be more specific - NDA.

Share this post


Link to post
Share on other sites
while I would subscribe eRAZOR''s opinion, here''s a workaround that might work:

add the following code to your method:
Dim c As System.Runtime.InteropServices.GCHandle
c = c.Alloc(TriVert)

pass the following code to the intptr argument:
DrawPrimitiveUP( (...) c.op_Explicit(c) (...))

and then release the GCHandle:
c.free

let me know if that works


You know, I never wanted to be a programmer...

Alexandre Moura

Share this post


Link to post
Share on other sites