C# XNA Programm unter VB.net Grafikfehler??

  • VB.NET

Es gibt 4 Antworten in diesem Thema. Der letzte Beitrag () ist von Christopher.

    C# XNA Programm unter VB.net Grafikfehler??

    Hallo,
    Ich habe ein XNA Device auf einer VB.NET Windows Form erstellt das gleiche auch mit XNA in C# (zumindestens die gleichen Textures) jedoch bekomm ich in der Vb.Net Anwendung einige Grafik Fehler woran liegt das??
    hier ist ein Video
    christopher.kilu.de/video.wmv (1,78 MB)
    christopher.kilu.de/video.zip (1,72 MB)
    Hier der Code
    C#
    Spoiler anzeigen


    GraphicsDevice.Clear(Color.CornflowerBlue);


    effect.World = worldMatrix;
    effect.View = viewMatrix;
    effect.Projection = projectionMatrix;

    effect.VertexColorEnabled = true;

    this.effect.Begin();
    foreach(EffectPass pass in this.effect.CurrentTechnique.Passes) {
    pass.Begin();

    GraphicsDevice.VertexDeclaration = vertexDeclaration;



    //this.graphics.GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexElements);
    this.graphics.GraphicsDevice.RenderState.CullMode = CullMode.None;

    GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 6);
    pass.End();



    VB.net
    Spoiler anzeigen

    VB.NET-Quellcode

    1. Sub Render()
    2. _device.Clear(Color.CornflowerBlue)
    3. effect.World = worldMatrix
    4. effect.View = viewMatrix
    5. effect.Projection = projectionMatrix
    6. effect.VertexColorEnabled = True
    7. Me.effect.Begin()
    8. For Each pass As EffectPass In Me.effect.CurrentTechnique.Passes
    9. pass.Begin()
    10. _device.VertexDeclaration = VertexDeclaration
    11. 'this.graphics.GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexElements);
    12. _device.RenderState.CullMode = CullMode.None
    13. _device.DrawUserPrimitives(Of VertexPositionColor)(PrimitiveType.TriangleList, vertices, 0, triindex)
    14. pass.[End]()
    15. Next
    16. Me.effect.[End]()
    17. _device.Present()
    18. End Sub





    Vielen Dank
    mich würde interessieren, was in VertexDeclaration(bei VB sowie C#) drinne ist, also wie die erzeugt wurde...
    und in VB was in triindex steht, am besten durch einen Haltepunkt ;)
    Ich wollte auch mal ne total überflüssige Signatur:
    ---Leer---
    Also VertexDeclaration wird so Initialisiert

    VB.NET-Quellcode

    1. Dim VertexDeclaration As VertexDeclaration
    2. VertexDeclaration = New VertexDeclaration(_device, VertexPositionColor.VertexElements)




    trriindex ist die Anzahl der Dreiecke, die Koordinaten hier für werden aus einer Datei gelesen.
    Bei der Pyramide hat sie einen Wert von 4, weil es 4 Dreiecke sind;)
    Vielen Dank!!!
    Es Klappt!!!




    _pP = New PresentationParameters()
    _pP.BackBufferHeight = 640
    _pP.BackBufferWidth = 480
    _pP.AutoDepthStencilFormat = DepthFormat.Depth16
    _pP.EnableAutoDepthStencil = True
    _device = New Graphics.GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.Hardware, Panel1.Handle, _pP)