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

Author Topic: please help!!! SFML Crash on App.Clear() and App.Display()  (Read 8770 times)

0 Members and 1 Guest are viewing this topic.

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« on: February 17, 2011, 09:29:13 pm »
Ok, so I've been using sfml for the past 2 weeks, was awesome.
Starting making a BIG project, and all of a sudden my programs that use sfml went to sh*t.

It seems to crash at App.Clear() or App.Display()
I've used both Window and RenderWindow and before using RenderWindow works great.

I recently had a stable game, saved it. next day I go to load it and run it, it crashes on those lines, why?

Here's a sample code.
Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>


int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Test Program");
while (App.IsOpened())
{
        sf::Event Event;
        while (App.GetEvent(Event))
        {
               // Window closed
               if (Event.Type == sf::Event::Closed)
                   App.Close();

               // Escape key pressed
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
  App.Close();


        }

        App.Clear(sf::Color(130, 130, 255));
        App.Display();
}
    App.Close();
    return EXIT_SUCCESS;
}


I originally used CodeBlocks as my IDE, and it started crashing there.
Tried VC++ and it crashed there as well.

I am using -d libs for debugging.
and not using release for debug.

my libs are correct, and this suddenly started happening.

It's frustrating me to the point of not wanting to program anymore, please help!

//Edit if it helps any:
SFML-1.6
CodeBlocks

SFML-1.6 VC++ version, VC++2008

Windows vista, 3gb ram, dual core processor, yada-yada...

ThunderManEX

  • Newbie
  • *
  • Posts: 3
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #1 on: February 17, 2011, 09:47:43 pm »
Any recent updates to your ATI drivers?

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #2 on: February 17, 2011, 09:49:04 pm »
Quote from: "ThunderManEX"
Any recent updates to your ATI drivers?


Not that I know of.

if it helps I have an ATI RadeonX1200

DoctorJ

  • Newbie
  • *
  • Posts: 21
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #3 on: February 17, 2011, 09:54:32 pm »
I just ran your code on my Code::Blocks system - works ok. The problem must lie with libraries and or settings. For example, CB/mingw needs that darn "libgcc_s_dw2-1.dll" to execute. Perhaps something got deleted or corrupted or a directory changed - something to that effect.

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #4 on: February 17, 2011, 10:16:05 pm »
Quote from: "DoctorJ"
I just ran your code on my Code::Blocks system - works ok. The problem must lie with libraries and or settings. For example, CB/mingw needs that darn "libgcc_s_dw2-1.dll" to execute. Perhaps something got deleted or corrupted or a directory changed - something to that effect.


Just downloaded them again and reset all of them...still nothing...

=/

DoctorJ

  • Newbie
  • *
  • Posts: 21
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #5 on: February 18, 2011, 03:09:40 am »
Well,, the code is inherently ok but something is amiss. You can try the following:
Code: [Select]
//#include <SFML/System.hpp>
//#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
   sf::RenderWindow App(sf::VideoMode(400, 200, 32), "Test Program");
   while (App.IsOpened())
   {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
               // Window closed
               if (Event.Type == sf::Event::Closed)
                   App.Close();

               // Escape key pressed
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
               App.Close();

               // "M" key pressed
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::M))
               std::cout << "M";

        }

//        App.Clear(sf::Color(130, 130, 255));
//        App.Display();
   }
    App.Close();
    return EXIT_SUCCESS;
}

This should present an "empty" window and when you type "m", it will appear in the console window.
Also, perhaps check on the order of the library linking - I think you need to be sure "graphics" preceeds "window"

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #6 on: February 18, 2011, 04:25:23 am »
Quote from: "DoctorJ"
Well,, the code is inherently ok but something is amiss. You can try the following:
Code: [Select]
//#include <SFML/System.hpp>
//#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
   sf::RenderWindow App(sf::VideoMode(400, 200, 32), "Test Program");
   while (App.IsOpened())
   {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
               // Window closed
               if (Event.Type == sf::Event::Closed)
                   App.Close();

               // Escape key pressed
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
               App.Close();

               // "M" key pressed
               if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::M))
               std::cout << "M";

        }

//        App.Clear(sf::Color(130, 130, 255));
//        App.Display();
   }
    App.Close();
    return EXIT_SUCCESS;
}

This should present an "empty" window and when you type "m", it will appear in the console window.
Also, perhaps check on the order of the library linking - I think you need to be sure "graphics" preceeds "window"


Ran your code and it works perfectly fine.

but if I uncomment App.Clear and App.Display

it brings an error here
Code: [Select]
     
 App.Clear(sf::Color(130, 130, 255)); <- Here
  App.Display();


Also the code you gave me only errors on Exit...

Contadotempo

  • Full Member
  • ***
  • Posts: 167
  • Firelink Shrine
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #7 on: February 18, 2011, 03:43:11 pm »
Quote from: "cooldog99"

but if I uncomment App.Clear and App.Display

it brings an error here
Code: [Select]
     
 App.Clear(sf::Color(130, 130, 255)); <- Here
  App.Display();



The only possible error I see there is the missing alpha argument on sf::Color, but even then it should compile with default 255 alpha.

What errors did you get on exit?
What if you try using non-debug libs or static?

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #8 on: February 18, 2011, 06:46:36 pm »
Quote from: "Contadotempo"
Quote from: "cooldog99"

but if I uncomment App.Clear and App.Display

it brings an error here
Code: [Select]
     
 App.Clear(sf::Color(130, 130, 255)); <- Here
  App.Display();



The only possible error I see there is the missing alpha argument on sf::Color, but even then it should compile with default 255 alpha.

What errors did you get on exit?
What if you try using non-debug libs or static?


no errors on exit (my fault lol), I'm using debug libs for debug, NOT static.

DoctorJ

  • Newbie
  • *
  • Posts: 21
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #9 on: February 18, 2011, 07:56:47 pm »
What happens if you leave App.Clear commented but uncomment App.Display ? It should present the window with a black background.

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #10 on: February 18, 2011, 10:41:18 pm »
Quote from: "DoctorJ"
What happens if you leave App.Clear commented but uncomment App.Display ? It should present the window with a black background.


throws an exception like before on App.Display();

Does it help any if I said when I was using codeblocks and sfml I crashed my computer a few times due to an improper code...?

DoctorJ

  • Newbie
  • *
  • Posts: 21
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #11 on: February 19, 2011, 12:17:38 am »
Well, it appears that SFML is not acquiring a valid handle to an openGL rendering context. Any drawing to the screen will then cause an error/crash. The most likely culprit is the video driver.
One last thing you can try is to replace the RenderWindow line with the following:
Code: [Select]
  sf::RenderWindow App(sf::VideoMode::GetDesktopMode(), "Test Program", sf::Style::Resize|sf::Style::Close);
   App.SetSize(400, 200) ;

This should give you the best chance of acquiring a valid render context by using the current pixel format descriptor. (things you don't really care about - thats why you want to use SFML :)) The SetSize is just there to make the window easier to move around.

cooldog99

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • Perilous Game Studios
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #12 on: February 19, 2011, 12:19:44 am »
Quote from: "DoctorJ"
Well, it appears that SFML is not acquiring a valid handle to an openGL rendering context. Any drawing to the screen will then cause an error/crash. The most likely culprit is the video driver.
One last thing you can try is to replace the RenderWindow line with the following:
Code: [Select]
  sf::RenderWindow App(sf::VideoMode::GetDesktopMode(), "Test Program", sf::Style::Resize|sf::Style::Close);
   App.SetSize(400, 200) ;

This should give you the best chance of acquiring a valid render context by using the current pixel format descriptor. (things you don't really care about - thats why you want to use SFML :)) The SetSize is just there to make the window easier to move around.


Ok can I ask two questions?
How do I check my catalyst version?
if It's it's too new, how do I find an older version?

/edit that didn't work...

if this is of any help, here's my callstack

Code: [Select]
043e1480()
  atioglxx.dll!690d80e2()
  [Frames below may be incorrect and/or missing, no symbols loaded for atioglxx.dll]
  atioglxx.dll!6908d2b5()
  atioglxx.dll!6908d165()
  atioglxx.dll!6908227c()
  atioglxx.dll!6907b0ff()
  atioglxx.dll!6907b055()
  atioglxx.dll!6907b18f()
  sfml-graphics-d.dll!1019a24a()
> sfmltest.exe!main()  Line 28 + 0x38 bytes C++
  sfmltest.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes C
  sfmltest.exe!mainCRTStartup()  Line 403 C
  kernel32.dll!76e8d0e9()
  ntdll.dll!76f616c3()
  ntdll.dll!76f61696()

DoctorJ

  • Newbie
  • *
  • Posts: 21
    • View Profile
please help!!! SFML Crash on App.Clear() and App.Display()
« Reply #13 on: February 19, 2011, 01:06:27 am »
You might try reinstalling the driver from the manufacturer. FWIW, older versions of catalyst are available at: http://downloads.guru3d.com/Videocards---ATI-Catalyst-Vista---Win-7_c31.html

reddev86

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Error i also get
« Reply #14 on: February 19, 2011, 01:19:41 am »
Quote from: "DoctorJ"
You might try reinstalling the driver from the manufacturer. FWIW, older versions of catalyst are available at: http://downloads.guru3d.com/Videocards---ATI-Catalyst-Vista---Win-7_c31.html


i also get this error and i've upgraded my video drivers:

specs: windows vista, ati radeon x1200, 2gb ram, 2.0ghz

tho im using sfml 1.5 and codeblocks 10.05 w/ the mingw compiler it came with.

edit: no im not. make sure the dlls in system32 are up to date or the same as the version of sfml you are using.

 

anything