question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It seems that the binary format output by jgltf-browser 2.0 is incorrect

See original GitHub issue

I tried saving glTF file in binary format using jgltf-browser 2.0. The following is the procedure I tried.

  1. [Samples] - [Khronos Sample, v2.0] - [Duck] - [glTF (https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Duck/glTF/Duck.gltf)]
  2. [File] - [Save as binary…] - [Duck.glb]
  3. [File] - [Open file…] - [Duck.glb]

The following error is displayed.

Loading error: java.io.IOException: Could not load glTF asset
java.util.concurrent.ExecutionException: java.io.IOException: Could not load glTF asset
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at javax.swing.SwingWorker.get(SwingWorker.java:602)
	at de.javagl.swing.tasks.SwingTask.get(SwingTask.java:435)
	at de.javagl.jgltf.browser.GltfLoadingWorker.done(GltfLoadingWorker.java:170)
	at de.javagl.swing.tasks.SwingTask.callDone(SwingTask.java:473)
	at de.javagl.swing.tasks.SwingTask.access$200(SwingTask.java:74)
	at de.javagl.swing.tasks.SwingTask$SwingTaskWorker.done(SwingTask.java:108)
	at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
	at javax.swing.Timer.fireActionPerformed(Timer.java:313)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
	at java.awt.Dialog.show(Dialog.java:1084)
	at java.awt.Component.show(Component.java:1671)
	at java.awt.Component.setVisible(Component.java:1623)
	at java.awt.Window.setVisible(Window.java:1014)
	at java.awt.Dialog.setVisible(Dialog.java:1005)
	at de.javagl.swing.tasks.DefaultSwingTaskView.show(DefaultSwingTaskView.java:70)
	at de.javagl.swing.tasks.SwingTaskExecutor.doExecute(SwingTaskExecutor.java:360)
	at de.javagl.swing.tasks.SwingTaskExecutor.execute(SwingTaskExecutor.java:318)
	at de.javagl.jgltf.browser.GltfLoadingWorker.load(GltfLoadingWorker.java:125)
	at de.javagl.jgltf.browser.GltfBrowserApplication.openUriInBackground(GltfBrowserApplication.java:559)
	at de.javagl.jgltf.browser.GltfBrowserApplication.openFile(GltfBrowserApplication.java:500)
	at de.javagl.jgltf.browser.GltfBrowserApplication.access$000(GltfBrowserApplication.java:76)
	at de.javagl.jgltf.browser.GltfBrowserApplication$1.actionPerformed(GltfBrowserApplication.java:106)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
	at java.awt.Component.processMouseEvent(Component.java:6533)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6298)
	at java.awt.Container.processEvent(Container.java:2236)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2294)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
	at java.awt.Container.dispatchEventImpl(Container.java:2280)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.io.IOException: Could not load glTF asset
	at de.javagl.jgltf.browser.GltfAssetReaderThreaded.readGltfAsset(GltfAssetReaderThreaded.java:288)
	at de.javagl.jgltf.browser.GltfLoadingWorker.doInBackground(GltfLoadingWorker.java:162)
	at de.javagl.jgltf.browser.GltfLoadingWorker.doInBackground(GltfLoadingWorker.java:59)
	at de.javagl.swing.tasks.SwingTask.doTaskInBackground(SwingTask.java:335)
	at de.javagl.swing.tasks.SwingTask.access$000(SwingTask.java:74)
	at de.javagl.swing.tasks.SwingTask$SwingTaskWorker.doInBackground(SwingTask.java:84)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at javax.swing.SwingWorker.run(SwingWorker.java:334)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
javaglcommented, Oct 2, 2017

The bug was fixed in https://github.com/javagl/JglTF/commit/a7f214b11347371c79088572ecd9c31bad523e8a

The main problem (besides the copy+paste error) was that the chunkLength was set to be the length of the whole chunk (inculding the chunkLength and chunkType slots), but this is wrong. While the length field in the header refers to the whole file, the chunkLength is not the length of the whole chunk, but only the length of the chunk data.

(Actually, the IO is already tested with a unit test, but the GLB that the test output was compared against was already wrong - this is also fixed now)

Thanks again for bringing this up.

0reactions
javaglcommented, Oct 9, 2017

I think that it is almost correctly displayed in JglTF, but since it is dark overall, it feels good to set the lights a bit more bright. (or it would be nice to be able to set the light settings as options.)

Setting the light options would certainly be a second step. As you know, most viewers allow selecting an environment light map. One problem is: Purely metallic objects look pretty cool with environment maps, but with “simple” lights, they appear all black. (E.g. the floor of the polly model)

I hope that I can integrate (selectable) environment maps in JglTF, too. And of course, the other lights should not just be one single point light, but all sorts of lights that will soon be required for the KHR_Lights extension anyhow.

Although this should be interesting, it is not the top priority right now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NpgsqlBinaryImporter fails with incorrect binary data format
I'm trying to do a binary copy from Windows to postgres on ubuntu. After writing several rows of data, the command is closed...
Read more >
Can anyone please tell why this binary to decimal program ...
Given a Binary Number B, Print its decimal equivalent. Input: The first line of input contains an integer T denoting the number of...
Read more >
Documents Print Incorrectly Using the PostScript ... - Epson
EPS files created in binary format may not print correctly. Try creating the file in ASCII format instead. In Windows, the product cannot...
Read more >
Binary Input and Output - Snowflake Documentation
The answer is that the argument to TO_BINARY is treated as a sequence of hexadecimal digits (even though it is inside quotes and...
Read more >
Documentation: 15: 8.4. Binary Data Types - PostgreSQL
The bytea type supports two formats for input and output: “hex” format and ... The “hex” format encodes binary data as 2 hexadecimal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found