Direct3D, DX9 VB.NET DrawPrimitives Limitation? 
Author Message
 Direct3D, DX9 VB.NET DrawPrimitives Limitation?

I'm writing an app to read geometric data from a digital lumber
scanner.  I've got the code working (seemingly) but it appears that I
cannot draw more then 65535 primitives.  On a standard 2 X 4 board,
the data I'm working with produces on the order of ~218 points per
scan Top and 218 points per scan bottom. Scanning every .125 inches
yields about 210,000 points for each face on a 10 foot board.

Using a TriangleStrip and "DrawPrimitives",  

 "mdevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0,
mNoOfPrimitives)"

I get a very nice representation of the board until I get to
mNoOfPrimitives = 65,535.  Past this point my board rendering
disappears, and begins to rebuild the board as if starting from
primitive #1 and so on.

Is this a limitation of the drawprimitives call?  of DX9 3D?  Or what
could I be doing wrong?  I've messed with everything I can think of to
get past this limit but to no avail.

Help!!

'Create the Device. . .
  mpresentParams.Windowed = True ' We don't want to run fullscreen
  mpresentParams.SwapEffect = SwapEffect.Discard ' Discard the frames
  mpresentParams.EnableAutoDepthStencil = True ' Turn on a Depth
stencil
  mpresentParams.AutoDepthStencilFormat = DepthFormat.D16  'And the
stencil format
 mdevice = New Device(0, DeviceType.Hardware, Me,
CreateFlags.SoftwareVertexProcessing, mpresentParams) 'Create a
mDevice

'Miscellaneous Device rendering options
 ' Turn off culling, so we see the front and back of the triangle
  mdevice.RenderState.CullMode = Cull.None

  ' Turn on the ZBuffer
  mdevice.RenderState.ZBufferEnable = True
  mdevice.RenderState.Lighting = True 'make sure lighting is enabled
  mdevice.RenderState.Clipping = False

'The Rendering code.

 Public Sub Render()

 'Clear the backbuffer to a particular color
  mdevice.Clear(ClearFlags.Target Or ClearFlags.ZBuffer,
System.Drawing.Color.Black, 1.0F, 0)

 'Begin the scene
  mdevice.BeginScene()

  ' Setup the lights and materials
  SetupLights()

  ' Setup the world, view, and projection matrices
  SetupMatrices()

   Dim BF As GeoBinFiles.BinFile    'object that contains the
VertexBuffer

   If BF.Clipped And BF.ShowPlot Then

     mdevice.SetStreamSource(0, BF.MyVertexBuffer, 0)
     mdevice.VertexFormat = CustomVertex.PositionNormal.Format  '
.PositionNormalTextured.Format
     Try : mdevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0,
mNoOfPrimitives) : Catch : End Try

   End If

   'End the scene
    mdevice.EndScene()

   'Update the screen
    mdevice.Present()

 End Sub 'Render

If this is a limitation, what's my next course of action?  Creating a
Mesh object? Is there a simple fix?

Thank you in advance.

-Kevin



Sat, 03 Sep 2005 05:54:50 GMT  
 Direct3D, DX9 VB.NET DrawPrimitives Limitation?
this is a standard part of D3D, iirc the caps bits include a maxprimitives.

break your geometry down and call DrawPrim several times.


Quote:
> I'm writing an app to read geometric data from a digital lumber
> scanner.  I've got the code working (seemingly) but it appears that I
> cannot draw more then 65535 primitives.  On a standard 2 X 4 board,
> the data I'm working with produces on the order of ~218 points per
> scan Top and 218 points per scan bottom. Scanning every .125 inches
> yields about 210,000 points for each face on a 10 foot board.

> Using a TriangleStrip and "DrawPrimitives",

>  "mdevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0,
> mNoOfPrimitives)"

> I get a very nice representation of the board until I get to
> mNoOfPrimitives = 65,535.  Past this point my board rendering
> disappears, and begins to rebuild the board as if starting from
> primitive #1 and so on.

> Is this a limitation of the drawprimitives call?  of DX9 3D?  Or what
> could I be doing wrong?  I've messed with everything I can think of to
> get past this limit but to no avail.

> Help!!

> 'Create the Device. . .
>   mpresentParams.Windowed = True ' We don't want to run fullscreen
>   mpresentParams.SwapEffect = SwapEffect.Discard ' Discard the frames
>   mpresentParams.EnableAutoDepthStencil = True ' Turn on a Depth
> stencil
>   mpresentParams.AutoDepthStencilFormat = DepthFormat.D16  'And the
> stencil format
>  mdevice = New Device(0, DeviceType.Hardware, Me,
> CreateFlags.SoftwareVertexProcessing, mpresentParams) 'Create a
> mDevice

> 'Miscellaneous Device rendering options
>  ' Turn off culling, so we see the front and back of the triangle
>   mdevice.RenderState.CullMode = Cull.None

>   ' Turn on the ZBuffer
>   mdevice.RenderState.ZBufferEnable = True
>   mdevice.RenderState.Lighting = True 'make sure lighting is enabled
>   mdevice.RenderState.Clipping = False

> 'The Rendering code.

>  Public Sub Render()

>  'Clear the backbuffer to a particular color
>   mdevice.Clear(ClearFlags.Target Or ClearFlags.ZBuffer,
> System.Drawing.Color.Black, 1.0F, 0)

