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

Author Topic: Adjusting resolution  (Read 2031 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Adjusting resolution
« on: November 04, 2011, 02:42:24 pm »
Hi

I have a game which opens a window like this:

Code: [Select]

window1(RenderWindow(sf::VideoMode(1280,1024,32),"Window1",sf::Style::None));


Later, I re-size the window to fit the actual dimensions of the size I want (so all my graphics are done to 1280x1024@32bpp, but I might want a window of whatever size, maybe 50% size, etc).

Code: [Select]
window1.SetSize(scr1Data.right,scr1Data.bottom);
window1.SetPosition(scr1Data.left,scr1Data.top);


My problem is that I have systems where the default resolution is, for example, 800x600, but the hardware will support 1280x1024, no problem. When I try to open a window, all I get is an empty, black, window.

So how do I adjust the OS resolution (if I even need to?!) so that my window opens correctly and the program works?

Thanks
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Adjusting resolution
« Reply #1 on: November 04, 2011, 02:49:57 pm »
You can change the screen resolution only if your window runs in fullscreen mode.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Adjusting resolution
« Reply #2 on: November 04, 2011, 03:05:21 pm »
Quote from: "Laurent"
You can change the screen resolution only if your window runs in fullscreen mode.


Right, I've changed that - and my framerate has dropped massively.

If I open it in a window (and manually change the resolution) it runs 60fps+ no problem, run it in fullscreen, I might get 3fps.

What is going on?!
SFML 2.1

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Adjusting resolution
« Reply #3 on: November 04, 2011, 03:42:55 pm »
My game uses ~400mb of memory, and the hardware has 340mb of video memory, so I guess it is swapping stuff in and out of VRAM...but that doesn't explain why windowed mode is faster.....
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Adjusting resolution
« Reply #4 on: November 04, 2011, 04:14:38 pm »
It's really strange. Could you provide a complete and minimal example that reproduces this problem?

Quote
My game uses ~400mb of memory

That's really a lot. Are you sure that all of these 400 MB go to VRAM? Is it pixel data?
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Adjusting resolution
« Reply #5 on: November 04, 2011, 04:47:36 pm »
I kind of solved it. It was swapping data from system to video memory during an intensive animation.

Yes all 400mb is pixel data, I have ~60mb of PNGs loaded, and I guess when they are decompressed, that's where the 400mb comes from.
SFML 2.1