Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives()
Error Calling DrawPrimitives() Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Go Back  Xtreme Visual Basic Talk > > > > Error Calling DrawPrimitives()


Reply
 
Thread Tools Display Modes
  #1  
Old 07-18-2008, 11:29 PM
Qua's Avatar
QuaError Calling DrawPrimitives() Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default Error Calling DrawPrimitives()


I get an error on the line bolded in the following code, when I try to DrawPrimitives. I cannot realise why it'd throw an error, but I believe it might have something to do with the way I instantiate the vertices in the CubeVertices procedure. All I'm trying to do is create a cube with a texture on each side so I can play around with transformation.

Code:
'clear device
        _Device.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, Color.FromArgb(255, 255, 0, 0), 1.0F, 0)

        _Device.BeginScene()
        _Device.SetTexture(0, _Texture(X))

        _Device.SetStreamSource(0, _VertexBuffer, 0)
        _Device.DrawPrimitives(PrimitiveType.TriangleList, 0, 12) 

        _Device.EndScene()
        _Device.Present()
I've instantiated my Device with:
Code:
 Dim DispMode As DisplayMode
        Dim PP As PresentParameters

        DispMode = Manager.Adapters(Manager.Adapters.Default.Adapter).CurrentDisplayMode

        'Parameters
        PP = New PresentParameters()
        With PP
            .Windowed = True
            .SwapEffect = SwapEffect.Discard
            .BackBufferFormat = DispMode.Format
            .EnableAutoDepthStencil = True
            .AutoDepthStencilFormat = DepthFormat.D16
        End With

        'create device
        Try
            _Device = New Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, Me.Handle, CreateFlags.SoftwareVertexProcessing, PP)

            With _Device
                ' Turn off culling => front and back of the triangles are visible
                .RenderState.CullMode = Cull.None
                ' Turn off D3D lighting
                .RenderState.Lighting = False
                ' Turn on ZBuffer
                .RenderState.ZBufferEnable = True

                .VertexFormat = Direct3D.CustomVertex.PositionTextured.Format ' FVF_CUSTOMVERTEX

                ' Set the Projection Matrix to use a orthogonal view
                .Transform.Projection = Matrix.OrthoLH(300, 200, 0, 0)

            End With
And thereafted created my vertices with the following code:
Code:
            'GetType(CUSTOMVERTEX)
            _VertexBuffer = New VertexBuffer(GetType(Direct3D.CustomVertex.PositionTextured), _NumOfVertex, _Device, Usage.WriteOnly, _
                                                    FVF_CUSTOMVERTEX, Pool.Default)

            'Lock vertexbuffer (which will return the allocated memory)
            Dim Verts() As Direct3D.CustomVertex.PositionTextured = _VertexBuffer.Lock(0, 0) 'CUSTOMVERTEX = _VertexBuffer.Lock(0, 0)

            Me.CubeVertices(Verts)


            'Unlocking commits the data to the array
            _VertexBuffer.Unlock()
Where CubeVertices contains the following instantiation:
Code:
 Private Sub CubeVertices(ByRef Verts() As Direct3D.CustomVertex.PositionTextured) 'CUSTOMVERTEX)
        '---- Set vertices for cube
        '--1st facet
        '1st triangle
        Verts(0) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 0, 0, 0)
        Verts(1) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 0, 1, 0)
        Verts(2) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 0, 0, 1)
        '2nd triangle
        Verts(3) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 0, 0, 1)
        Verts(4) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 0, 1, 0)
        Verts(5) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 0, 1, 1)
        ' 2nd facet ---------------------------------------------------------
        ' triangle 1
        Verts(6) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 0, 0, 0)
        Verts(7) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 0, 1, 0)
        Verts(8) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 90, 0, 1)
        ' triangle 2
        Verts(9) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 90, 0, 1)
        Verts(10) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 0, 1, 0)
        Verts(11) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 90, 1, 1)
        ' 3nd facet ---------------------------------------------------------
        ' triangle 1
        Verts(12) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 90, 0, 0)
        Verts(13) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 0, 1, 0)
        Verts(14) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 0, 0, 1)
        ' triangle 2
        Verts(15) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 0, 0, 1)
        Verts(16) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 90, 1, 0)
        Verts(17) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 90, 1, 1)

        ' 4th facet ---------------------------------------------------------
        ' triangle 1
        Verts(18) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 0, 0, 0)
        Verts(19) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 90, 1, 0)
        Verts(20) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 90, 0, 1)
        ' triangle 2
        Verts(21) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 0, 0, 1)
        Verts(22) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 0, 1, 0)
        Verts(23) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 90, 1, 1)
        ' 5th facet ---------------------------------------------------------
        ' triangle 1
        Verts(24) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 90, 0, 0)
        Verts(25) = CUSTOMVERTEX.CreateFlexVertex(90, 90, 90, 1, 0)
        Verts(26) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 90, 0, 1)
        ' triangle 2
        Verts(27) = CUSTOMVERTEX.CreateFlexVertex(90, 0, 90, 0, 1)
        Verts(28) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 90, 1, 0)
        Verts(29) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 90, 1, 1)
        ' 6th facet ---------------------------------------------------------
        ' triangle 1
        Verts(30) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 0, 0, 0)
        Verts(31) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 0, 1, 0)
        Verts(32) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 90, 0, 1)
        ' triangle 2
        Verts(33) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 0, 0, 1)
        Verts(34) = CUSTOMVERTEX.CreateFlexVertex(0, 0, 90, 1, 0)
        Verts(35) = CUSTOMVERTEX.CreateFlexVertex(0, 90, 90, 1, 1)
    End Sub
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
  #2  
Old 07-19-2008, 05:14 AM
Qua's Avatar
QuaError Calling DrawPrimitives() Qua is offline
Impetuous & volatile

* Expert *
 
Join Date: Apr 2005
Posts: 2,177
Default

Using Xp with DX9
__________________
Reading is the foundation for all knowledge - Unknown.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives() Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives() Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
 
Error Calling DrawPrimitives()
Error Calling DrawPrimitives()
 
-->