Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Macbook pro, gltf file not getting rendered. #33

Closed
skbhartihbti opened this issue Mar 1, 2019 · 10 comments
Closed

Using Macbook pro, gltf file not getting rendered. #33

skbhartihbti opened this issue Mar 1, 2019 · 10 comments

Comments

@skbhartihbti
Copy link

skbhartihbti commented Mar 1, 2019

Java code

public static void main(String[] args) throws Exception
{
    String uriString = 
        "https://raw.githubusercontent.com/KhronosGroup/" + 
        "glTF-Sample-Models/master/2.0/Duck/glTF/Duck.gltf";
    GltfModelReader r = new GltfModelReader();
    GltfModel gltfModel = r.read(new URI(uriString));
    SwingUtilities.invokeLater(() -> createAndShowGui(gltfModel));
}

private static void createAndShowGui(GltfModel gltfModel)
{
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
    // Create a viewer based on JOGL or LWJGL:
    GltfViewer<Component> gltfViewer = new GltfViewerJogl();
    //GltfViewer<Component> gltfViewer = new GltfViewerLwjgl();
    
    gltfViewer.addGltfModel(gltfModel);
    f.getContentPane().add(gltfViewer.getRenderComponent());
    f.setSize(500,500);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

Getting below issue,

Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.AbstractGltfViewer createRenderedGltf
INFO: Creating rendered glTF
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.jogl.GlContextJogl printShaderLogInfo
WARNING: shader log:
ERROR: 0:2: '' : #version required and missing.
ERROR: 0:2: 'attribute' : syntax error: syntax error�
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.jogl.GlContextJogl createGlShader
WARNING: glShader :::::null
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.jogl.GlContextJogl createGlShader
WARNING: Inserting GLSL version specifier "#version 120" in shader code
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.jogl.GlContextJogl printShaderLogInfo
WARNING: shader log:
ERROR: 0:1: '' : version '120' is not supported
ERROR: 0:2: '' : #version required and missing.
ERROR: 0:3: 'attribute' : syntax error: syntax error�
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.jogl.GlContextJogl createGlProgram
WARNING: Creating vertex shader FAILED
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.GltfRenderData createGlProgram
WARNING: Creating GL program for de.javagl.jgltf.model.gl.impl.DefaultProgramModel@60a32057 FAILED
Mar 01, 2019 5:50:00 PM de.javagl.jgltf.viewer.DefaultRenderedGltfModel processMeshPrimitiveModel
WARNING: No GL program found for program de.javagl.jgltf.model.gl.impl.DefaultProgramModel@60a32057 in technique de.javagl.jgltf.model.gl.impl.DefaultTechniqueModel@3af72daf

@javagl
Copy link
Owner

javagl commented Mar 1, 2019

The viewer, specifically the support for glTF 2.0, and even more specifically, the PBR support, is still under construction. Even if it worked, due to many issues related to PBR (mainly the lighting, which is not part of glTF 2.0 at all), it would probably look ugly.

What is strange, however, is the message

version '120' is not supported

Can you provide more information about the hardware and the GL version that it supports?

@skbhartihbti
Copy link
Author

skbhartihbti commented Mar 1, 2019

screen shot 2019-03-01 at 6 25 38 pm

How can I get "hardware and the GL version that it supports" information?

@javagl
Copy link
Owner

javagl commented Mar 8, 2019

According to the table at https://support.apple.com/en-us/HT202823, this should support OpenGL > 4.1, so this should be fine.

So you see the same behavior when you switch to the LWJGL-based renderer?

If so, my only (vague) guess would be that it has to do with the Intel OpenGL and its drivers, but I assume that the drivers are up to date...?

@idontusenumbers
Copy link

I am having the same issue.

I tried to get LWJGL working but could not figure it out. Trying LWJGL 3 caused some class not found errors.

I tried LWJGL 2 latest (2.93) and the second most downloaded 2.9.1 and both result in:

Error while creating viewer:
java.lang.LinkageError: Version mismatch: jar version is '23', native library version is '25'
	at org.lwjgl.Sys.<clinit>(Sys.java:118)

Which I can't resolve.

@javagl
Copy link
Owner

javagl commented Mar 12, 2020

@idontusenumbers Sorry for the delay here. Did you resolve the issue?
If not:

How did you include LWJGL in your case? With Maven, or by manually adding the JAR to the classpath? The message indicates that the native library is not the right one for the JAR that you are using. And depending on how you added LWJGL to your setup, you might have seen the necessity to unpack the lwjgl.so file and add it to your project directory or so. In this case, you could check whether the .so file is really the one that matches the JAR that you are using.

More details about the setup could help here.

@idontusenumbers
Copy link

I used the jars and made sure the native libraries were in place (or at least I thought I did)

@javagl
Copy link
Owner

javagl commented Mar 13, 2020

The point is: Are you sure that you used the exact native library that matches the JAR, in terms of the version number?

That's just a guess until now, but when you say

I tried LWJGL 2 latest (2.93) and the second most downloaded 2.9.1

and the error message says

jar version is '23', native library version is '25'

then it seems very probable to me that you used the native library from 2.9.3 (which presumably has version 25), but the JAR for 2.9.1 (which presumably requires the native library version 23) ...

@idontusenumbers
Copy link

I just downloaded 2.9.3 Distro from http://legacy.lwjgl.org/download.php.html

I copied the jars from lwjgl-2.9.3/jar into jgltf-browser/target/lib
I copied all files in lwjgl-2.9.3/native/macosx into jgltf-browser/target
I ran: jgltf-browser/target/:java -cp "./lib" -jar jgltf-browser-2.0.1-SNAPSHOT-jar-with-dependencies.jar

Got the same error: jar version is '23', native library version is '25'

I finally realized the pom is importing jar version 2.8.4, so I downloaded those natives and got

_NSJVMLoadLibrary: NSAddLibrary failed for /libjawt.dylib
JavaVM FATAL: lookup of function JAWT_GetAWT failed. Exit

I tried migrating JglTF to use LWJGL3 but it looks like they removed the AWT canvas. There's a third party that implemented the AWT canvas but not for MacOS =( https://github.com/LWJGLX/lwjgl3-awt
There's a ticket for the mac support but it's closed. LWJGLX/lwjgl3-awt#1
I don't see any forks that add support

For what it's worth, when I load the JglTF sources and execute the package target, the two tests don't pass in the model sub project. That might be the source of the JOGL failures.

@javagl
Copy link
Owner

javagl commented Mar 14, 2020

There are certainly caveats regarding the lookup path for native libraries on Mac. If you have another lwjgl.so on your system, and it happens to be in the lookup path that is used by System.loadLibrary, then it's difficult to say which lib exactly will be loaded (it's not impossible, but brittle in any case).

You mentioned that you ran the jar-with-dependencies, which you most likely assembled on your own. As mentioned on the 'releases' page (for the previous releases), the native library handling of LWJGL may have some glitches, and in order to create the final, runnable JAR (with LWJGL working), the library has to be repackaged with JarSplice.

Specifically: If you download one of the release JARs from https://github.com/javagl/JglTF/releases , does it work for you?

Note that support for LWJGL3 was a very early issue, already mentioned in #13 . There is a basic implementation (locally), but the lack of the AWT canvas was the main blocker for publishing it.

(Also, to some extent, they messed up the native library handling even further: Instead of calling the native lib lwjgl3.so, they also called it lwjgl.so. So it's basically impossible to support LWJGL 2 and LWJGL 3 at the same time, because the native library name for both versions is the same - a pity :-( )

@javagl
Copy link
Owner

javagl commented Jul 16, 2024

I don't see any actionable items here.

@javagl javagl closed this as completed Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants