Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Removed..  (Read 838 times)
0 Members and 4 Guests are viewing this topic.
Offline Jari Särö

Jr. Member
**

Posts: 82
Medals: 1



« on: 2012-02-02 09:27:17 »

Removed..
Offline kappa
« League of Dukes »

JGO Kernel
*****

Posts: 2360
Medals: 59


★★★★★


« Reply #1 on: 2012-02-02 10:03:43 »

I have set to linux and mac computers "-Dsun.java2d.opengl=true"
Just curious why you've set this step manually on linux and mac? Its not always the most reliable and fastest pipeline on those platforms and besides Java 7 on linux has a new Xrender pipeline which is suppose to be even better "-Dsun.java2d.xrender=True", so usually for linux and mac its best to use the default rendering pipeline.
Offline Jari Särö

Jr. Member
**

Posts: 82
Medals: 1



« Reply #2 on: 2012-02-03 02:00:07 »

Removed..
Games published by our own members! Go get 'em!
Offline pitbuller

Sr. Member
**

Posts: 340
Medals: 9



« Reply #3 on: 2012-02-03 02:26:57 »

hardware acceleration,

it is important to me to know if drawimage() is blocking the code until it is fully drawn to buffer or will it be later flushed with all other bufferedimages by bufferstrategy.show().

I am building my publish sleep() calls to my graphics2d code, so i would very much have respect if i could have an answer.

I am with hobby with java, i am not an programmer, this is simply a plain hobby to me.

You only need one sleep call per frame. That is said allready in least 5 other threads.

Offline Jari Särö

Jr. Member
**

Posts: 82
Medals: 1



« Reply #4 on: 2012-02-03 03:25:28 »

Removed..
Online theagentd

JGO Wizard
****

Posts: 1392
Medals: 88



« Reply #5 on: 2012-02-03 05:20:22 »

It is not allways important what other people say, like other people have said i only need one sleep, i say that i have tens of sleeps on my applet, allmost one after every image, if i go building boardgames it is not that big deal if i have 10-20 ms sleep after every image, or even 100 ms after every image on some games, and maybe i have a minimum 990 ms sleep on my entire boardgame.



Even if i am here at the forum, and even if i get answers, it does not have to be that i follow these advices.
We've noticed.


OpenGL (and DirectX) works like this: The CPU issues commands which are put in a queue. The driver then processes these commands in order and in turn produces commands that the GPU executes. This could mean that most commands (even a buffer flip = BufferStrategy.show()) would be non-blocking, but the command queue has a limited length. If the command queue is full and you try to add a new command it will block until there is space in the queue. This means that any command that ends up in the command queue might end up blocking for a few milliseconds. However, this will only happen if the CPU is feeding commands faster than the driver and the GPU can consume them. There are a number of commands that always block though. For example reading back image data to the CPU from the GPU will almost always block, since the all commands that draw to the image has to be completed before the read back can be done.

This does not directly map to Java2D though. Java2D may be forcing additional synchronization between the GPU and the CPU depending on drivers, OS and graphics library (OpenGL, DirectX, e.t.c). Therefore it is pretty much impossible to give a clear answer to you.

There is no god.
Offline Riven
« League of Dukes »

JGO Kernel
*****

Posts: 5870
Medals: 255


Hand over your head.


« Reply #6 on: 2012-02-03 05:34:10 »

Most important is that whether it is blocking or not, doesn't make any difference to the way you should program against the gfx API.

Even when the call to drawImage(...) is non-blocking, adding a sleep(...) after it is not giving you any advantage whatsoever.


Last but not least, yes, I noticed you added '990ms sleep' to your applet a while ago. It was completely unusable, rendering at barely 1fps.

Please sleep only once per frame, like everybody else!

Hi, appreciate more people! Σ ♥ = ¾

Learn how to award medals... and work your way up the social rankings
Offline Regenuluz

Jr. Member
**

Posts: 73
Medals: 1



« Reply #7 on: 2012-02-03 05:49:11 »

I am with hobby with java, i am not an programmer, this is simply a plain hobby to me.

Just because it's a hobby, doesn't mean that you shouldn't at least try to follow the advice given to you, when you yourself asked for them. Besides, what's wrong with following "best practice", even if it's a hobby? Smiley
Offline Cero

JGO Neuromancer
****

Posts: 1050
Medals: 18



« Reply #8 on: 2012-02-03 10:21:47 »

Even if i am here at the forum, and even if i get answers, it does not have to be that i follow these advices.
We've noticed.

We certainly have.

Offline ra4king

JGO Kernel
*****

Posts: 3156
Medals: 196


I'm the King!


« Reply #9 on: 2012-02-03 16:54:48 »

Please sleep only once per frame, like everybody else!
Not necessarily because everyone else does it, but mostly to make your code less cluttered and MAINTAIN OUR SANITY while playing your games Wink

Games published by our own members! Go get 'em!
Offline pitbuller

Sr. Member
**

Posts: 340
Medals: 9



« Reply #10 on: 2012-02-03 17:43:49 »

Please sleep only once per frame, like everybody else!
Not necessarily because everyone else does it, but mostly to make your code less cluttered and MAINTAIN OUR SANITY while playing your games Wink

Also keep sleep timer accuracy in certain bounds. If sleep timer resolution is x milliseconds per call. Max error with one call is most x ms but if you do 100 sleep call the worst case would be 100 * x ms per frame.

Offline ReBirth

JGO Wizard
****

Posts: 1275
Medals: 19



« Reply #11 on: 2012-02-03 21:58:39 »

"Not broke? don't fix it"
"Not slow? keep going"

Online theagentd

JGO Wizard
****

Posts: 1392
Medals: 88



« Reply #12 on: 2012-02-04 00:15:15 »

"Not slow? keep going Add Thread.sleep(990)."
FTFY

There is no god.
Offline ra4king

JGO Kernel
*****

Posts: 3156
Medals: 196


I'm the King!


« Reply #13 on: 2012-02-04 01:17:23 »

FTFY

Offline ReBirth

JGO Wizard
****

Posts: 1275
Medals: 19



« Reply #14 on: 2012-02-04 02:04:30 »

Err I mean to avoid optimization since behind this is the queue was full so need sleep after every task to create space for another task.

oh yeah Grin

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.118 seconds with 19 queries.