SFML community forums
Help => General => Topic started by: dabo on March 07, 2008, 12:10:44 am
-
Hi, I just downloaded the latest source and in order to get the shapes to link I had to add "Shape.cpp" and "Shape.hpp" to the sfml-graphics project in the SFML.sln solution for VS2008. Did you forget to add them?
Anyway now when I finally managed to build my project, I got a "Debug Assertion Failed" error when I tried to run my project. It said:
"Vector subscript out of range"
This is the code I'm using:
//Create a shape
sf::Shape sLine;
sLine.Line(sf::Vector2f(300.f,300.f), sf::Vector2f(320.f,340.f), 2.f, sf::Color(0, 0, 0));
//Draw the shape
App.Draw(sLine);
If I remove the Shape drawing code, I don't get the error. This is the first time I try to use shapes, is my code wrong? Any ideas?
-
Did you forget to add them?
That's true :D
This is the first time I try to use shapes, is my code wrong? Any ideas?
Yes. Line, Circle and Rectangle are static functions which return a sf::Shape ; they won't do anything if called like a member function.
sLine = sf::Shape::Line(sf::Vector2f(300.f,300.f), sf::Vector2f(320.f,340.f), 2.f, sf::Color(0, 0, 0));
However, if drawing an empty shape causes a crash, then there's a bug in my code ;)
Thanks for your feedback.
-
Thanks, everything works perfectly now :)
-
I've now been playing around with shapes for a while and I must say that it's a great addition, it will definitively come in handy.
One question though, is it possible to draw them anti-aliased? for example like SetSmooth(true) does for images. The edges are pretty sharp right now.
-
As shapes are drawn using triangles, the only way to antialias them is to activate anti-aliasing when you create the window.
-
When it says:
"Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled"
...is this because of my crappy on-board graphics card?
-
Probably. What graphics card do you have ?
-
Intel 945GM
-
Ok I see. So don't worry about not having support for antialiasing ;)
-
Ok I see. So don't worry about not having support for antialiasing ;)
I have another computer with a "real" graphics card too, it's just that I prefer to use my laptop. :)