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

Pages: [1] 2
1
Hi Mario, thanks for you input, but it seems there is issue in something else.
Here is my observation:
Are you using/changing some STL container quite a lot around the rendering code?
yes i do in my project, but the problem totally is not in STL, as the:
1) if i commented just drawing function in my project then fps still is ok
2) the benchmark i attached produse fps drop without using STL (never mind at #include <vector> in attached bench, this is overtyping, actually in bench i didn't use STL code at all)
I remember doing something like that once and using sf::Text dropped performance by a huge margin.
that's not my case either, as in bench i created sf::Text only once, out of game loop.

Cheers, Alex

2
Hi Laurent.

Sorry for late response only recently found time to return to my project and write a short bench for text rendering issue.

Just to remind you: my task is to render 200 separated pieces of text with SFML2.
I attached test written in one file which draws simple Quad by plain opengl + text by SFML2. By changing value in global variable N, the size of text matrix drawing on screen is changed. On top right angle of the screen the FPS value is drawn. I also put limit to 100fps for SFML app. For test you need to put the ttf font file and link following: sfml-system sfml-graphics sfml-window  ${OPENGL_LIBRARIES}. I know it's obvious, but maybe will save couple of minutes to look at.

So my bench result:
N=2 (2x2=4 pieces of text) = ~98fps
N=5 (5x5=25 pieces of text) = ~40fps (almost twice drop down)
N=15 (15x15=225 pieces of text) = ~5fps.
I also attached picture from my machine to demonstrate this.
I tested on Ubuntu X64, Radeon5550 (catalyst driver, not open source), AMD X64 2.4Ghz

Cheers, Alex

3
Laurent.
My benchmark is integrated into my game render loop. But i think i may cut off everything irrelevant and lleave only important (opengl init, blank game render loop + text render). I will provide short example but i need time to prepare it.

Cheers, Alex

4
same bench 200 short separated texts with string "1"
case 1 (push/popGLStates calls removed):
{     
   text12.setString(str);
        text12.setPosition(pos.x, GetHeight() - pos.y);
                                               
    //window.pushGLStates();
   window.draw(text12);
   //window.popGLStates();   
}
~35fps (blank screen, screwed).

case 2: all uncommented(renders everything correct)
~10fps

case 3: render ok, but without texts
{
   //window.pushGLStates();
   // window.draw(text12);
   //window.popGLStates();   
}
~55fps

For my test i could do it only once, but not for my project. I got many layers, each may generate text info. I got thought to push all texts into std::vector, and render it at final stage, but:
1) don't want to do things complicated now
2) not sure how pushing the std::strings will influence on performance.

Of course i understand that my code is not optimized, and some my tricks are really bad. But for now i didn't plane to do optimization, not time yet. And the sfml1.6 allow me to not make my attention on that behaviour.

By the way, i maid short replacement of text render by http://nehe.gamedev.net/tutorial/freetype_fonts_in_opengl/24001/
And it gives me 49-50 fps, compare to SFML2 (10 fps). But i didn't compare the quality, and probably sfml2 overcome it with bigger text(i tested only with short slices of texts).

And i am not sure if this matter, my videocard is not so powerfull (radeon5550).

Cheers, Alex

5
Hi Laurent.

Thanks for you input. Yes you are right, i was mistaken into identifying the bottleneck. It seems my bottleneck in text render itself.
My task is to render 200 short strings. Let it be number between "0-9". Explosion damage ships within circle and they are aware me about damaging value(also these numbers are showed me the circle of explosion affection).
Each string is separated and has own position, moving speed.

I made short benchmark. It creates 200 short texts with string "1".
For theoretic purpose i moved out some stuff from the render loop, such as:
{
   text12.setFont(font);
   text12.setCharacterSize(12);
   text12.setColor(sf::Color(255,0,0,255));
   text12.setString("1");
   text12.setPosition(200, 300);
} performing only once.

My main loop have only:
{
window.pushGLStates();
window.draw(text12);
window.popGLStates();   
}
case 1:
if i comment
//window.draw(text12);
i got 42-45fps.

if i uncomment
window.draw(text12);
i got 10-13 fps.

With my previous approach: text12 is created within gameloop i got 9-10 fps(worst case).

Is it theoretically possible to render many short strings with good performance? I am not sure now, but it seems with sfml1.6 i never had fps drop below 30 fps. It hard for me to check this now to be sure exactly.

Cheers, Alex

6
Greetings!

I noticed some unpleasant issue when moved from sfml1.6 to 2.0.

I have render which is mainly using standard opengl calls and sfml is handling the font drawing.
So, sfml drawing calls are mixed with native opengl, and happens in many layers of my code.
I want to keep thing separated, my code is on the left and sfml code is on the right, so i created some agregator which manage all sfml calls inside.

with using SFML2:

sf::RenderWindow window;

void SFML_Wrapper::DrawText(const std::string& str, int font_size, const Vec2<float>& pos, const Color4<int>& color)
{
        sf::Text text(str, font, font_size);
        text.setColor(sf::Color(color.r, color.g, color.b));
        text.setPosition(pos.x, GetHeight() - pos.y);
                                               
   window.pushGLStates();
   window.draw(text);
   window.popGLStates();           
}

I know that push/popGLStates() calls are very expensive(and actually they are the root of my problem). i have a significant fps drop when text is rendering.

with using SFML1.6: i had no need to use push/popGLStates(). And my font rendering served me with good fps. I was using
window.PreserveOpenGLStates(true); which was configured once in constructor.
I guess it does something similar to push/popGLStates() in a background, but i have no so significant render speed drop as in SFML2.

