Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 03:08:25 am
Xith3D CommunityGeneral CategoryNews (Moderators: Marvin Fröhlich, 'n ddrylliog)SWT support is ready
Pages: [1] 2
Print
Author Topic: SWT support is ready  (Read 4764 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« on: 14. January 2007, 10:15:26 am »

SWT support is now complete Smiley.

Well there are still minor problems. But it fully works.

One of the minor problems is, that when the mouse and keyboard are initialized the following lines ore dumped to stdout:
Code:
X Error: BadDevice, invalid or uninitialized input device 168
  Major opcode:  148
  Minor opcode:  3
  Resource id:  0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 168
  Major opcode:  148
  Minor opcode:  3
  Resource id:  0x0
Failed to open device

Mouse and Keyboard work anyway. But maybe someone knows, what that is. Google says nothing.

The other "bug" is, that it doesn't seem to be possible to invoke rendering from a separate thread. This will throw the following exception:
Code:
Exception in thread "Thread-3" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:3374)
at org.eclipse.swt.SWT.error(SWT.java:3297)
at org.eclipse.swt.SWT.error(SWT.java:3268)
at org.eclipse.swt.widgets.Widget.error(Widget.java:434)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:373)
at org.eclipse.swt.opengl.GLCanvas.setCurrent(GLCanvas.java:268)
at org.xith3d.render.jsr231.CanvasPeerSWTImpl.doRender(CanvasPeerSWTImpl.java:304)
at org.xith3d.render.jsr231.CanvasPeerSWTImpl.render(CanvasPeerSWTImpl.java:320)
at org.xith3d.render.jsr231.CanvasPeerImplBase.render(CanvasPeerImplBase.java:1043)
at org.xith3d.render.Renderer.renderOnceInternal(Renderer.java:591)
at org.xith3d.render.Renderer.renderOnce(Renderer.java:617)
at org.xith3d.render.Renderer.renderOnce(Renderer.java:661)
at org.xith3d.render.Renderer.renderOnce(Renderer.java:676)
at org.xith3d.scenegraph.VirtualUniverse.renderOnce(VirtualUniverse.java:161)
at org.xith3d.scenegraph.View.renderOnce(View.java:686)
at org.xith3d.render.base.Xith3DEnvironment.render(Xith3DEnvironment.java:387)
at org.xith3d.render.loop.RenderLoop.invokeRendering(RenderLoop.java:813)
at org.xith3d.render.loop.RenderLoop.loopIteration(RenderLoop.java:834)
at org.xith3d.render.loop.ExtRenderLoop.loopIteration(ExtRenderLoop.java:349)
at org.xith3d.test.benchmark.Q3FlightBenchmark.loopIteration(Q3FlightBenchmark.java:207)
at org.xith3d.render.loop.RenderLoop.nextIteration(RenderLoop.java:1010)
at org.xith3d.render.loop.RenderLoop.run(RenderLoop.java:1074)
at java.lang.Thread.run(Thread.java:619)
Any idea?

I cannot imagine, that is not possible at all. But if you want to use SWT rendering, start the RenderLoop with
Code:
begin( RunMode.RUN_IN_SAME_THREAD );
And everything is fine.

Enjoy Smiley.

Marvin
Logged
starscream
Enjoying the stay
*
Offline Offline

Posts: 25


View Profile
« Reply #1 on: 14. January 2007, 08:53:30 pm »

Hi,

maybe this helps:

http://ubuntuforums.org/showthread.php?p=1264009

Seems to be a x-org-conf-problem...
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 15. January 2007, 07:07:52 am »

Hi,

maybe this helps:

http://ubuntuforums.org/showthread.php?p=1264009

Seems to be a x-org-conf-problem...

Thanks for the link. Looking forward to solve the problem with your tip.

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #3 on: 15. January 2007, 04:40:32 pm »

Well, don't know if to say thanks since we worked on it together but anyways, great !  Grin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #4 on: 09. February 2007, 07:20:23 pm »

Last night, I thought I saw a tutorial for getting an SWT app up and running.  I've been poking through the code and boards and cannot seem to find it today.  All I find are some rendering/canvas peer classes.  Can you point me to such a tutorial?

Has anybody run X3D SWT as an Eclipse plug-in yet?  I plan to do so and will either pioneer it (with help from the sith lords needed) or follow in somebody's footsteps.
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #5 on: 09. February 2007, 07:24:19 pm »

Last night, I thought I saw a tutorial for getting an SWT app up and running.  I've been poking through the code and boards and cannot seem to find it today.  All I find are some rendering/canvas peer classes.  Can you point me to such a tutorial?

The only thing, you need to do is to use OpenGLLayer.JOGL_SWT as a Canvas3DFactory parameter (or Canvas3DWrapper, if you're not using the trunk). And you need to pass a RunMode.RUN_IN_SAME_THREAD parameter to the begin mode of the RenderLoop. Then it should work without any further modification to other projects.

Has anybody run X3D SWT as an Eclipse plug-in yet?  I plan to do so and will either pioneer it (with help from the sith lords needed) or follow in somebody's footsteps.

No. I don't think, anybody has done this. Good luck.

Sith Lords will always help Grin.

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #6 on: 10. February 2007, 04:07:00 pm »

"Good Luke", horati  Grin Grin

Marvin, remind me, there wasn't anyway to avoid this nasty "Run in the same thread" thing ?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 10. February 2007, 04:11:29 pm »

"Good Luke", horati  Grin Grin

Marvin, remind me, there wasn't anyway to avoid this nasty "Run in the same thread" thing ?

Well, not yet. When force tells me a better way, I will let you know.

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #8 on: 10. February 2007, 10:09:10 pm »

In order to add it as a plug-in within Eclipse, you have to attach it to a Composite instance created by the framework in a call within one of their threads.  If I understand the Xith3D mechanism correctly, it requires that I give it control and use synchronous mode.  This isn't going to work.

I greatly prefer X3D but didn't realize it supported SWT when I started my project.  So I was able to get Aviatrix3D running within an Eclipse view without too many problems without using a blocking thread.  Going that route, my only problems were getting A3D to do what I wanted because it has far fewer features of a gaming nature.

If anyone is interested, here is the code necessary within Eclipse to get an A3D scene up and running as well as the source to the A3D SWT Canvas which is also based on org.eclipse.swt.  I'm not sure what it does differently to make Threads work but I'll be happy to help investigate if you give me some direction where to go/what you need to see.
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #9 on: 10. February 2007, 10:09:55 pm »

One more file... there was a 4 file limit.
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #10 on: 11. February 2007, 06:46:59 pm »

I'm adapting some of the tests to run with SWT.  I just adapted the HUD3DTest.java which most definitely does not work with SWT due to the threading bug Sad In an effort to reduce the amount of debugging, I reduced the number of controls and listeners and such that were in HUD3DTest.java.  Here are the 2 files I produced to create this test.

Here is what I experience:
  • The application comes up with only an exception that it cannot find the GTK theme so it is using the fall back theme
  • The HUD renders
  • The scene renders
  • The scene animates
  • Whenever I click a button, instead of the listeners firing correctly, the following exception prints twice (exactly the same way both times):
    Quote
    Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access
            at org.eclipse.swt.SWT.error(SWT.java:3374)
            at org.eclipse.swt.SWT.error(SWT.java:3297)
            at org.eclipse.swt.SWT.error(SWT.java:3268)
            at org.eclipse.swt.widgets.Widget.error(Widget.java:653)
            at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:331)
            at org.eclipse.swt.widgets.Control.isEnabled(Control.java:1476)
            at org.eclipse.swt.widgets.Display.mouseProc(Display.java:2764)
  • Whenever the program loses focus, the following exception prints once:
    Quote
    Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access
            at org.eclipse.swt.SWT.error(SWT.java:3374)
            at org.eclipse.swt.SWT.error(SWT.java:3297)
            at org.eclipse.swt.SWT.error(SWT.java:3268)
            at org.eclipse.swt.widgets.Widget.error(Widget.java:653)
            at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:331)
            at org.eclipse.swt.widgets.Control.isEnabled(Control.java:1476)
            at org.eclipse.swt.widgets.Display.getFocusControl(Display.java:1507)
            at org.eclipse.swt.widgets.Decorations.saveFocus(Decorations.java:393)
            at org.eclipse.swt.widgets.Shell.kEventWindowDeactivated(Shell.java:967)
            at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2040)
            at org.eclipse.swt.widgets.Display.windowProc(Display.java:4032)
  • Whenever the program gains focus, the following exception prints once (very similar but a little different):
    Quote
    Exception in thread "AWT-AppKit" org.eclipse.swt.SWTException: Invalid thread access
            at org.eclipse.swt.SWT.error(SWT.java:3374)
            at org.eclipse.swt.SWT.error(SWT.java:3297)
            at org.eclipse.swt.SWT.error(SWT.java:3268)
            at org.eclipse.swt.widgets.Widget.error(Widget.java:653)
            at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:331)
            at org.eclipse.swt.widgets.Control.forceFocus(Control.java:782)
            at org.eclipse.swt.widgets.Decorations.restoreFocus(Decorations.java:388)
            at org.eclipse.swt.widgets.Shell.kEventWindowActivated(Shell.java:909)
            at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2036)
            at org.eclipse.swt.widgets.Display.windowProc(Display.java:4032)
  • The ESC key listener works fine

