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

Junior Duke


Medals: 1



« Posted 2012-02-02 14:27:17 »

Removed..
Online kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #1 - Posted 2012-02-02 15: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ö

Junior Duke


Medals: 1



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

Removed..
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pitbuller
« Reply #3 - Posted 2012-02-03 07: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ö

Junior Duke


Medals: 1



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

Removed..
Offline theagentd
« Reply #5 - Posted 2012-02-03 10: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.

Myomyomyo.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2012-02-03 10: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
« Reply #7 - Posted 2012-02-03 10: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
« Reply #8 - Posted 2012-02-03 15: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


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #9 - Posted 2012-02-03 21: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! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pitbuller
« Reply #10 - Posted 2012-02-03 22: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
« Reply #11 - Posted 2012-02-04 02:58:39 »

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

Offline theagentd
« Reply #12 - Posted 2012-02-04 05:15:15 »

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

Myomyomyo.
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #13 - Posted 2012-02-04 06:17:23 »

FTFY

Offline ReBirth
« Reply #14 - Posted 2012-02-04 07: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]
  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.

Longarmx (35 views)
2014-10-17 03:59:02

Norakomi (25 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (26 views)
2014-10-15 16:18:58

TehJavaDev (50 views)
2014-10-14 00:39:48

TehJavaDev (50 views)
2014-10-14 00:35:47

TehJavaDev (40 views)
2014-10-14 00:32:37

BurntPizza (63 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (74 views)
2014-10-11 22:30:10
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!