SFML community forums
Help => Graphics => Topic started by: Nexus on September 02, 2008, 08:59:57 pm
-
Hi,
when I use the following code:sf::WindowSettings Settings(24, 8, 4);
sf::RenderWindow App(sf::VideoMode(500, 300), "app", sf::Style::Close, Settings);
orsf::RenderWindow App(sf::VideoMode(500, 300), "app", sf::Style::Close, sf::WindowSettings(24, 8, 4));
, I get the following error:
Uncaught exception at 0x00000000 in Project.exe: 0xC0000005: Access violation. (translated)
If I set the AntiAliasing value to zero, it works just fine. Every other value leads to crash.
When running in debug mode, it stops in file "WindowImplWin32.cpp" at line 450 (function WindowImplWin32::CreateContext()). The code in this line is:
bool IsValid = wglChoosePixelFormatARB(myDeviceContext, IntAttributes, FloatAttributes, sizeof(Formats) / sizeof(*Formats), Formats, &NbFormats) != 0;
The variable myDeviceContext seems to be corrupted, myHandle too. wglChoosePixelFormatARB shows the value 0 (0x00000000), IsValid is true...
The problem is, I reinstalled MSVC++ and redownloaded SFML some days ago - before everything worked fine. I also recompiled the SFML libraries, and I think I am linking to the correct version.
Maybe it's not SFML's fault, since it always worked in past... But I can't really imagine how this can happen...?
-
Are you linking to the debug libraries in debug build ?
-
Yes, in debug mode I link to:
sfml-window-s-d.lib sfml-system-s-d.lib sfml-graphics-s-d.lib
And in release to:
sfml-window-s.lib sfml-system-s.lib sfml-graphics-s.lib
The access violation occurs in both release and debug build. At debug only I get to the file where the error occurs...
But as I said, it's really strange, I'm not sure at all if it's a SFML problem because I haven't ever had this yet.
-
Now I reinstalled MSVC++ and downloaded the newest SFML svn version. Unfortunately, the problem further exists. I really don't know what I can do...
Isn't there anyone having similar problems? Is there certainly no bug or something in sf::WindowSettings or sf::RenderWindow?
P.S.: The error occurs both in static and dynamic link against SFML.
-
what kind of graphics card do you use ? ... he does invoke an ARB function .. which could possibly be NULL since i belive it depends on your graphics driver ...
-
I use a NVIDIA GeForce 6100 nForce 405. I updated its driver, but the result remains the same.
Some weeks ago, i had to reinstall windows on this computer. Before everything went perfectly, it's really strange... :roll:
-
I now noticed the same problem.
On my new computer everything runs fine, but on my old computer, there are problems with the ati opengl driver (crash - atioglxx.dll). I get the same error code 0xC0000005
An older compile however runs fine.
-
I get the same problem. It looks like wglGetProcAddress("wglChoosePixelFormatARB") in WindowImplWin32::CreateContext() returns NULL, so the attempt to use it crashes. I'm running an NVIDIA GeForce 8800GTX with driver version 175.19 if it matters.
SDL's ChoosePixelFormatARB function creates a (dummy) window, gets the device context, sets the pixel format, creates an OpenGL context, finds the wglGetExtensionsStringARB function, uses that (if found) to get extensions, finds the wglChoosePixelFormatARB function, uses that (if found) to pick a pixel format, releases the OpenGL context, releases the device context, and destroys the window. Only then does it use that pixel format to create a new window with the appropriate OpenGL context.
From what I've read, those functions require a functioning OpenGL context to work, even if that means you have to create a dummy one first.
-
Ok I see, I recently changed this part of the code. I'll fix this issue as soon as possible.
Thanks for your feedbacks :)
-
Is everything ok now ?
-
Ok, I did a clean svn checkout, but it's still not working.
BTW: It works on my 8800GTX, as opposed to kdmiller3s one.
-
Are you creating your window at global startup ?
-
At me it works now. Thanks a lot, Laurent! :)
BTW: In the last days, performance of SFML was very bad in my programs. This seems to be fixed now, too! Thank you!
-
I also compiled the opengl-sample, which produces the same error.
-
Yup, that works for me too. Hurrah!
-
Does anyone use the svn-version of sfml in combination with an ati card?
So far all my experiments with various ati cards have failed.