Open GoogleCodeExporter opened 9 years ago
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:
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:
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:
Original issue reported on code.google.com by
cpolymeris
on 8 Jul 2013 at 12:39Attachments: