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

Author Topic: sf::WindowSettings access violation  (Read 7204 times)

0 Members and 1 Guest are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
sf::WindowSettings access violation
« on: September 02, 2008, 08:59:57 pm »
Hi,
when I use the following code:
Code: [Select]
sf::WindowSettings Settings(24, 8, 4);
sf::RenderWindow App(sf::VideoMode(500, 300), "app", sf::Style::Close, Settings);
or
Code: [Select]
sf::RenderWindow App(sf::VideoMode(500, 300), "app", sf::Style::Close, sf::WindowSettings(24, 8, 4));, I get the following error:
Quote
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:
Code: [Select]
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...?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::WindowSettings access violation
« Reply #1 on: September 02, 2008, 09:26:11 pm »
Are you linking to the debug libraries in debug build ?
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
sf::WindowSettings access violation
« Reply #2 on: September 02, 2008, 10:38:58 pm »
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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
sf::WindowSettings access violation
« Reply #3 on: September 10, 2008, 03:24:07 pm »
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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

zarka

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
sf::WindowSettings access violation
« Reply #4 on: September 10, 2008, 05:29:10 pm »
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 ...
//Zzzarka

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
sf::WindowSettings access violation
« Reply #5 on: September 10, 2008, 07:26:03 pm »
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:
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
sf::WindowSettings access violation
« Reply #6 on: September 11, 2008, 02:38:33 pm »
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
Code: [Select]
0xC0000005
An older compile however runs fine.

kdmiller3

  • Newbie
  • *
  • Posts: 5
    • View Profile
sf::WindowSettings access violation
« Reply #7 on: September 11, 2008, 10:49:42 pm »
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::WindowSettings access violation
« Reply #8 on: September 12, 2008, 11:03:26 am »
Ok I see, I recently changed this part of the code. I'll fix this issue as soon as possible.

Thanks for your feedbacks :)
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::WindowSettings access violation
« Reply #9 on: September 12, 2008, 03:11:29 pm »
Is everything ok now ?
Laurent Gomila - SFML developer

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
sf::WindowSettings access violation
« Reply #10 on: September 12, 2008, 03:56:33 pm »
Ok, I did a clean svn checkout, but it's still not working.
BTW: It works on my 8800GTX, as opposed to kdmiller3s one.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
sf::WindowSettings access violation
« Reply #11 on: September 12, 2008, 04:02:31 pm »
Are you creating your window at global startup ?
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
sf::WindowSettings access violation
« Reply #12 on: September 12, 2008, 04:29:06 pm »
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!
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Avency

  • Full Member
  • ***
  • Posts: 113
    • View Profile
sf::WindowSettings access violation
« Reply #13 on: September 12, 2008, 05:00:42 pm »
I also compiled the opengl-sample, which produces the same error.

kdmiller3

  • Newbie
  • *
  • Posts: 5
    • View Profile
sf::WindowSettings access violation
« Reply #14 on: September 13, 2008, 07:21:57 am »
Yup, that works for me too.  Hurrah!