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

Pages: [1]
1
Window / Re: Screen flash on SFML programm start
« on: August 05, 2012, 09:12:59 pm »
The open source driver is quite slow =(
Problems with the appear with both OpenSource and proprietary driver.


2
Window / Re: Screen flash on SFML programm start
« on: August 05, 2012, 03:05:57 pm »
In addition to the issue about sf::TextureRender. I gave the code above.
Now text problem:


All of this text is a one sf::Text object.

font in attachments.

[attachment deleted by admin]

3
Graphics / Re: [SOLVED] SFML 2. Stop drawing on window
« on: August 05, 2012, 01:31:26 pm »
I discovered that the problem wasn't exactly in driver, but in nouveau-dri package (ArchLinux) that represents hardware-accelerated 3D support. If you on linux and nvidia video card - keep it in mind.

4
Window / Re: Screen flash on SFML programm start
« on: August 05, 2012, 01:27:31 pm »
I returning back to nouveau driver (open source) and problem with "flashing" disappeared.
But why in other OpenGL games there were no problems? :(

5
Window / Re: Screen flash on SFML programm start
« on: August 05, 2012, 12:40:25 pm »
Don't forget to call RenderTexture::display().
Sorry. My fault  :)

But issue about "flashing" is still open :)
Is it a problem only in the driver?

6
Window / Re: Screen flash on SFML programm start
« on: August 05, 2012, 11:45:29 am »
In addition to the issue about sf::TextureRender. I gave the code above.
This is result of drawing text on sf::TextureRender:


Please notice carefully. The original text is:
1
Lorem ipsum dolor sit
amet, consectetur
adipisicing elit, sed do
eiusmod tempor
incididunt ut labore et
dolore magna aliqua. Ut
enim ad minim veniam,
quis nostrud
exercitation ullamco
laboris nisi ut aliquip ex
ea commodo consequat.
Duis aute irure dolor in
reprehenderit in
...
 

It's hard to describe. All letters are reversed, but the text goes from left to right and from bottom to top

7
Window / Re: Screen flash on SFML programm start
« on: August 04, 2012, 10:17:11 pm »
I see, thanks for making things a bit more  clearer.
Although you don't call window.display() nor window.clear() in the first example code it sounds like this is not related to SFML, but rather a graphics card driver problem.
To test this, can you execute the examples that come with SFML? If the same thing happens it's defently not related to SFML. You could also try other applications that use OpenGL to check if there's also some flashing happening. If so you probably will have to find another graphics card driver.
Exactly. It heppens when i create window (i think). I try exmple code from http://www.sfml-dev.org/tutorials/2.0/start-linux.php and it gives me same result  :(
I try other OpenGL games, but no problems occurs with them  :-\

I guess you've compiled SFML on your own, since you're using GCC 4.7, right?
No, i use complete package from official repository of ArchLinux version 2.0rc1-2. Build from 29.07.2012

Later i'll try another driver again and write about the results.

Thanks for the reply  :)  May be you have other ideas why this is happening?

8
Window / Re: Screen flash on SFML programm start
« on: August 04, 2012, 09:26:27 pm »
Sorry, my english is very bad and may be this is the main reason why nothing is clear.

First issue:
I've no idea what you mean with 'flashing', this could be anything and nothing. Also your very vague when and where it happens... :-\

All code of program:
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(400, 300), "SFML works!");

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }
    return 0;
}
 

When i "run" this code all all screen goes black, then everything goes back and window appears. All last for about a second.
What i mean with 'flashing'.

Second issue:
When i create an sf::RenderTexture i get the same effect with all screen as i write above. I try to understand why it heppens and can i avoid it.

I gave the code above. But now i get more simple example:
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <unistd.h>

int main()
{
    sf::RenderWindow window(sf::VideoMode(400, 300), "SFML works!");
    usleep(5000000); //wait 5 second to see second screen effect
    sf::RenderTexture texture;
    texture.create(200, 200);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        window.clear();
        window.display();
    }

    return 0;
}
 

So, when i do "texture.create(200, 200);" screen goes black... everything as I described above.


You probably use the transformation wrong or similar.

The problem is that I did not use transformation.

You should also keep this thread in mind!
If you want our help you need to provide a minimal code example and describe your problems better (e.g. what sort of flashing are you mentioning) this can be illustrated with images or videos.
Most of problems cannot be illustrated with images or video. I try to describe my problems clearly, but i failed...

System:
OS: Linux (Archlinux) x86
Kernel: Linux version 3.0.38-1-lts (tobias@T-POWA-LX) (gcc version 4.7.1 (GCC) )
Video: NVIDIA Corporation G71 [GeForce 7900 GT/GTO]
Video driver: proprietary (nvidia)

9
Window / Re: Screen flash on SFML programm start
« on: August 04, 2012, 05:51:29 pm »
forgot to mention:
when i render with sf::TextureRender all text is drawn head over heels =)
Why? )

10
Window / Screen flash on SFML programm start
« on: August 04, 2012, 05:43:45 pm »
First issue:
When i start programm writing using SFML it flash on start?
Why it happens and can i somehow avoid it?

