Giter Club home page Giter Club logo

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
I have now tested this with older SFML releases (the official stable ones on 
the site) and it still doesn't work, but in a slightly different way (see 
attachment). The windows version works. (with "stable" sfml versions, haven't 
tested the ones from the git repo)
If I can be of help, please let me know. I am quite frustrated with the lack of 
a C# gui that works with SFML, and am trying to move away from GTK.

Original comment by cpolymeris on 8 Jul 2013 at 7:46

Attachments:

from gwen-dotnet.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
I have been looking into this a bit and have discovered what might be the root 
of the issue: SFML's RenderWindow.Draw(Vertex[], ...) function seems to be 
broken or behaving in a non-intuitive way. In particular, the following code 
outputs the attached drawing, the colorful rectangle (the correct one) being 
the one drawn with VertexArray, and the weird triangle the one drawn with 
Vertex[]:

using SFML.Graphics;
using SFML.Window;

public class TestProgram
{
    private RenderWindow window;

    static void Main()
    {
        RenderWindow window = new RenderWindow(new VideoMode(800, 600), "VA test");
        window.SetVerticalSyncEnabled(true);
        window.Closed += (sender, e) => window.Close();

        Vertex v1 = new Vertex(new Vector2f(300, 100), Color.White);
        Vertex v2 = new Vertex(new Vector2f(450, 100), Color.Green);
        Vertex v3 = new Vertex(new Vector2f(450, 300), Color.Magenta);
        Vertex v4 = new Vertex(new Vector2f(300, 300), Color.Yellow);

        VertexArray vertexArray = new VertexArray(PrimitiveType.Quads, 4);
        vertexArray.Append(v1);
        vertexArray.Append(v2);
        vertexArray.Append(v3);
        vertexArray.Append(v4);

        Vertex[] arrayOfVertices = new Vertex[64];
        arrayOfVertices[0] = v1;
        arrayOfVertices[1] = v2;
        arrayOfVertices[2] = v3;
        arrayOfVertices[3] = v4;

        while (window.IsOpen())
        {
            window.DispatchEvents();
            window.Clear();
            window.Draw(vertexArray);
            window.Draw(arrayOfVertices, 0, 4, PrimitiveType.Quads);
            window.Display();
        }
        window.Dispose();
    }
}

Original comment by cpolymeris on 9 Jul 2013 at 7:04

Attachments:

from gwen-dotnet.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 25, 2024
I could probably try to figure out what the SFML bug is (if there is one), but 
I am too lazy. Instead I have just modified GWEN.Net to use VertexArray 
instead. It might (or not) be less efficient than the original implementation, 
but at least it works perfectly!
If someone else needs it, see attached patch. The font bug is also fixed.

Note that the original file has CR+LF line endings, while I am using LF. If 
that causes issues for you, convert either the original file or my patch.

Original comment by cpolymeris on 9 Jul 2013 at 5:10

Attachments:

from gwen-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.