From ralf.spathelf at aicas.de Wed Apr 22 15:11:20 2015 From: ralf.spathelf at aicas.de (Ralf Spathelf) Date: Wed, 22 Apr 2015 17:11:20 +0200 Subject: Synchronizing graphics with Cacio Message-ID: <5537BA18.8090609@aicas.de> Hi guys, We are experimenting with implementing an OpenGL port using Caciocavallo. The OpenGL render queue has to be flushed after repainting, we do this in Toolkit.sync(). Do you have an idea where this could be called in the Cacio code? We tried to do this after a PaintEvent in CacioComponentPeer.handleEvent() but this did not work. Regards, Ralf From neugens.limasoftware at gmail.com Wed Apr 22 15:41:52 2015 From: neugens.limasoftware at gmail.com (Mario Torre) Date: Wed, 22 Apr 2015 17:41:52 +0200 Subject: Synchronizing graphics with Cacio In-Reply-To: <5537BA18.8090609@aicas.de> References: <5537BA18.8090609@aicas.de> Message-ID: 2015-04-22 17:11 GMT+02:00 Ralf Spathelf : > Hi guys, Hi Ralf! Nice to see you're contributing again back to Cacio! > We are experimenting with implementing an OpenGL port using Caciocavallo. > The OpenGL render queue has to be flushed after repainting, we do this in > Toolkit.sync(). > > Do you have an idea where this could be called in the Cacio code? We tried > to do this after a PaintEvent in CacioComponentPeer.handleEvent() but this > did not work. This seems expensive. One quick place where this can be done may be after blitting. or by keepin track of your repaints and do after a repain operation (but you should try to do a batch). Depending on the application this may be good to do. Another thing to do is to do every n painting operation or at each refresh rate cycle. I'll think some better places where you could do that and let you know. Cheers, Mario -- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens Proud GNU Classpath developer: http://www.classpath.org/ OpenJDK: http://openjdk.java.net/projects/caciocavallo/ Please, support open standards: http://endsoftpatents.org/ From roman at kennke.org Wed Apr 22 15:47:08 2015 From: roman at kennke.org (Roman Kennke) Date: Wed, 22 Apr 2015 17:47:08 +0200 Subject: Synchronizing graphics with Cacio In-Reply-To: <5537BA18.8090609@aicas.de> References: <5537BA18.8090609@aicas.de> Message-ID: <1429717628.7005.13.camel@kennke.org> Hi Ralf, Nice to hear from you :-) Flushing queues is a tricky thing. I don't think that PaintEvents are handled in Cacio, because it comes from Java, not from the backend. handleEvent() only bubbles up events from the backend. Even worse, not all painting comes from PainEvents. It is possible to get a Graphics, and do some rendering directly. A safe (but slow) approach would be to flush after each primitive. What you probably want is to flush after each 'paint job' which is what your event would do. I believe this is only possible using some smart heuristic, like 'flush after N primitives OR after a certain timeout after the last paint primitive'. But this is not trivial. I hope this helps. Best regards, Roman Am Mittwoch, den 22.04.2015, 17:11 +0200 schrieb Ralf Spathelf: > Hi guys, > > We are experimenting with implementing an OpenGL port using Caciocavallo. The OpenGL render queue has to be flushed after repainting, we do this in Toolkit.sync(). > > Do you have an idea where this could be called in the Cacio code? We tried to do this after a PaintEvent in CacioComponentPeer.handleEvent() but this did not work. > > Regards, > Ralf > > From neugens.limasoftware at gmail.com Wed Apr 22 15:58:08 2015 From: neugens.limasoftware at gmail.com (Mario Torre) Date: Wed, 22 Apr 2015 17:58:08 +0200 Subject: Synchronizing graphics with Cacio In-Reply-To: <1429717628.7005.13.camel@kennke.org> References: <5537BA18.8090609@aicas.de> <1429717628.7005.13.camel@kennke.org> Message-ID: 2015-04-22 17:47 GMT+02:00 Roman Kennke : > Hi Ralf, > > Nice to hear from you :-) > > Flushing queues is a tricky thing. I don't think that PaintEvents are > handled in Cacio, because it comes from Java, not from the backend. > handleEvent() only bubbles up events from the backend. > > Even worse, not all painting comes from PainEvents. It is possible to > get a Graphics, and do some rendering directly. > > A safe (but slow) approach would be to flush after each primitive. > What you probably want is to flush after each 'paint job' which is what > your event would do. I believe this is only possible using some smart > heuristic, like 'flush after N primitives OR after a certain timeout > after the last paint primitive'. But this is not trivial. Thinking about that, syncing with the refresh cycle (or a multiple of it) may be the best way to flush the OpenGL queue, especially if your Surface data is a texture. Cheers, Mario -- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens Proud GNU Classpath developer: http://www.classpath.org/ OpenJDK: http://openjdk.java.net/projects/caciocavallo/ Please, support open standards: http://endsoftpatents.org/ From ralf.spathelf at aicas.de Wed Apr 29 09:05:45 2015 From: ralf.spathelf at aicas.de (Ralf Spathelf) Date: Wed, 29 Apr 2015 11:05:45 +0200 Subject: Synchronizing graphics with Cacio In-Reply-To: References: <5537BA18.8090609@aicas.de> <1429717628.7005.13.camel@kennke.org> Message-ID: <55409EE9.7090203@aicas.de> Hi Mario and Roman, Thanks for your fast replies! Yes, it's really tricky. We'll do some more experiments and keep you up to date (if we'll find a good solution). Note: There are some more changes we've done to Cacio in the past that we want to contribute. But I think we will post the patches after we've updated to Java 8, then it will be easier to integrate. Cheers, Ralf On 04/22/2015 05:58 PM, Mario Torre wrote: > 2015-04-22 17:47 GMT+02:00 Roman Kennke : > > Hi Ralf, > > > > Nice to hear from you :-) > > > > Flushing queues is a tricky thing. I don't think that PaintEvents are > > handled in Cacio, because it comes from Java, not from the backend. > > handleEvent() only bubbles up events from the backend. > > > > Even worse, not all painting comes from PainEvents. It is possible to > > get a Graphics, and do some rendering directly. > > > > A safe (but slow) approach would be to flush after each primitive. > > What you probably want is to flush after each 'paint job' which is what > > your event would do. I believe this is only possible using some smart > > heuristic, like 'flush after N primitives OR after a certain timeout > > after the last paint primitive'. But this is not trivial. > > Thinking about that, syncing with the refresh cycle (or a multiple of > it) may be the best way to flush the OpenGL queue, especially if your > Surface data is a texture. > > Cheers, > Mario >