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

Author Topic: Keeping Vertex Array Objects when closing a window  (Read 1791 times)

0 Members and 1 Guest are viewing this topic.

raster149

  • Newbie
  • *
  • Posts: 2
    • View Profile
Keeping Vertex Array Objects when closing a window
« on: January 13, 2014, 08:33:45 pm »
I was surprised to find that the only way to switch between fullscreen and windowed mode is by closing the window and reopening it in the new mode,
and since whenever the window is closed its OpenGL context is destroyed, I lose all my FBOs and VAOs.
For FBOs it's not a big deal since I have to remake them for the new window size anyway, but since I create VAO for every model whenever I load it, I would have to initialize all my meshes again, and that seems like a stupid thing to do just for switching the window mode.

Is there any other way to switch to fullscreen and back?
Is there a way to keep my VAOs when the window closes?

I'm talking about the sf::Window, not the sf::RenderWindow!

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Keeping Vertex Array Objects when closing a window
« Reply #1 on: January 13, 2014, 08:49:29 pm »
You could get the window handle and call directly operating-system-specific functions.

I think keeping the window open while changing flags was once discussed, maybe you find something. If you search, it would be nice if you posted some links here :)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: Keeping Vertex Array Objects when closing a window
« Reply #2 on: January 14, 2014, 01:11:28 am »
I think keeping the window open while changing flags was once discussed, maybe you find something. If you search, it would be nice if you posted some links here :)

I guess you meant this thread: http://en.sfml-dev.org/forums/index.php?topic=10930.msg75410#msg75410

http://en.sfml-dev.org/forums/index.php?topic=5977.msg39298#msg39298


There is also a implementation for windows.
Edit: This tweek is only a borderless resized (to screen resolution) window.

AlexAUT
« Last Edit: January 14, 2014, 01:17:58 am by AlexAUT »

raster149

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Keeping Vertex Array Objects when closing a window
« Reply #3 on: January 14, 2014, 01:19:06 pm »
I guess you meant this thread: http://en.sfml-dev.org/forums/index.php?topic=10930.msg75410#msg75410

http://en.sfml-dev.org/forums/index.php?topic=5977.msg39298#msg39298


There is also a implementation for windows.
Edit: This tweek is only a borderless resized (to screen resolution) window.

AlexAUT

I need a way to do it on all platforms, that's the main reason I'm using SFML for window creation in the first place. Resizing a borderless window would run slower since desktop remains in video memory.
I've decided I will not use VAOs at all, at least until this is fixed.