Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Sub

Pages: 1 ... 9 10 [11]
151
Graphics / Getting an invalid pointer error while using sf::Text
« on: October 17, 2012, 03:06:47 am »
This is slightly odd.

I just switched from Visual Studio 2010 to 2012 Express. 

In 2012 I'm getting runtime errors whenever I assign an sf::Text both a font and a string.  If I assign one without the other, it will work fine.  I can assign character size, color, and position without any problem, but those two functions together are giving me a debug assertion failed error.  It says Expression: invalid null pointer.

I'm declaring the texts in a class and assigning the font and string in the constructor.  The same exact code in 2010 produces no errors, and I've double checked -- I'm using the same library files, they're the debug libraries for SFML 2.

I imagine that I'm doing something wrong to cause the problem, but I have no idea what that would be.  Any help would be appreciated.

152
Graphics / Drawing lines is incredibly slow?
« on: September 25, 2012, 02:54:08 am »
I'm currently trying to replicate this tutorial [http://gamedev.tutsplus.com/tutorials/implementation/simulate-fabric-and-ragdolls-with-simple-verlet-integration/] and I'm getting low FPS when I try to draw a grid. 

I have 2500 points on screen, each spaced 6 pixels apart from each other, and I want to draw a line between each point and its neighbor.  When I do so, my FPS goes from 4200 to 20-100.  Is this normal, or am I doing something wrong?

Here's the code I'm using to draw the lines.
void SFML_Program::drawLine(sf::Vector2f a, sf::Vector2f b)
{
        sf::Vertex line[2] = {a, b};
        MainWindow.draw(line, 2, sf::Lines);
}

I've also tried:
        void SFML_Program::drawLine(sf::Vector2f a, sf::Vector2f b)
{
        sf::VertexArray lines(sf::Lines, 2);
        lines[0].position = a;
        lines[1].position = b;
       
        MainWindow.draw(lines);
}

I'm calling that 4900 times to produce this. 

http://i.imgur.com/tI1tz.png

The code that calls it simply retrieves the two points it needs and then calls the drawline.  Am I doing something wrong?

Pages: 1 ... 9 10 [11]