|
|
|
|
|
|
Re: SWT_AWT and Java2d OpenGL pipeline [message #447209 is a reply to message #447115] |
Thu, 09 December 2004 15:43 |
Steve Northover 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 |
Stefan Krause 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 |
Steve Northover 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
> >>>>
> >>>
> >>>
> >>>
> >
> >
|
|
|
Powered by
FUDForum. Page generated in 0.04675 seconds