XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

TriangleStrip that always displays in red

Last post 05-03-2008 12:06 AM by mx270a. 1 replies.
  • 05-02-2008 3:36 PM

    TriangleStrip that always displays in red

    I'm new to DirectX, but have figured out how to make it do mostly what I want (I'm coding in VB.Net). However, I have a TriangleStrip that always displays in red, even if I specifiy different colors for the vertices. I don't see any code that specifies using red, so I 'm curious how I can get it to use the color specified in the vertex. Any suggestions would be appreciated. Thanks.

    My code currently looks like this:
        Public Sub InitVertices()
    triangleStrip(0) = New CustomVertex.TransformedColored(-5, 0, 0, 1, Color.Blue.ToArgb())
    triangleStrip(1) = New CustomVertex.TransformedColored(5, 0, 0, 1, Color.Blue.ToArgb())
    triangleStrip(2) = New CustomVertex.TransformedColored(-5, 5, 0, 1, Color.Blue.ToArgb())
    triangleStrip(3) = New CustomVertex.TransformedColored(5, 5, 0, 1, Color.Blue.ToArgb())
    triangleStrip(4) = New CustomVertex.TransformedColored(-3, 9, 0, 1, Color.Blue.ToArgb())
    triangleStrip(5) = New CustomVertex.TransformedColored(7, 9, 0, 1, Color.Blue.ToArgb())
    End Sub

    Public Sub RedrawGraphics()
    device.RenderState.Lighting = False
    device.Clear(ClearFlags.Target, Color.Black, 1.0, 0)
    device.BeginScene()

    device.VertexFormat = CustomVertex.PositionColored.Format
    device.Transform.View = Matrix.LookAtLH(New Vector3(0, -5, 20), New Vector3(0, 0, 0), New Vector3(0, 0, 1))
    device.Transform.Projection = Matrix.PerspectiveFovLH(CSng(Math.PI) / 4, 1, 1.0F, 20)

    device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 4, triangleStrip)

    device.EndScene()
    device.Present()
    End Sub


  • 05-03-2008 12:06 AM In reply to

    Re: TriangleStrip that always displays in red

    Resolved. The solution is to create the triangle strip as a PositionColored instead of TransformedColored.

    Dim triangleStrip(5) As CustomVertex.PositionColored

Page 1 of 1 (2 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG