Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (521)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
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  
  Remove..  (Read 2956 times)
0 Members and 1 Guest are viewing this topic.
Offline Jari Särö

Junior Devvie


Medals: 1



« Posted 2011-06-17 01:27:09 »

Remove..
Offline ra4king

JGO Kernel


Medals: 355
Projects: 3
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2011-06-17 01:54:05 »

BufferStrategy uses VolatileImage in the background.
The only difference between BufferStrategy and manually creating the VolatileImage is that BufferStrategy uses page flipping, which means it changes the video pointer. When you use a VolatileImage, you have to manually call drawImage, which is called page blitting, or copying the data to the screen.
With both you have to check if the image is lost or restored so you have to follow the way the Javadoc says you should do.

To answer your question: BufferStrategy is the recommended option because page flipping is faster than page blitting.
Regarding your issue, what do you mean there is a huge delay? What is showing while the applet has disappeared?

Offline Jari Särö

Junior Devvie


Medals: 1



« Reply #2 - Posted 2011-06-17 01:59:16 »

Remove..
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 355
Projects: 3
Exp: 5 years


I'm the King!


« Reply #3 - Posted 2011-06-17 02:16:58 »

The Javadoc for VolatileImage explains when it can be lost and what happens when a window is resized.

In short, anything caused by the OS or other applications could make the the image in VRAM be lost.
When the window is resized, all buffers have to be re-created in the new size. This causes some slow down since the existing buffers have to invalidated and flushed, then the new ones have to allocated.

Offline Jari Särö

Junior Devvie


Medals: 1



« Reply #4 - Posted 2011-06-17 03:37:34 »

Remove..
Offline ra4king

JGO Kernel


Medals: 355
Projects: 3
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2011-06-17 23:40:08 »

I have no clue why the CPU would jump to 100% when resizing. Maybe something else in applet is consuming the CPU while resizing?

No matter the reason, BufferStrategy is still the more recommended way to go since it controls the VolatileImage and makes it easy to check if the image is lost or restored. It also, as I said earlier, does page flipping, which will greatly improve your graphics performance.

Offline Z-Man
« Reply #6 - Posted 2011-06-18 00:52:11 »

... bufferstrategy(3) ...
This may be irrelevant and I may be wrong but if your trying to use double buffering wouldn't you call createBufferStrategy(2) on a canvas, or use 2 for however your creating the buffer strategy? Again I'm not sure if that's correct or if it would have any effect.
Offline ra4king

JGO Kernel


Medals: 355
Projects: 3
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2011-06-18 11:04:36 »

I don't believe that has any effect but yeah createBufferStrategy(2) is double buffering, createBufferStrategy(3) is triple buffering Wink

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xFryIx (58 views)
2014-11-13 12:34:49

digdugdiggy (37 views)
2014-11-12 21:11:50

digdugdiggy (30 views)
2014-11-12 21:10:15

digdugdiggy (24 views)
2014-11-12 21:09:33

kovacsa (48 views)
2014-11-07 19:57:14

TehJavaDev (51 views)
2014-11-03 22:04:50

BurntPizza (51 views)
2014-11-03 18:54:52

moogie (66 views)
2014-11-03 06:22:04

CopyableCougar4 (64 views)
2014-11-01 23:36:41

DarkCart (150 views)
2014-11-01 14:51:03
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!