>  'Begin the scene
>   mdevice.BeginScene()

>   ' Setup the lights and materials
>   SetupLights()

>   ' Setup the world, view, and projection matrices
>   SetupMatrices()

>    Dim BF As GeoBinFiles.BinFile    'object that contains the
> VertexBuffer

>    If BF.Clipped And BF.ShowPlot Then

>      mdevice.SetStreamSource(0, BF.MyVertexBuffer, 0)
>      mdevice.VertexFormat = CustomVertex.PositionNormal.Format  '
> .PositionNormalTextured.Format
>      Try : mdevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0,
> mNoOfPrimitives) : Catch : End Try

>    End If

>    'End the scene
>     mdevice.EndScene()

>    'Update the screen
>     mdevice.Present()

>  End Sub 'Render

> If this is a limitation, what's my next course of action?  Creating a
> Mesh object? Is there a simple fix?

> Thank you in advance.

> -Kevin



Sat, 03 Sep 2005 08:40:20 GMT  
 Direct3D, DX9 VB.NET DrawPrimitives Limitation?
Thank you Mr. Taylor,

I'm obviously new to DX  (c:

I did what you indicated and it works perfectly (or at least looks
wonderful . . .) I'm going through the Lighting.VB tutorial now to see
if I can save these vertex buffers to corresponding mesh files so
interesting boards may be viewed later, offline.

-Kevin


Quote:
> this is a standard part of D3D, iirc the caps bits include a maxprimitives.

> break your geometry down and call DrawPrim several times.



> > I'm writing an app to read geometric data from a digital lumber
> > scanner.  I've got the code working (seemingly) but it appears that I
> > cannot draw more then 65535 primitives.  On a standard 2 X 4 board,
> > the data I'm working with produces on the order of ~218 points per
> > scan Top and 218 points per scan bottom. Scanning every .125 inches
> > yields about 210,000 points for each face on a 10 foot board.

> > Using a TriangleStrip and "DrawPrimitives",

> >  "mdevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0,
> > mNoOfPrimitives)"

> > I get a very nice representation of the board until I get to
> > mNoOfPrimitives = 65,535.  Past this point my board rendering
> > disappears, and begins to rebuild the board as if starting from
> > primitive #1 and so on.

> > Is this a limitation of the drawprimitives call?  of DX9 3D?  Or what
> > could I be doing wrong?  I've messed with everything I can think of to
> > get past this limit but to no avail.

> > Help!!

> > 'Create the Device. . .
> >   mpresentParams.Windowed = True ' We don't want to run fullscreen
> >   mpresentParams.SwapEffect = SwapEffect.Discard ' Discard the frames
> >   mpresentParams.EnableAutoDepthStencil = True ' Turn on a Depth
> > stencil
> >   mpresentParams.AutoDepthStencilFormat = DepthFormat.D16  'And the
> > stencil format
> >  mdevice = New Device(0, DeviceType.Hardware, Me,
> > CreateFlags.SoftwareVertexProcessing, mpresentParams) 'Create a
> > mDevice

> > 'Miscellaneous Device rendering options
> >  ' Turn off culling, so we see the front and back of the triangle
> >   mdevice.RenderState.CullMode = Cull.None

> >   ' Turn on the ZBuffer
> >   mdevice.RenderState.ZBufferEnable = True
> >   mdevice.RenderState.Lighting = True 'make sure lighting is enabled
> >   mdevice.RenderState.Clipping = False

> > 'The Rendering code.

> >  Public Sub Render()

> >  'Clear the backbuffer to a particular color
> >   mdevice.Clear(ClearFlags.Target Or ClearFlags.ZBuffer,
> > System.Drawing.Color.Black, 1.0F, 0)

> >  'Begin the scene
> >   mdevice.BeginScene()

> >   ' Setup the lights and materials
> >   SetupLights()

> >   ' Setup the world, view, and projection matrices
> >   SetupMatrices()

> >    Dim BF As GeoBinFiles.BinFile    'object that contains the
> > VertexBuffer

> >    If BF.Clipped And BF.ShowPlot Then

> >      mdevice.SetStreamSource(0, BF.MyVertexBuffer, 0)
> >      mdevice.VertexFormat = CustomVertex.PositionNormal.Format  '
> > .PositionNormalTextured.Format
> >      Try : mdevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0,
> > mNoOfPrimitives) : Catch : End Try

> >    End If

> >    'End the scene
> >     mdevice.EndScene()

> >    'Update the screen
> >     mdevice.Present()

> >  End Sub 'Render

> > If this is a limitation, what's my next course of action?  Creating a
> > Mesh object? Is there a simple fix?

> > Thank you in advance.

> > -Kevin



Sun, 04 Sep 2005 02:10:24 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB.NET ODBC.NET limitations solved DSN list / Tables list

2. Severe VB.NET COM/.NET Interop Limitation

3. DX9 VB .Net Docs--WHERE?!

4. VB.NET/DX9 Presentation Paramters Device Window

5. Vb.Net / DX9 tutorials?

6. Creating a mesh (DX9, VB.NET)

7. IndexBuffer / VB.net / DX9

8. How do I use Direct3D in vb.NET

9. VB.NET Verision Limitations ?...

10. VB.NET Version Limitations ???

11. Direct3D 8.1: Problem with Direct3D application

12. Direct3D/Asp.Net

 

 
Powered by phpBB® Forum Software