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

Author Topic: Basic rendering crashing  (Read 14389 times)

0 Members and 3 Guests are viewing this topic.

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Basic rendering crashing
« on: January 13, 2015, 11:41:40 pm »


I have followed all the tutorial and I have linked to every dependant files like the tutorial asked me to just like opengl32 and etc, and the creating the window works, but when I try to render a basic shape similar to the one in the tutorial my window crashes with no error, and this seems strange because nobody else seems to be having the same problem or if they do, they don't have the same complaints on debugging mode(shown above).
What could be the problem? I thoroughly apologise if this is a stupid question

Oh, also, my first post :D nice to meet you all

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Basic rendering crashing
« Reply #1 on: January 14, 2015, 04:12:25 am »
Do you older headers lying around? If you upgarded to SFML 2.2 make sure to fully replace your headers, libraries and DLLs.

Also provide the full build command: http://www.sfml-dev.org/faq.php#tr-grl-verbose-ide
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #2 on: January 14, 2015, 11:08:17 pm »
Checking for existence: C:\Users\family\Desktop\C++ programming studies\January 2015\Hello World!\bin\Debug\Hello World!.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Users\family\Desktop\C++ programming studies\January 2015\Hello World!\bin\Debug\Hello World!.exe"  (in C:\Users\family\Desktop\C++ programming studies\January 2015\Hello World!\.)

I just got this hard drive from my friend because my old hard drive broke. It seems that the program builds perfectly fine and runs fine, but it keeps crashing. If I remove code and just try to create a window, the window opens up fine. It's just when I try to render the graphics.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Basic rendering crashing
« Reply #3 on: January 14, 2015, 11:14:51 pm »
Is your graphics driver uptodate?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #4 on: January 14, 2015, 11:25:40 pm »
Could you provide a simple self-contained minimal example program that causes the crash (just a main() function with the minimum required to cause the problem)?
That would make it easier for others to check it for correctness/bugs and test on their own machine.

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #5 on: January 14, 2015, 11:55:22 pm »

#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;
}


 

That's literally all I need to do. To render. The example code in the tutorial alone is enough to cause problem. The graphic driver I updated, re-downloaded, tried everything. I guess this just doesn't work for me haha  :P

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #6 on: January 15, 2015, 12:02:59 am »
I just tried the exact code you posted on my system (CentOS 7 with clang 3.5 and GCC 4.8.2) and it works just fine - no crashes.

Could you run that simple program in a debugger and provide us with a backtrace from when it crashes?

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #7 on: January 15, 2015, 12:12:34 am »
If you look at the image in the OP that is all I'm getting in the debugger

D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp: No such file or directory.
#1  0x00404c18 in sf::RenderTarget::applyBlendMode (this=0x28fce8, mode=...) at D:\sfml-release\_Sources\SFML\src\SFML\Graphics\RenderTarget.cpp:445

Apparently RenderTarget doesn't exist?!

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #8 on: January 17, 2015, 03:17:39 pm »


this is how I linked it. Perhaps this is what's causing the problem?

As soon as I add

window.draw(shape);

it crashes. I know where the problem is coming from, I just have no idea how to fix it
« Last Edit: January 17, 2015, 03:39:31 pm by JollyGent »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Basic rendering crashing
« Reply #9 on: January 17, 2015, 03:58:29 pm »
The BlendMode API changed with SFML 2.2, so if you use the SFML 2.2 headers and import libraries but when you run it use the old SFML 2.1 DLLs it won't find the new BlendMode bits.

Have you made certain that the headers, the import libraries AND the used DLLs are using SFML 2.2? Also did you remove ALL the old SFML 2.1 files? ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #10 on: January 17, 2015, 04:15:10 pm »
I didn't have any 2.1 files in first place so I don't think I can have 2.1 DLLS I kept deleting and re-downloading over and over again D:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Basic rendering crashing
« Reply #11 on: January 17, 2015, 06:56:28 pm »
Well then lets start from the beginning:

  • Where did you get your compiler from (file name)?
  • What SFML package did you download (package name)?

If you got codeblocks-13.12mingw-setup.exe, then you need GCC 4.7.1 TDM (SJLJ) - 32-bit package.
If you got codeblocks-13.12mingw-setup-TDM-GCC-481.exe, then you need GCC 4.8.1 TDM (SJLJ) - 32-bit
If you got i686-4.9.2-release-posix-dwarf-rt_v3-rev0, then you need GCC 4.9.2 MinGW (DW2) - 32-bit package.

If you got another compiler, then you most likely have to build from source.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

JollyGent

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Basic rendering crashing
« Reply #12 on: January 18, 2015, 01:20:14 am »
I have checked and I am sure that I am using the correct versions and compilers.

Since the window.draw(shape) is what's causing the problem, I wondered if it's the driver that is causing the problem, so I tried to open a random steam game and here was the result:



I have checked the device manager and:



Apparently I need to disable a graphics driver in order for my actual driver to work, however as you can see from the device manager I only have one graphics driver(Intel graphics HD) available. Maybe it's due to the fact that this hard drive is not mine but my friend's, so I deleted his AMD catalyst graphics driver, but that doesn't seem to cut it.

It seems like it's the driver. In which case, I don't think there is a resolve to. :(

Ivan

  • Newbie
  • *
  • Posts: 32
  • IT geek
    • View Profile
Re: Basic rendering crashing
« Reply #13 on: January 18, 2015, 07:00:16 pm »
Hi, sorry for not open a new thread, I don't see the need because I think I have the same problem with SFML 2.2 in my Desktop PC.

Normally I work on my laptop and SFML 2.2 works perfect. Yesterday I tried to run my project in my Desktop PC and doesn't work.
If I compile with SFML 2.1 runs OK, but if I try to SFML 2.2, compiles fine but crash on run.

Desktop info:

Windows XP Home Edition SP3
CPU Intel Pentium 4 2.53 GHz
RAM 1.5 GB
ATI radeon 9000 Pro graphics card (driver update at least version, I think)

I use: Codeblocks 13.12 (codeblocks-13.12mingw-setup.exe) with GCC 4.7.1 TDM (SJLJ) 32-bit
         SFML 2.2 version GCC 4.7.1 TDM (SJLJ) 32-bit (SFML-2.2-windows-gcc-4.7.1-tdm-32-bit)

For example if I try with this simple code:

#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(sf::Color::Red);
        window.draw(shape);
        window.display();
    }

    return EXIT_SUCCESS;
}


Compiles fine but doesn't run. If I comment the drawing call ( window.draw(shape)), works perfect and show a red window. So the problem it's on rendering.

I debugged a simple code and crashes on render function. I get this error messages:

Quote
Error while reading shared library symbols for C:\Archivos de programa\CodeBlocks\MinGW\bin\libstdc++-6.dll
Process terminated with status -1073741510
Process terminated with status -1073741819

Screenshot with error message and output verbose build information:





Any idea what I'm doing wrong? Thanks!


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Re: Basic rendering crashing
« Reply #14 on: January 18, 2015, 07:27:44 pm »
ATI radeon 9000 Pro graphics card (driver update at least version, I think)
Don't think, make sure! ;)

You've added -static-libstdc++ to thd compiler flags. This a) does not work with the TDM compiler and b) SFML's CMake script explicitly disallows using static runtime libs with dynamic SFML and thus you shouldn't try to mix things.
However since the default behavior of TDM compilers is to link the runtime libs statically, you'll have to add -shared-libstdc++ and -shared-libgcc (or similar).

Additionally the window module depends on gdi32 and winmm, as such they need to be a least on after the window module, better yet put them after all the SFML libs.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/