Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (525)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Toggling vsync  (Read 3822 times)
0 Members and 1 Guest are viewing this topic.
Offline Andrew Davison

Junior Devvie


Medals: 2



« Posted 2004-02-25 23:28:15 »

Dear All,

In fullscreen mode, show() is tied to the vsync rate,
which can slow games down.

Is there a Java-based way of turning vsync on and
off?

I've heard that there's an OpenGL extension which
can do this, so perhaps JOGL may be be useful?

- Andrew

Dr. Andrew Davison
Dept. of Computer Engineering
Prince of Songkla University, Hat Yai
Songkhla 90112, Thailand
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #1 - Posted 2004-02-25 23:59:19 »

What happens when you have more than 2 buffers in you BufferStrategy ?
V-sync is usually desirable to avoid tearing - so long as you can keep up and not cause the frame rate to drop in half if your rendering takes a bit too long.

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #2 - Posted 2004-02-26 00:42:51 »

It maybe possible through the
createBufferStrategy(int numBuffers, BufferCapabilities caps) method (though I dont think it is)

The only other way of turning vsync off in fullscreen, is to not use BufferStrategy at all, and use your own VolatileImage backbuffer. (this would be less efficient though, as you wouldn't be page flipping anymore)
Seems a waste to have to recode something like that though, just because no1 had the for-thought to include it in the BufferStrategy api :-/

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #3 - Posted 2004-02-26 04:26:37 »

Setting the  BufferCapabilities.FlipContents to something like COPIED will probably force a blit rather than a simple page flip/pointer swap. Whether this makes it no longer v-sync'ed is another matter.

But even on the worst displays you're going to be getting 60fps, is that really 'too slow'? If you're after a performance measure can't you just test it in windowed mode?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Online princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2004-02-26 07:15:28 »

I wish people would stop requesting to be able to turn off vsync. Nothing runs any faster with it on or off. It was a myth created by Quakeworld players due to a quirk in the design of Quakeworld.

Games without vsync look shit, period.

Cas Smiley

Offline kevglass

« JGO Spiffy Duke »


Medals: 208
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #5 - Posted 2004-02-26 07:19:40 »

To elaborate on this, I think what Cas is saying is don't tie your logic loop processing time to your rendering time. Fix you render loop at what ever FPS you want and only redraw that often. However, this doesn't negate you running your logic loop more often if you really feel you need to (although of course you won't see any changes on screen due to your logic resolution).

A useful thing would be to turn vsync on in windowed mode Smiley

Kev

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #6 - Posted 2004-02-26 10:04:12 »

Quote
I wish people would stop requesting to be able to turn off vsync. Nothing runs any faster with it on or off. It was a myth created by Quakeworld players due to a quirk in the design of Quakeworld.

Games without vsync look shit, period.

Cas Smiley


I disagree, if your game running flat out gets ~50fps, on a 60hz vsync locked display, you are going to get alot less than 50fps. (somewhere in the region of 30fps)

In that scenario, it is alot better to turn vsync off, and get as much upto-date information to the screen as possible, 2/3rds of a screen update is better than no screen update.
Also, tearing in 3d games realy isn't that noticable.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Online princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2004-02-26 10:11:12 »

How can you say 2/3rds of a screen update is better than no update when it will be 1/3rd incorrect?

As I say - it is a Quake-player originated, developer-perpetuated illusion that 30fps on a 60Hz display is worse than 50fps on a 60Hz display. But I can't prove it to anyone Smiley You just have to do the experiments yourself.

Cas Smiley

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #8 - Posted 2004-02-26 10:24:15 »

Quote
Setting the  BufferCapabilities.FlipContents to something like COPIED will probably force a blit rather than a simple page flip/pointer swap. Whether this makes it no longer v-sync'ed is another matter.

But even on the worst displays you're going to be getting 60fps, is that really 'too slow'? If you're after a performance measure can't you just test it in windowed mode?


To get a non-flipping strategy, you pass null in as the BufferCapabilities.FlipContents parameter. e.g.

1  
createBufferStrategy(2, new BufferCapabilities(new ImageCapabilities(true),new ImageCapabilities(true), null));


I suppose the fundamental question is, can you use pageflipping and not have it vsynced?
If its impossible, then there is nothing wrong with the current API (in terms of not revealing necessary functionality).
If it is possible, then we need an extra parameter to the BufferCapabilities object, so we can specify vsync'ed or not.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #9 - Posted 2004-02-26 10:33:19 »

Quote
How can you say 2/3rds of a screen update is better than no update when it will be 1/3rd incorrect?
Quote


It won't be wrong as such, it will just be out of date.
But then, if no update occurs, ALL of it will be out of date.

Giving our brains partial information, and letting it correct for errors is far better than giving it no information.

Quote

As I say - it is a Quake-player originated, developer-perpetuated illusion that 30fps on a 60Hz display is worse than 50fps on a 60Hz display. But I can't prove it to anyone Smiley You just have to do the experiments yourself.

Cas Smiley


Indeed, self experiment time :p

vsync on, com_maxfps 30, spin around quickly.
vsync off, com_maxfps 50, spin around quickly.

I know which I prefer, and I know that I play with vsync off, com_maxfps 125

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
8: Undefined index: online
File: /home/jgo/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 161