Second issue:
I try to make some text area that holds text that non fully render at the same time.
I think that prerender is good idea for this. First of all i break text to lines and store it in strings vector "lines_".
Than i found only one way to make texture with text on it - it's sf::TextureRender
Code:
    //strH - is any string height
    texture_.create(width(), (strH+lineInterval_)*lines_.size());
    texture_.clear(sf::Color::Transparent);
    sf::Text txt("", font_, 8);
    txt.setColor(sf::Color::White);
    sf::Text shdw("", font_, 8);
    shdw.setColor(sf::Color::Black);
    for(uint i = 0; i < lines_.size(); i++)
    {
        txt.setString(lines_.at(i));
        shdw.setString(lines_.at(i));
        txt.setPosition(i*(strH+lineInterval_), 0);
        switch(align())
        {
        case LEFT:
            txt.setPosition(0, i*(strH+lineInterval_));
            shdw.setPosition(1, i*(strH+lineInterval_)+1);
            break;
        case RIGHT:
            txt.setPosition(width()-txt.getGlobalBounds().width, i*(strH+lineInterval_));
            shdw.setPosition(width()-txt.getGlobalBounds().width+1, i*(strH+lineInterval_)+1);
            break;
        case CENTER:
            txt.setPosition((width()-txt.getGlobalBounds().width)/2, i*(strH+lineInterval_));
            shdw.setPosition((width()-txt.getGlobalBounds().width)/2+1, i*(strH+lineInterval_)+1);
            break;
        }
        texture_.draw(shdw);
        texture_.draw(txt);
    }
    sprite_.setTexture(texture_.getTexture());
 
Every time i use this code screen flashs... I know about texture size limit, but can i somehow avoid it?
May be use some other way to prerender text and make a texture with it.

Just in case when i make large sf::Image and later make a sf::Texture using this image screen didn't flash, why?

I'll be glad for any help with it

P.S.: Sorry for bad English

11
Graphics / Re: SFML 2. Stop drawing on window
« on: July 25, 2012, 09:28:00 pm »
I guess the examples that come with the SFML SDK work fine right?
Also is your graphics driver uptodate?

Right! Spend some hours with drivers settings i switch my noveau driver to proprietary nvidia driver and all works fine =)
Thanks for advice =)

12
Graphics / Re: SFML 2. Stop drawing on window
« on: July 25, 2012, 03:22:49 pm »
It should not and does not on my system, so it's not SFML fault, but something wrong on your end, but I've no idea what. :-\

It makes me sad =( but thanks anyway)

Btw it's a good practice to keep the updating part (moving sprites around, handeling inputs & events, etc.) seperated from the drawing part. So your sprite.move(1, 0); should come infront of the drawing statements.

Thanks =) But it just an example) I making a game and want to port it from SDL to SFML, because i found it very cool, fast and simple (Captain Obvious), but i faced with this problem =(

13
Graphics / Re: SFML 2. Stop drawing on window
« on: July 25, 2012, 02:22:55 pm »
Define "it freeze drawing on about second frame" further...
Does the sprite stop moving? (If so this shouldn't happen)
Obviously if you remove the draw call the text won't get drawn anymore = it will not show up.

If i compile code with "window.draw(text);" everithing is OK.
But if remove it sprite stop moving - yes =) but loop still continues...
I don't need text drawing, but i found that it affects on all window drawing

Additionally don't do this:
if(clock.getElapsedTime().asMilliseconds() > 1000/30)
Instead just insert after the window creation this:
window.setFramerateLimit(30);

The reason is that your method creates a busy-waiting-loop (google it for more information) and thus using all the CPU power it can get, whereas setFramerateLimit always puts the application to sleep and thus freeing CPU time. ;)
Thanks =) I keep it in mind)

14
Graphics / [SOLVED] SFML 2. Stop drawing on window
« on: July 25, 2012, 12:38:40 pm »
Hello there

I have a strange problem with drawing sprites on screen.
Here is an example:

main.cpp
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML works!");
    sf::Text text("Hello SFML\nand here am i");
    sf::Font font;
    font.loadFromFile("XPDR06.TTF");
    text.setFont(font);
    text.setCharacterSize(8);
    sf::Texture texture;
    texture.loadFromFile("sprite.png");
    sf::Sprite sprite(texture);
    sf::Clock clock;
    while (window.isOpen())
    {
        if(clock.getElapsedTime().asMilliseconds() > 1000/30)
        {
            sf::Event event;
            while (window.pollEvent(event))
            {
                if (event.type == sf::Event::Closed)
                    window.close();
            }
            window.clear();
            window.draw(text);
            sprite.move(1,0);
            window.draw(sprite);
            window.display();
            clock.restart();
        }
    }

    return 0;
}
 

It works fine, but if i delete "window.draw(text);" it freeze drawing on about second frame.
What i do wrong? :'(
I spend a lot of time to find the place, that affect on process...

Is it bug? or it's my mistake?
Thanks anyway =)

PS: Sorry for bad English

Pages: [1]