Is it possible to avoid this? Or at least to get speed near to SFML1.6 without code redesign (i had an idea to agregate all text and render it at once at the end of render, but don't want to make code more complex than it actually is now). I don't want to downgrade.
Many thanks in advance!

7
Hi Laurent, you are right.
I guess my knowledge around C++ still not perfect. Now i knows exact difference between "pass by reference" and "pass by copy".  You advice solved the problem! Thanks for pointing!

8
Laurent
Hi, thanks for clarification.
But still no luck.

I have been added in my_resize function
Code: [Select]

g_APP.SetSize(width, height);
sf::View view(sf::FloatRect(0, 0, width, height));
g_APP.SetView(view);


The text becomes invisible, so i guess i made something worse with view.
By the way if i re-created window in my_resize function
Code: [Select]

g_APP.Create(sf::VideoMode(width, height, g_BPP), "SFML Window");

the text fitted OK, but something bad with my textures (they becomes like a crap).

Is it something else i could try to solve it? Or maybe my resize view method is not Ok?
Or i need to recreated window and re-load all game graphic resource afterwards? Not sure if it will work, but i was hoping to get easier solution without reloading opengl textures.

Bytheway i forgot to mention, i am using sfml1.6, window mode

9
Greetings all.

I have got a small project:
1) mostly everything is rendered in plain opengl
2) sfml render only the texts

Have got a problem when i do re-sizing render window.
case 1 (works OK):
1)
Code: [Select]

int SCREEN_WIDTH_MIN = 800[b]*2[/b];
int SCREEN_HEIGHT_MIN = 600;
sf::RenderWindow g_APP(sf::VideoMode(SCREEN_WIDTH_MIN, SCREEN_HEIGHT_MIN, g_BPP), "app");

2)
Code: [Select]

g_APP.SetSize(SCREEN_WIDTH_MIN, SCREEN_HEIGHT_MIN );
resizeGl(SCREEN_WIDTH_MIN, SCREEN_HEIGHT_MIN);


picture is drawn OK(make notice that text is drawn within border)


case 2(not OK):
1)
Code: [Select]

int SCREEN_WIDTH_MIN = 800;
int SCREEN_HEIGHT_MIN = 600;
sf::RenderWindow g_APP(sf::VideoMode(SCREEN_WIDTH_MIN, SCREEN_HEIGHT_MIN, g_BPP), "app");

2)
Code: [Select]
g_APP.SetSize(SCREEN_WIDTH_MIN[b]*2[/b], SCREEN_HEIGHT_MIN );
resizeGl(SCREEN_WIDTH_MIN[b]*2[/b], SCREEN_HEIGHT_MIN);


picture is drawn not OK, the text(which is drawn by SFML) is wider and in some reson it is drawn below the opengl border (on first picture the text draw call overrides drawing the border)


How could i fix the screen width/height re-sizing to get all objects fitted? or suggestions where i am doing wrong? Thanks in advance.

10
SFML projects / ColdStars (2.5D time based space strategy)
« on: February 07, 2012, 10:23:37 pm »
hi player931402, sorry for late response.
libglew1.5-dev,  libglew1.5 are also currently required(i upload install.txt on sourceforge.net with this info in any case). If i got the question correctly. sfml is used for text drawing mainly, rest draw operations are plain opengl calls.

11
SFML projects / ColdStars (2.5D time based space strategy)
« on: January 30, 2012, 12:19:33 pm »
Quote from: "Groogy"
Would be awesome if you implemented a "hard-core" mode that would let the turns just pass by so you have to do the decisions real-time. Would give a new difficulty to the game and play style.

The idea is OK as for me(i am greeting extending without cutting old possibilities), but this probably be the last thing what i will be implementing in future. There is still a mass of work with higher priority (such as saving/sounds/ai/gui/some new game objects/(maybe online gaming)).

Quote from: "Groogy"

Anyway, are you planning on releasing the game on Desura or something like that?

I din't think so far yet. Also i didn't know about Desire or similar system before. Just read about it and it sounds pretty cool, so i believe - yes, but this will be when game be playable. Thanks for the direction!

12
SFML projects / ColdStars (2.5D time based space strategy)
« on: January 30, 2012, 01:05:19 am »
Thanks Groogy.
It is turned based (movement is applied certain period of time after turn acknowledgement).

13
SFML projects / ColdStars (2.5D time based space strategy)
« on: January 29, 2012, 11:37:01 pm »
Quote from: "Elgan"
Very impressive and nice

Thank you!

Quote from: "Elgan"
map is a bit confusing

you have the point! as you may notice i also didn't work much on GUI too, most controls are hot-keys, which is also not good for first-time-to-try, i found this a bit boring, hope this will be changed soon :)

14
SFML projects / ColdStars (2.5D time based space strategy)
« on: January 29, 2012, 11:24:28 pm »
Hi all.
Time to show my small draft which i am working on.
I started developing with python(pyOpengl) and now i finished my move to sfml(c++). The game is not really playable yet, it more looks like a draft, so don't expect much from it.  The main task is to create game-play close to game "Space Rangers" space battle, when this will be achieved will see what be the next todo aim. Don't be rude if you find dirty code, this is my first project, i am trying to keep it as simply as possible, but this goes too slowly and some portion of code i didn't make clean enough yet. Also there is no comments, because some things are rapidly changed and it takes a lot of time to fix comments too, i will plan to add comment later when be sure that the part of code good enough.

The existed gameplay example you may find at youtube

The source code can be downloaded from http://sourceforge.net/projects/coldstars/files/

PS: Thanks sfml developers to give me a chance to get easy diving into gamedev :)

15
System / warning comparison beetwen enums
« on: June 26, 2011, 10:53:44 am »
OniLink10
Thanks, that solved my problem.
Quote

if (g_EVENT.MouseButton.Button == sf::Mouse::Left)  

Pages: [1] 2
anything