Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


[java] Java2D vsync?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Vyper_uk   GDNet+   -  Reputation: 355

Like
0Likes
Like

Posted 27 January 2006 - 03:24 AM

How do I enable vsync when doing custom painting on components? I'm getting some tearing and its not very pretty to look at. Things aren't too bad at high framerates but when I force lower framerates things get really ugly looking

Sponsor:

#2 nataku92   Members   -  Reputation: 128

Like
0Likes
Like

Posted 31 January 2006 - 05:42 PM

You can try looking at BufferStrategy here. Not sure if this is what you're looking for..

#3 Vyper_uk   GDNet+   -  Reputation: 355

Like
0Likes
Like

Posted 31 January 2006 - 11:20 PM

Thanks, but I'm already using double buffering. Double buffering gets rid of flickering, but its tearing that I'm having problems with (hence I need vsync) :(

#4 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 01 February 2006 - 04:58 AM

Quote:
Original post by Vyper_uk
How do I enable vsync when doing custom painting on components? I'm getting some tearing and its not very pretty to look at. Things aren't too bad at high framerates but when I force lower framerates things get really ugly looking


Not sure what you mean by "ugly when forcing lower framerates", since vsync is leaving the framerate at the same rate as the monitor refreshing rate, which depends on the resolution and monitor type used.

So "lower framerates" just make no sense, because if it's lower you'll never get vsync.

If you want to know the refresh rate, I don't remember from the top of my head, but I guess GraphicsDevice or GraphicsEnvironment class has this information.

#5 Vyper_uk   GDNet+   -  Reputation: 355

Like
0Likes
Like

Posted 01 February 2006 - 09:45 AM

Quote:
Original post by Anonymous Poster
Quote:
Original post by Vyper_uk
How do I enable vsync when doing custom painting on components? I'm getting some tearing and its not very pretty to look at. Things aren't too bad at high framerates but when I force lower framerates things get really ugly looking


Not sure what you mean by "ugly when forcing lower framerates", since vsync is leaving the framerate at the same rate as the monitor refreshing rate, which depends on the resolution and monitor type used.

So "lower framerates" just make no sense, because if it's lower you'll never get vsync.

If you want to know the refresh rate, I don't remember from the top of my head, but I guess GraphicsDevice or GraphicsEnvironment class has this information.

I'm not exactly sure why myself, but it just looks uglier. I will try and explain.

I'm using a delta so that no matter the frame rate, the player always travels the same distance across the map in any given time. However at lower framerates the game world is updated to the screen less regularly. As I understand it, the cause of tearing is that instead of seeing one frame of the world, you are seeing part of the previous frame covered by the new frame being drawn over the top, in effect the top half of one frame and the bottom half of another. At high frame rates the updates are only slighly different (maybe a shift of one or two pixels), so the tearing isnt particularly nasty. At lower frame rates, the difference between these two frames will be much greater (as the player has still travelled the same distance), and so the tearing is greater.

At least, thats how I understand it. Thanks for the classes, I think I already looked at them and didn't find much but I'll give them another scan :)



#6 OrangyTang   Members   -  Reputation: 1294

Like
0Likes
Like

Posted 01 February 2006 - 09:52 AM

Quote:
Original post by Vyper_uk
Thanks, but I'm already using double buffering. Double buffering gets rid of flickering, but its tearing that I'm having problems with (hence I need vsync) :(

BufferStratergy is the only way to get vsync in Java2D. If you create a fullscreen, page flipped buffer strategy then (IIRC) you get vsync automagically. Otherwise you'll need to check out BufferCapabilities.isPageFlipping() and BufferCapabilities.isFullscreenRequired().

#7 Vyper_uk   GDNet+   -  Reputation: 355

Like
0Likes
Like

Posted 02 February 2006 - 06:17 AM

Ah so it has to be fullscreen, thanks :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS