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 - Grabek

Pages: [1]
1
General / Re: disabling text causes fps drop
« on: July 19, 2018, 06:33:17 pm »
Problem solved. Updating SFML from 2.4 to 2.5 helped. Plus (what's worth pointing out) version 2.5 should NOT have "jpeg" in dependency!

2
General / Re: disabling text causes fps drop
« on: July 19, 2018, 03:23:02 pm »
I updated SFML from 2.4 to current 2.5 and it seems it was some kind of SFML malfunction. But know, although switching console on and off doesn't influence FPS, it stays at steady 37. Strange thing is, that in debug mode fps is steady 60 and in release it's 37. Why debug mode is running better? I'm using code::blocks IDE.
Thank you for answer, especially you Laurent.

3
General / Re: disabling text causes fps drop
« on: July 18, 2018, 01:48:10 pm »
I've commented out rest of the code part by part, to check whether something else causes this fps drop. It points out, that this 'if block' somehow causes this drop, but I have no idea why hiding it causes this drop? If it is hidden, then less operations are being performed, so why fps drops?

I've tried to move parts of code from if block, out of it. But it gives non linear expectations. Like every single line of text hidden, causes squared impact.

4
General / Re: disabling text causes fps drop
« on: July 18, 2018, 01:27:18 pm »
I'm seeing "tearing", pretty easy to notice when fps drops from 60 to 15.
I've read fps by moving it's displaying function, out of console scope.

5
General / [SOLVED]disabling text causes fps drop
« on: July 18, 2018, 01:17:15 pm »
I'm programming a simple game in SFML/C++/Code::blocks. I wrote a simple "dev-console" which basically prints out in the corner fps, position, number of logic/ graphics loops etc. Everything works fine until I hide it, then fps fall down from 60(blocked max) to around 15. Why disabling writing function causes so much fps drop? (shouldn't disabling it speed things up a little?)

Declarations:

sf::Text consoletxt;
sf::Font font;
if (!font.loadFromFile("Times_New_Roman.ttf"))
    std::cout<<"Error loading font Times New Roman"<<std::endl;
consoletxt.setFont(font);
consoletxt.setFillColor(sf::Color(255,255,255,255));
consoletxt.setCharacterSize(14);
consoletxt.setOutlineColor(sf::Color(0,0,0,192));
consoletxt.setOutlineThickness(1);
bool console = true;

Code below: upon switching console = false; fps drops from 60 to 15

tm = t.asMilliseconds();
    fps += 1000/tm;
    if (console == true)
    {
        consoletxt.setString("Last loop time: " + doubleToString(tm));
        consoletxt.setPosition(0,0);
        window.draw(consoletxt);
        consoletxt.setString("Fps: " + intToString(1000/tm) + " Average fps: " + intToString(fps/logicLoops));
        consoletxt.setPosition(0,15);
        window.draw(consoletxt);
        consoletxt.setString("objects[0].x: " + doubleToString(objects[0].x));
        consoletxt.setPosition(0,30);
        window.draw(consoletxt);
        consoletxt.setString("objects[0].y: " + doubleToString(objects[0].y));
        consoletxt.setPosition(0,45);
        window.draw(consoletxt);
        consoletxt.setString("Angle radians/degrees: " + doubleToString(cam_angle) + " | " + intToString((int)(cam_angle*180/pi)));
        consoletxt.setPosition(0,60);
        window.draw(consoletxt);
        consoletxt.setString("Logical Loops: " + doubleToString(logicLoops) + " Graphics loops: " + doubleToString(graphicsLoops) + " Difference: " + doubleToString(logicLoops - graphicsLoops - 1));
        consoletxt.setPosition(0,75);
        window.draw(consoletxt);
        consoletxt.setString("Variable test: " + doubleToString(cos(cam_angle*180/3.1415)));
        consoletxt.setPosition(0,585);
        //window.draw(consoletxt);
    }

Pages: [1]