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

Author Topic: SFML not drawing anything on window [Linux, Eclipse]  (Read 4387 times)

0 Members and 1 Guest are viewing this topic.

mateus.m.luna

  • Newbie
  • *
  • Posts: 6
    • View Profile
SFML not drawing anything on window [Linux, Eclipse]
« on: February 23, 2015, 10:00:22 pm »
Hello guys.

This is my first time with SFML, I've installed the 2.2 version from the pre-compiled SDK and configured Eclipse for using it. My specs are:

- Linux Ubuntu (Gnome Version) 64bits, Kernel 3.16
- GCC 4.9.1
- Eclipse Luna
- Intel Core i7-4510U

What happens is that, whenever I try to run it, the window appears, with the correct dimensions, but the content is random. In a few times (usually the first time I compile it after a reboot), the image is drawn. But almost always what happens is that the window is filled with a sort of screenshot of the app running right under it. In other words, it's not rendering properly :P

I tried this with the simple hello world with green circle, and also with more complex stuff, like loading a texture. I suppose it is something related to my graphics card driver, but I'm not sure because I have projects on OpenGL rendering without problems.

Any tip for what should I do?

Sry for any english mistakes.


« Last Edit: February 24, 2015, 03:24:06 am by mateus.m.luna »

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: SMFL not drawing anything on window [Linux, Eclipse]
« Reply #1 on: February 23, 2015, 10:02:57 pm »
You'll need to share your code if you want any meaningful answers.

mateus.m.luna

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #2 on: February 24, 2015, 03:13:35 am »
Hi! It's really for any code, but we can use the Hello World of the SFML tutorials as example:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

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

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}
 
« Last Edit: February 24, 2015, 03:37:28 am by mateus.m.luna »

zmertens

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #3 on: February 24, 2015, 04:28:25 am »
This is just a wild guess, but are you completely sure that window.display() is being called at the end of the render loop? I notice when I test the code you posted (on Ubuntu Linux) it creates a sort of screenshot effect in the window when window.display() is commented out. Otherwise it runs fine. Did you try the SFML-Linux tutorial and just using a text editor + command line?
The truth will set you free but first it will piss you off.

mateus.m.luna

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #4 on: February 24, 2015, 05:33:08 am »
This is just a wild guess, but are you completely sure that window.display() is being called at the end of the render loop? I notice when I test the code you posted (on Ubuntu Linux) it creates a sort of screenshot effect in the window when window.display() is commented out. Otherwise it runs fine. Did you try the SFML-Linux tutorial and just using a text editor + command line?

Yes, I have similar results. But the screenshot result appears even with the window.display(). If I comment the window.draw(), thought, the window do goes black.

I've followed precisely this tutorial: http://www.sfml-dev.org/tutorials/2.0/start-linux.php

Compiling with g++ in the terminal, linking to my non-default folder where I built it, doesn't make a difference :(

Notice that the code I posted is exactly the one from the same tutorial.

zmertens

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #5 on: February 24, 2015, 09:33:36 pm »
Hm, that's weird. I wonder if it's an issue with video drivers? I'm using FGLRX now but I've used the Mesa3D open source driver before with no issues.
The truth will set you free but first it will piss you off.

mateus.m.luna

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #6 on: February 25, 2015, 06:24:38 am »
Yeah I don't know well what to do  :( ... I have the following:

Code: [Select]
glxinfo | grep OpenGL

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.3.2
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.3.2
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 10.3.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.0
OpenGL ES profile extensions:

As far as I know, 10.3.2 it's a pretty recent version...

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #7 on: February 25, 2015, 08:08:21 am »
You could always try to compile SFML from the latest GitHub master, or the very latest soon-to-be-merged gl_dev branch. If you haven't already tried, maybe compiling the 2.2 source yourself might already fix the problem.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

mateus.m.luna

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #8 on: February 28, 2015, 05:44:04 am »
You could always try to compile SFML from the latest GitHub master, or the very latest soon-to-be-merged gl_dev branch. If you haven't already tried, maybe compiling the 2.2 source yourself might already fix the problem.

Thanks a lot!  ;D

I first tried to compile with cmake the master from git, and it apparently solved the situation for drawing stuff, but the problem remained for texture loading. BUT when I tried with the g_dev_new branch it worked. It's good to see that the features that they're adding are actually helping us. I would ask for a couple more days to confirm if everything is really ok, so we can consider this as solved.
« Last Edit: February 28, 2015, 05:51:56 am by mateus.m.luna »

mateus.m.luna

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SFML not drawing anything on window [Linux, Eclipse]
« Reply #9 on: March 06, 2015, 07:23:43 pm »
Solved! I've being doing some tests an everything works really fine.

Thanks again! o/

 

anything