Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (799)
Games in Android Showcase (236)
games submitted by our members
Games in WIP (865)
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  
  VSync  (Read 4282 times)
0 Members and 1 Guest are viewing this topic.
Offline zeroone
« Posted 2015-02-17 21:34:27 »

Is it possible to vsync animated graphics in Java in windowed or full-screen mode?
Offline CommanderKeith
« Reply #1 - Posted 2015-02-18 15:44:23 »

In java2d it isn't.

In openGL (LWJGL and JOGL) you can set vsync on and off using their API's.

Offline KudoDEV

JGO Ninja


Medals: 79
Exp: 6 years


Game Dev Hobbyist


« Reply #2 - Posted 2015-02-18 15:46:06 »

It is possible. Get the monitor's refresh rate then cap your game loop to that number.

I believe that's all vsync is.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline trollwarrior1
« Reply #3 - Posted 2015-02-18 15:52:31 »

It is possible. Get the monitor's refresh rate then cap your game loop to that number.

I believe that's all vsync is.

No it is not. It is called sync for a reason.
This is what you would get if you just cap your loop to the monitors refresh rate, which still gets you screen tearing.
----------------------------------------------
   |   |   |   |   |   |   |   |   |   |   |   |   |
----------------------------------------------
 |   |   |   |   |   |   |   |   |   |   |   |   |   
----------------------------------------------

vsync does this:
----------------------------------------------
   |   |   |   |   |   |   |   |   |   |   |   |   |
----------------------------------------------
   |   |   |   |   |   |   |   |   |   |   |   |   |
Offline KudoDEV

JGO Ninja


Medals: 79
Exp: 6 years


Game Dev Hobbyist


« Reply #4 - Posted 2015-02-18 16:07:05 »

Ahh makes sense!

Offline zeroone
« Reply #5 - Posted 2015-02-18 21:03:47 »

In java2d it isn't.

In openGL (LWJGL and JOGL) you can set vsync on and off using their API's.

From the docs, it sounds like vsync is only possible in full screen mode.  Also, using those APIs, can I procedurally create bitmaps on the fly?  Each frame in my game is generated via direct pixel manipulation.  Currently, I'm doing this using a BufferedImage backed by an int array. 
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (183 views)
2019-09-04 15:33:17

hadezbladez (4859 views)
2018-11-16 13:46:03

hadezbladez (1783 views)
2018-11-16 13:41:33

hadezbladez (5131 views)
2018-11-16 13:35:35

hadezbladez (1013 views)
2018-11-16 13:32:03

EgonOlsen (4356 views)
2018-06-10 19:43:48

EgonOlsen (5213 views)
2018-06-10 19:43:44

EgonOlsen (2940 views)
2018-06-10 19:43:20

DesertCoockie (3865 views)
2018-05-13 18:23:11

nelsongames (4290 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!