Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT_AWT and Java2d OpenGL pipeline
SWT_AWT and Java2d OpenGL pipeline [message #446943] Mon, 06 December 2004 22:03 Go to next message
Stefan Krause is currently offline Stefan KrauseFriend
Messages: 9
Registered: July 2009
Junior Member
I can imagine that embedding AWT in SWT required lots of hacks. Since
embedding a JPanel and painting with Java2d worked perfectly fine I
decided to try to enable the opengl pipeline for Java2d - and got what I
deserve for such an idea (Xlib: unexpected async reply (sequence
0x1184)!). This happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia
driver.

Anyway it would be a very neat idea to have fast and high quality 2d
graphics, thus three questions arise:

Does it work for other graphic card or on windows?
Can you imagine that Java2d with an enabled OpenGL pipeline will be
supported by SWT_AWT in a not too distant future?
Is my animation code OK like that?

The code is like snippet 155 with this main loop:

while(!shell.isDisposed()) {
if (!display.readAndDispatch())
{
painter.repaint();
}
}

Thanks,
Stefan
Re: SWT_AWT and Java2d OpenGL pipeline [message #446987 is a reply to message #446943] Tue, 07 December 2004 13:35 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
SWT has an experimental OpenGL plugin.

See:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/dev.html#opengl

"Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
news:cp2ke4$epe$1@www.eclipse.org...
>I can imagine that embedding AWT in SWT required lots of hacks. Since
>embedding a JPanel and painting with Java2d worked perfectly fine I decided
>to try to enable the opengl pipeline for Java2d - and got what I deserve
>for such an idea (Xlib: unexpected async reply (sequence 0x1184)!). This
>happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia driver.
>
> Anyway it would be a very neat idea to have fast and high quality 2d
> graphics, thus three questions arise:
>
> Does it work for other graphic card or on windows?
> Can you imagine that Java2d with an enabled OpenGL pipeline will be
> supported by SWT_AWT in a not too distant future?
> Is my animation code OK like that?
>
> The code is like snippet 155 with this main loop:
>
> while(!shell.isDisposed()) {
> if (!display.readAndDispatch())
> {
> painter.repaint(); }
> }
>
> Thanks,
> Stefan
>
Re: SWT_AWT and Java2d OpenGL pipeline [message #446996 is a reply to message #446987] Tue, 07 December 2004 14:40 Go to previous messageGo to next message
Jim Adams is currently offline Jim AdamsFriend
Messages: 160
Registered: July 2009
Senior Member
That isn't a good answer for folks who require the SWT_AWT support and
Java2d....

"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cp4big$ftf$1@www.eclipse.org...
> SWT has an experimental OpenGL plugin.
>
> See:
>
>
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/dev.html#opengl
>
> "Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
> news:cp2ke4$epe$1@www.eclipse.org...
> >I can imagine that embedding AWT in SWT required lots of hacks. Since
> >embedding a JPanel and painting with Java2d worked perfectly fine I
decided
> >to try to enable the opengl pipeline for Java2d - and got what I deserve
> >for such an idea (Xlib: unexpected async reply (sequence 0x1184)!). This
> >happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia driver.
> >
> > Anyway it would be a very neat idea to have fast and high quality 2d
> > graphics, thus three questions arise:
> >
> > Does it work for other graphic card or on windows?
> > Can you imagine that Java2d with an enabled OpenGL pipeline will be
> > supported by SWT_AWT in a not too distant future?
> > Is my animation code OK like that?
> >
> > The code is like snippet 155 with this main loop:
> >
> > while(!shell.isDisposed()) {
> > if (!display.readAndDispatch())
> > {
> > painter.repaint(); }
> > }
> >
> > Thanks,
> > Stefan
> >
>
>
Re: SWT_AWT and Java2d OpenGL pipeline [message #447012 is a reply to message #446943] Tue, 07 December 2004 20:21 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Is enabling the OpenGL pipeline official Java2d API? If so, we should work
for it. Does it work on Windows?

"Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
news:cp2ke4$epe$1@www.eclipse.org...
> I can imagine that embedding AWT in SWT required lots of hacks. Since
> embedding a JPanel and painting with Java2d worked perfectly fine I
> decided to try to enable the opengl pipeline for Java2d - and got what I
> deserve for such an idea (Xlib: unexpected async reply (sequence
> 0x1184)!). This happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia
> driver.
>
> Anyway it would be a very neat idea to have fast and high quality 2d
> graphics, thus three questions arise:
>
> Does it work for other graphic card or on windows?
> Can you imagine that Java2d with an enabled OpenGL pipeline will be
> supported by SWT_AWT in a not too distant future?
> Is my animation code OK like that?
>
> The code is like snippet 155 with this main loop:
>
> while(!shell.isDisposed()) {
> if (!display.readAndDispatch())
> {
> painter.repaint();
> }
> }
>
> Thanks,
> Stefan
>
Re: SWT_AWT and Java2d OpenGL pipeline [message #447115 is a reply to message #447012] Wed, 08 December 2004 19:44 Go to previous messageGo to next message
Stefan Krause is currently offline Stefan KrauseFriend
Messages: 9
Registered: July 2009
Junior Member
It works fine for windows (eclipse3.1M3 and NVidia rel 65 drivers),
albeit it is much slower than using Java2D with Swing (my animation
takes 4.3 secs instead of 1.7).

I'd say enabling the pipeline is official for Java2d, though it is
disabled by default. ( see
http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.ht ml#ogl )
Though I'm not really sure whether using a property qualifies as
rendering a feature official - anyways it's the most interesting feature
of Java2D in the new JDK.

Another problem - especially for animations - is how to cause a redraw.
Multiple calls to repaint might be coalesced and indeed they are what
causes a jumping animation. For Java2D with Swing it's sometimes better
to call paintImmediatly(). This leads to system crashes on linux (X11
hangs, sometimes even the whole system) and runs OK on windows. Still it
can happen that the Swing component is not redisplayed all the time
(e.g. only the grey background of the SWT component is shown and the
animation is shown starting with frame 23). Do I also have to send a
repaint event to the SWT component?

Yours,
Stefan

Steve Northover wrote:
> Is enabling the OpenGL pipeline official Java2d API? If so, we should work
> for it. Does it work on Windows?
>
> "Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
> news:cp2ke4$epe$1@www.eclipse.org...
>
>>I can imagine that embedding AWT in SWT required lots of hacks. Since
>>embedding a JPanel and painting with Java2d worked perfectly fine I
>>decided to try to enable the opengl pipeline for Java2d - and got what I
>>deserve for such an idea (Xlib: unexpected async reply (sequence
>>0x1184)!). This happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia
>>driver.
>>
>>Anyway it would be a very neat idea to have fast and high quality 2d
>>graphics, thus three questions arise:
>>
>>Does it work for other graphic card or on windows?
>>Can you imagine that Java2d with an enabled OpenGL pipeline will be
>>supported by SWT_AWT in a not too distant future?
>>Is my animation code OK like that?
>>
>>The code is like snippet 155 with this main loop:
>>
>>while(!shell.isDisposed()) {
>> if (!display.readAndDispatch())
>> {
>> painter.repaint();
>> }
>>}
>>
>>Thanks,
>>Stefan
>>
>
>
>
Re: SWT_AWT and Java2d OpenGL pipeline [message #447119 is a reply to message #446987] Wed, 08 December 2004 21:13 Go to previous messageGo to next message
Harry Pendergrass is currently offline Harry PendergrassFriend
Messages: 10
Registered: July 2009
Junior Member
"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cp4big$ftf$1@www.eclipse.org...
> SWT has an experimental OpenGL plugin.
>
> See:
>
>
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/dev.html#opengl

Hi,

I'm curious what the plan is as far as making the OpenGL plugin a standard
part of the distribution.

-Harry Pendergrass,
IBM
Re: SWT_AWT and Java2d OpenGL pipeline [message #447209 is a reply to message #447115] Thu, 09 December 2004 15:43 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
I'm not sure what the question is. If you don't set the property, does it
work on both platforms?

"Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
news:cp7lia$9ns$1@www.eclipse.org...
> It works fine for windows (eclipse3.1M3 and NVidia rel 65 drivers),
> albeit it is much slower than using Java2D with Swing (my animation
> takes 4.3 secs instead of 1.7).
>
> I'd say enabling the pipeline is official for Java2d, though it is
> disabled by default. ( see
> http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.ht ml#ogl )
> Though I'm not really sure whether using a property qualifies as
> rendering a feature official - anyways it's the most interesting feature
> of Java2D in the new JDK.
>
> Another problem - especially for animations - is how to cause a redraw.
> Multiple calls to repaint might be coalesced and indeed they are what
> causes a jumping animation. For Java2D with Swing it's sometimes better
> to call paintImmediatly(). This leads to system crashes on linux (X11
> hangs, sometimes even the whole system) and runs OK on windows. Still it
> can happen that the Swing component is not redisplayed all the time
> (e.g. only the grey background of the SWT component is shown and the
> animation is shown starting with frame 23). Do I also have to send a
> repaint event to the SWT component?
>
> Yours,
> Stefan
>
> Steve Northover wrote:
> > Is enabling the OpenGL pipeline official Java2d API? If so, we should
work
> > for it. Does it work on Windows?
> >
> > "Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
> > news:cp2ke4$epe$1@www.eclipse.org...
> >
> >>I can imagine that embedding AWT in SWT required lots of hacks. Since
> >>embedding a JPanel and painting with Java2d worked perfectly fine I
> >>decided to try to enable the opengl pipeline for Java2d - and got what I
> >>deserve for such an idea (Xlib: unexpected async reply (sequence
> >>0x1184)!). This happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia
> >>driver.
> >>
> >>Anyway it would be a very neat idea to have fast and high quality 2d
> >>graphics, thus three questions arise:
> >>
> >>Does it work for other graphic card or on windows?
> >>Can you imagine that Java2d with an enabled OpenGL pipeline will be
> >>supported by SWT_AWT in a not too distant future?
> >>Is my animation code OK like that?
> >>
> >>The code is like snippet 155 with this main loop:
> >>
> >>while(!shell.isDisposed()) {
> >> if (!display.readAndDispatch())
> >> {
> >> painter.repaint();
> >> }
> >>}
> >>
> >>Thanks,
> >>Stefan
> >>
> >
> >
> >
Re: SWT_AWT and Java2d OpenGL pipeline [message #447238 is a reply to message #447209] Thu, 09 December 2004 19:30 Go to previous messageGo to next message
Stefan Krause is currently offline Stefan KrauseFriend
Messages: 9
Registered: July 2009
Junior Member
Just for clarification (because I don't know what you didn't understand):
Yes, if the property is not set it works for both platforms, i.e. it
doesn't crash.
If sun.java2d.opengl is set to true it crashes on linux but not on
windows, but the windows version runs much slower that a pure JFC/AWT
version.

The other question (and basically independent of the Java2D OpenGL
pipeline problem) is:
What is the correct way to make an animation with SWT_AWT?
Or put in another way. How can I _force_ a repaint of a Swing/AWT
component embedded in SWT_AWT?

This does not produce the correct results, because the repaint events
might be coalesced (i.e. frames are skipped in the animation)

while(!shell.isDisposed()) {
if (!display.readAndDispatch())
{
painter.repaint(); // painter is a JPanel embedded in the Frame
from SWT_AWT
}
}

Even calling painter.paintImmediatly doesn't force a repaint in all
situations.

Yours,
Stefan

Steve Northover wrote:
> I'm not sure what the question is. If you don't set the property, does it
> work on both platforms?
>
> "Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
> news:cp7lia$9ns$1@www.eclipse.org...
>
>>It works fine for windows (eclipse3.1M3 and NVidia rel 65 drivers),
>>albeit it is much slower than using Java2D with Swing (my animation
>>takes 4.3 secs instead of 1.7).
>>
>>I'd say enabling the pipeline is official for Java2d, though it is
>>disabled by default. ( see
>> http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.ht ml#ogl )
>>Though I'm not really sure whether using a property qualifies as
>>rendering a feature official - anyways it's the most interesting feature
>>of Java2D in the new JDK.
>>
>>Another problem - especially for animations - is how to cause a redraw.
>>Multiple calls to repaint might be coalesced and indeed they are what
>>causes a jumping animation. For Java2D with Swing it's sometimes better
>>to call paintImmediatly(). This leads to system crashes on linux (X11
>>hangs, sometimes even the whole system) and runs OK on windows. Still it
>>can happen that the Swing component is not redisplayed all the time
>>(e.g. only the grey background of the SWT component is shown and the
>>animation is shown starting with frame 23). Do I also have to send a
>>repaint event to the SWT component?
>>
>>Yours,
>>Stefan
>>
>>Steve Northover wrote:
>>
>>>Is enabling the OpenGL pipeline official Java2d API? If so, we should
>
> work
>
>>>for it. Does it work on Windows?
>>>
>>>"Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
>>>news:cp2ke4$epe$1@www.eclipse.org...
>>>
>>>
>>>>I can imagine that embedding AWT in SWT required lots of hacks. Since
>>>>embedding a JPanel and painting with Java2d worked perfectly fine I
>>>>decided to try to enable the opengl pipeline for Java2d - and got what I
>>>>deserve for such an idea (Xlib: unexpected async reply (sequence
>>>>0x1184)!). This happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia
>>>>driver.
>>>>
>>>>Anyway it would be a very neat idea to have fast and high quality 2d
>>>>graphics, thus three questions arise:
>>>>
>>>>Does it work for other graphic card or on windows?
>>>>Can you imagine that Java2d with an enabled OpenGL pipeline will be
>>>>supported by SWT_AWT in a not too distant future?
>>>>Is my animation code OK like that?
>>>>
>>>>The code is like snippet 155 with this main loop:
>>>>
>>>>while(!shell.isDisposed()) {
>>>> if (!display.readAndDispatch())
>>>> {
>>>> painter.repaint();
>>>> }
>>>>}
>>>>
>>>>Thanks,
>>>>Stefan
>>>>
>>>
>>>
>>>
>
>
Re: SWT_AWT and Java2d OpenGL pipeline [message #447263 is a reply to message #447238] Sat, 11 December 2004 00:16 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Please enter a problem report for both issues. We probably can't do much
about the first. Include a small but complete working program for the
seconds issue. You should simple be able to assume that SWT is not there
when doing SWT_AWT interop (ie. the appropriate AWT/Swing calls should just
work).

"Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
news:cpa957$3mq$1@www.eclipse.org...
> Just for clarification (because I don't know what you didn't understand):
> Yes, if the property is not set it works for both platforms, i.e. it
> doesn't crash.
> If sun.java2d.opengl is set to true it crashes on linux but not on
> windows, but the windows version runs much slower that a pure JFC/AWT
> version.
>
> The other question (and basically independent of the Java2D OpenGL
> pipeline problem) is:
> What is the correct way to make an animation with SWT_AWT?
> Or put in another way. How can I _force_ a repaint of a Swing/AWT
> component embedded in SWT_AWT?
>
> This does not produce the correct results, because the repaint events
> might be coalesced (i.e. frames are skipped in the animation)
>
> while(!shell.isDisposed()) {
> if (!display.readAndDispatch())
> {
> painter.repaint(); // painter is a JPanel embedded in the Frame
> from SWT_AWT
> }
> }
>
> Even calling painter.paintImmediatly doesn't force a repaint in all
> situations.
>
> Yours,
> Stefan
>
> Steve Northover wrote:
> > I'm not sure what the question is. If you don't set the property, does
it
> > work on both platforms?
> >
> > "Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
> > news:cp7lia$9ns$1@www.eclipse.org...
> >
> >>It works fine for windows (eclipse3.1M3 and NVidia rel 65 drivers),
> >>albeit it is much slower than using Java2D with Swing (my animation
> >>takes 4.3 secs instead of 1.7).
> >>
> >>I'd say enabling the pipeline is official for Java2d, though it is
> >>disabled by default. ( see
> >> http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.ht ml#ogl )
> >>Though I'm not really sure whether using a property qualifies as
> >>rendering a feature official - anyways it's the most interesting feature
> >>of Java2D in the new JDK.
> >>
> >>Another problem - especially for animations - is how to cause a redraw.
> >>Multiple calls to repaint might be coalesced and indeed they are what
> >>causes a jumping animation. For Java2D with Swing it's sometimes better
> >>to call paintImmediatly(). This leads to system crashes on linux (X11
> >>hangs, sometimes even the whole system) and runs OK on windows. Still it
> >>can happen that the Swing component is not redisplayed all the time
> >>(e.g. only the grey background of the SWT component is shown and the
> >>animation is shown starting with frame 23). Do I also have to send a
> >>repaint event to the SWT component?
> >>
> >>Yours,
> >>Stefan
> >>
> >>Steve Northover wrote:
> >>
> >>>Is enabling the OpenGL pipeline official Java2d API? If so, we should
> >
> > work
> >
> >>>for it. Does it work on Windows?
> >>>
> >>>"Stefan Krause" <Stefan.Krause@gmx.at> wrote in message
> >>>news:cp2ke4$epe$1@www.eclipse.org...
> >>>
> >>>
> >>>>I can imagine that embedding AWT in SWT required lots of hacks. Since
> >>>>embedding a JPanel and painting with Java2d worked perfectly fine I
> >>>>decided to try to enable the opengl pipeline for Java2d - and got what
I
> >>>>deserve for such an idea (Xlib: unexpected async reply (sequence
> >>>>0x1184)!). This happened for JDK1.5.0 on a SuSE 9,2 with 66.29 NVidia
> >>>>driver.
> >>>>
> >>>>Anyway it would be a very neat idea to have fast and high quality 2d
> >>>>graphics, thus three questions arise:
> >>>>
> >>>>Does it work for other graphic card or on windows?
> >>>>Can you imagine that Java2d with an enabled OpenGL pipeline will be
> >>>>supported by SWT_AWT in a not too distant future?
> >>>>Is my animation code OK like that?
> >>>>
> >>>>The code is like snippet 155 with this main loop:
> >>>>
> >>>>while(!shell.isDisposed()) {
> >>>> if (!display.readAndDispatch())
> >>>> {
> >>>> painter.repaint();
> >>>> }
> >>>>}
> >>>>
> >>>>Thanks,
> >>>>Stefan
> >>>>
> >>>
> >>>
> >>>
> >
> >
Previous Topic:Tabbed controls
Next Topic:centering a shell on the screen
Goto Forum:
  


Current Time: Fri Apr 19 14:16:24 GMT 2024

Powered by FUDForum. Page generated in 0.02300 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top