Please let me know if I can create more test cases.  Obviously, I'll take my own shot at fixing it; however, based on my current X3D knowledge, I will be more use to everyone if I track down tests, documentation, and research.

Also of note:
  • When I launch from the Eclipse launcher, the program pops up, does not display the scene, and disappears without terminating.  Visual display, including animation, is fine if I run from the command line with the same java.library.path and classpath.  Since I haven't been here long enough to prove my competence, I'll state how I got the paths: I ran the program from the Eclipse launcher and copy/pasted the relevant output from System.getProperties().store( System.out ).  I attached a copy of my command line execution script.
  • There do exist some JOGL problems on Mac OS X.  Apple has been notified and is working on them.  It would be good if someone run this test case on a non-OS X environment to verify
  • I won't be around to help much longer today to help because I have a date in a little while.  I'll definitely be back at it tonight or tomorrow morning (US Eastern Time).

Edit: I SVN updated and get the same result.  Only change to the previously posted code is
Code:
        Tuple2f borderSize = new Point2f();
        this.getSizeOfPixels( 6, 6, borderSize );
« Last Edit: 11. February 2007, 07:02:27 pm by horati » Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #11 on: 11. February 2007, 07:13:48 pm »

I will check your files later. But the HUD3DTest runs out-of-the-box from SVN with SWT. It extends the MD2LoaderTest, which is set up to run the RenderLoop in the same thread (MD2LoaderTest, line 256), which I have done espeacially to get it working with SWT.

Isn't it running on your machine?

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #12 on: 11. February 2007, 09:54:08 pm »

Nope.  Out of the box, it runs fine using JOGL_AWT but JOGL_SWT has no mouse movement at all and I get these exceptions when the program gains/loses focus or I hit the ESC key:
Quote
org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:3374)
        at org.eclipse.swt.SWT.error(SWT.java:3297)
        at org.eclipse.swt.SWT.error(SWT.java:3268)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:653)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:331)
        at org.eclipse.swt.widgets.Control.isEnabled(Control.java:1476)
        at org.eclipse.swt.widgets.Display.getFocusControl(Display.java:1507)
        at org.eclipse.swt.widgets.Decorations.saveFocus(Decorations.java:393)
        at org.eclipse.swt.widgets.Shell.kEventWindowDeactivated(Shell.java:967)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2040)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4032)
org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:3374)
        at org.eclipse.swt.SWT.error(SWT.java:3297)
        at org.eclipse.swt.SWT.error(SWT.java:3268)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:653)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:331)
        at org.eclipse.swt.widgets.Control.forceFocus(Control.java:782)
        at org.eclipse.swt.widgets.Decorations.restoreFocus(Decorations.java:388)
        at org.eclipse.swt.widgets.Shell.kEventWindowActivated(Shell.java:909)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2036)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4032)
org.eclipse.swt.SWTException: Invalid thread access
        at org.eclipse.swt.SWT.error(SWT.java:3374)
        at org.eclipse.swt.SWT.error(SWT.java:3297)
        at org.eclipse.swt.SWT.error(SWT.java:3268)
        at org.eclipse.swt.widgets.Widget.error(Widget.java:653)
        at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:331)
        at org.eclipse.swt.widgets.Control.getShell(Control.java:1123)
        at org.eclipse.swt.widgets.Control.translateTraversal(Control.java:3265)
        at org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(Control.java:1800)
        at org.eclipse.swt.widgets.Widget.textInputProc(Widget.java:2000)
        at org.eclipse.swt.widgets.Display.textInputProc(Display.java:3838)
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #13 on: 11. February 2007, 10:03:51 pm »

Hmmm... It runs on my system. Which Operation System do you use? I'm running Linux and Java 1.6. And I've successfully tested it on Windows XP and Java 1.5.

Unfortuantely I cannot download any of the attached files. Could you please send them via mail (check your PM)?

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #14 on: 12. February 2007, 07:23:36 pm »

I missed this request for the files via e-mail.  I run Mac OS X 10.4.8.

I am happy to announce that I have fixed the SWT threading issue in my local environment.  I need to perform more a lot more testing as well as gain developer SVN access before I commit the changes.  There was an issue with illegal creation of SWT Displays that I fixed as well.

Edit: I'm going to take the rest of the day off.  I'm exhausted after putting in 110 hours in the last 8 days.  Hopefully, somebody can grant me SVN access overnight so I can test and commit the fixes tomorrow.
« Last Edit: 12. February 2007, 07:34:26 pm by horati » Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic