SFML community forums
Help => Graphics => Topic started by: lorence30 on May 06, 2015, 08:21:33 pm
-
#include "SFML/Graphics.hpp"
int main()
{
sf::RenderWindow w(sf::VideoMode(500,500),"test");
sf::CircleShape player(10.0f);
while( w.isOpen() )
{
sf::Event event;
while ( w.pollEvent(event) ){
if ( event.type == sf::Event::Closed )
w.close();
}
w.clear();
w.draw(player);
w.display();
}
}
hello, good morning.
can i ask why the program above crash when executing w.draw(player); ?
Im using SFML 2.2
thanks.
-
There could be many reasons.
Step 1. Use a debugger to find out.
Some things that often trip up people that you should check:
- are your graphics drivers up-to-date? (SFML needs a OpenGL context v. 1.2 as a minimum and Windows default drivers don't provide that).
- are you certain that the library (SFML) and your application is built with the same compiler (yes, even minor version differences matter)?
- are you sure you are not mixing release and debug builds of the library and your application?
There can be other things wrong, but let's start with the above...
-
thanks.
- are your graphics drivers up-to-date? (SFML needs a OpenGL context v. 1.2 as a minimum and Windows default drivers don't provide that).
no, im going to update.
- are you certain that the library (SFML) and your application is built with the same compiler (yes, even minor version differences matter)?
i didnt built sfml, i use the binary release with code blocks.
-
You didn't build SFML - that's ok. But then you have to make sure that the compiler you use to build your app is the exact same that was used to build the SFML binaries you downloaded. If not, you are going to have problems. (the easy way to dodge this problem is to just build SFML yourself - it's easy).
-
i tried to build it in VSE successfully, is there any tutorial for codeblocks?
-
yes, look in the tutorials (in the learn section of the main website) section, it has both a codeblocks with minGW tutorial as well as the CMake one which has been recommended so many times because you need to build the library yourself for many reasons.
-
http://www.sfml-dev.org/tutorials/2.2/compile-with-cmake.php
-
Hello guys, thanks for commenting.
I already build SFML for debug mode, but still crashing when rendering. what do i do now?
-
Can you guys tell me if im using the correct binary?
GCC 4.7.1 TDM (SJLJ) - 32-bit for my codeblocks 13.12 mingw with gnu gcc compiler.
-
im getting a segmentation fault when i use the debugger of codeblocks ( see the picture below )
hope that helps
-
Did you update your driver by now?
-
Did you update your driver by now?
Youre the one who helped me last time.
Yes i already updated my driver to the latest.
I havent programmed in SFML 2.2 in my life, when i was using VS community, im force to use 2.1 of nightly builds to avoid this issue.
But now even 2.1 isnt working.
-
Ah if you're using SFML 2.1 then the issue is, that you're using the wrong headers.
Delete your current headers and copy the 2.2 headers.
-
Ah if you're using SFML 2.1 then the issue is, that you're using the wrong headers.
Delete your current headers and copy the 2.2 headers.
You're the man bro!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
but i am still using 2.1 right?
SFML 2.2 isnt fix?
-
Btw this forum has dedicated quoting features by using the [quote][/quote] tags. Would make it easier to understand your posts if you used them.
but i am still using 2.1 right?
SFML 2.2 isnt fix?
I don't know what you use. And SFML 2.2 isn't broken, so I don't know what the issue was/is?
-
Btw this forum has dedicated quoting features by using the [quote][/quote] tags. Would make it easier to understand your posts if you used them.
Just figured it out.
by the way, can you take a look at the picture below.
It always show up in my console window when rendering in sfml window
-
What's your OS, your GPU and your GPU driver version?
-
Windows 7 ultimate
Mobile Intel (R) 965 Express Chipset Family 15.12.75.4.64.1930
-
Just use SFML 2.3. Your graphics chip is so old that you probably don't have a driver that provides proper OpenGL hardware acceleration on Windows. SFML 2.3 will work even without full hardware accelerated OpenGL without crashing. It will be slow, but at least it will work.