SFML community forums
Help => Window => Topic started by: robvleugel on March 31, 2012, 02:13:56 pm
-
Ugh now what, everything seemed to work fine yesterday, but today started to open my game again and I suffered from another breakpoint memory error. I deleted basicly all of my game code and it comes down to the code below:
It breaks at WglContext.cpp
void WglContext::display()
{
if (m_deviceContext && m_context)
SwapBuffers(m_deviceContext);
}
Output window:
+ m_context 0x00010002 {unused=0 } HGLRC__ *
+ m_deviceContext 0x590118ed {unused=??? } HDC__ *
+ this 0x09224fd0 {m_window=0x0010085a m_deviceContext=0x590118ed m_context=0x00010002 ...} sf::priv::WglContext * const
My code:
#include <SFML\Graphics.hpp>
int main()
{
sf::RenderWindow m_app;
m_app.create(sf::VideoMode(500, 500, 32), "MyProgram");
while(true)
{
m_app.clear(sf::Color(65,5,23));
m_app.display();
}
return 0;
}
Because this code is so basic (and because the example program on the documentation website gives me the same error), it can't be my code right?
I downloaded the newest snapshot of SFML2 and build/installed it but it still gives me the same error.
I'm pretty sure I'm linking with the static debug libraries correctly, as I did not change anything and it used to work fine til today. Removing the "m_app.display();" makes it run.
Linking with:
sfml-system-s-d.lib;sfml-window-s-d.lib;sfml-graphics-s-d.lib;libpq.lib;%(AdditionalDependencies)
What is going on here? I'm completely clueless.
-
I have no idea why there is 'breakpoint' in the title or description, also I don't quite get when it crashes.
SFML has some troubles with it's context handling so we need a little bit more information.
The code looks fine btw, although you should use #include <SFML/Graphics.hpp for various reasons. MSVC will understand it.
- Which compiler do you use? (Okay it's obvious that you use MSVC, but always state this!)
- What are your computer specs, specially GPU?
- When does it break (start, exit, calling display(), etc.)?
-
Ow sorry forgot about that, the error I get is:
"Unhandled exception at 0x0af28e0b in MyProgram.exe: 0x0000005: Acces violation reading location 0x0b0f7cf8
[Break] [Continue]
An error like this usually means reading to an unitialized variable.
Running in debug mode, it breaks when calling m_app.display();
I'm using MS Visual studio express edition, on a HP laptop running Windows 7 (intel i5 core with ATI mobility Radeon), 4gig ram.
-
After rebooting my system everything works fine again.
Weird..
-
After rebooting my system everything works fine again
You should always do that first, when something that has always worked suddenly breaks without any modification ;)
-
After rebooting my system everything works fine again
You should always do that first, when something that has always worked suddenly breaks without any modification ;)
Yeah, or pull the plug and put it back in.
That's actually how I could've fixed this one as well.
It seems my laptop changes to some other graphics mode when I remove the power cable to save on the battery. It turns out SFML does not work while in this mode, which is strange as most other applications run just fine. I had the power cable back in when this message appeared in the morning, but I guess I forgot to press the "change graphic mode" button on the popup that appears.
I can reproduce the error now simply by changing to this mode.