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.


Topics - amdlintuxos

Pages: [1]
1
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!

2
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.

3
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 :)

4
System / warning comparison beetwen enums
« on: June 25, 2011, 10:27:58 pm »
Greeting all.
Actually that is not a big issue (code works fine), but compiler(g++) gives me a warnings and i have feeling that i am doing something not exactly correct.


Code: [Select]

        if (g_EVENT.Type == sf::Event::MouseButtonPressed)
        {
           if (g_EVENT.Key.Code == sf::Mouse::Left)              
              g_MOUSE_LEFT_BUTTON = true;

           if (g_EVENT.Key.Code == sf::Mouse::Right)
              g_MOUSE_RIGHT_BUTTON = true;
        }

And here what compilers says.

Quote

keyEventsInSpace.cpp:190:47: warning: comparison between ‘enum sf::Key::Code’ and ‘enum sf::Mouse::Button’
keyEventsInSpace.cpp:193:47: warning: comparison between ‘enum sf::Key::Code’ and ‘enum sf::Mouse::Button’


I know that is just a warnings and i may switched off those, but i am new in C++ and want to learn how to do things right.


Many thanks for attention in advance.

Pages: [1]
anything