Git Product home page Git Product logo

Comments (8)

sriharshachilakapati avatar sriharshachilakapati commented on June 6, 2024

Is that exception all? I think it is incomplete, there should be a Caused by: line which is explaining about the real issue. It would also help if you tell me whether the sound file you are loading is a WAV or a OGG file.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on June 6, 2024

@fagossa Any updates?

from silenceengine.

fagossa avatar fagossa commented on June 6, 2024

Hi,

I'm trying to load a wav file.

I upgraded my jdk to jdk_8_066

[INFO 01/03/2016 12:11:34 PM] LWJGL version 3.0.0 build 7 is initialised
[INFO 01/03/2016 12:11:34 PM] [LWJGL] Version: 3.0.0 build 7
[INFO 01/03/2016 12:11:34 PM] [LWJGL]    OS: Mac OS X v10.11
[INFO 01/03/2016 12:11:34 PM] [LWJGL]   JRE: 1.8.0_66 x86_64
[INFO 01/03/2016 12:11:34 PM] [LWJGL]   JVM: Java HotSpot(TM) 64-Bit Server VM v25.66-b17 by Oracle Corporation

Here is the full trace:

[INFO 01/03/2016 12:11:34 PM] [LWJGL] Loaded library from org.lwjgl.librarypath: lwjgl
[INFO 01/03/2016 12:11:34 PM] [LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[INFO 01/03/2016 12:11:34 PM] [LWJGL] Loaded native library: /var/folders/5h/f2t3rrvs1mg1cjtsylppphc00000gn/T/SilenceEngine6877229952434969225/libjemalloc.dylib
[INFO 01/03/2016 12:11:34 PM] [LWJGL] MemoryUtil allocator: JEmallocAllocator
[INFO 01/03/2016 12:11:34 PM] [LWJGL] Loaded native library: /var/folders/5h/f2t3rrvs1mg1cjtsylppphc00000gn/T/SilenceEngine6877229952434969225/libglfw.dylib
[INFO 01/03/2016 12:11:34 PM] Initializing SilenceEngine. Platform identified as MACOSX
[INFO 01/03/2016 12:11:34 PM] Running AWT fix on Mac OS X, needed for LWJGL to run
[INFO 01/03/2016 12:11:34 PM] [LWJGL] Loaded native library: libobjc.dylib
[INFO 01/03/2016 12:11:34 PM] [LWJGL] Loaded native library bundle: /System/Library/Frameworks/OpenGL.framework
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform1dEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform2dEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform3dEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform4dEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform1dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform2dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform3dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniform4dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix2dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix3dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix4dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix2x3dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix2x4dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix3x2dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix3x4dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix4x2dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix4x3dvEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glVertexArrayVertexAttribDivisorEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glTextureStorage1DEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glTextureStorage2DEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glTextureStorage3DEXT
[WARNING 01/03/2016 12:11:34 PM] [LWJGL] Failed to locate address for GL function glVertexArrayVertexAttribLOffsetEXT
[INFO 01/03/2016 12:11:34 PM] Clearing out OpenGL errors
2016-01-03 12:11:34.742 java[23273:682453] [JRSAppKitAWT markAppIsDaemon]: Process manager already initialized: can't fully enable headless mode.
[INFO 01/03/2016 12:11:36 PM] Initializing Audio Engine with OpenAL 1.1
[INFO 01/03/2016 12:11:36 PM] [LWJGL] Loaded native library: /var/folders/5h/f2t3rrvs1mg1cjtsylppphc00000gn/T/SilenceEngine6877229952434969225/libopenal.dylib
[INFO 01/03/2016 12:11:36 PM] Audio Engine initialized successfully, with device OpenAL Soft
[INFO 01/03/2016 12:11:36 PM] SilenceEngine version 0.4.1b was initialized successfully
[INFO 01/03/2016 12:11:36 PM] Initializing the Game resources
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform1dEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform2dEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform3dEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform4dEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform1dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform2dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform3dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniform4dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix2dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix3dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix4dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix2x3dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix2x4dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix3x2dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix3x4dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix4x2dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glProgramUniformMatrix4x3dvEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glVertexArrayVertexAttribDivisorEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glTextureStorage1DEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glTextureStorage2DEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glTextureStorage3DEXT
[WARNING 01/03/2016 12:11:36 PM] [LWJGL] Failed to locate address for GL function glVertexArrayVertexAttribLOffsetEXT
[TRACE 01/03/2016 12:11:36 PM]
com.shc.silenceengine.core.SilenceException: java.lang.NullPointerException
    at com.shc.silenceengine.utils.FileUtils.readToByteBuffer(FileUtils.java:159)
    at com.shc.silenceengine.backend.lwjgl3.opengl.Texture.fromInputStream(Texture.java:144)
    at com.shc.silenceengine.backend.lwjgl3.opengl.Texture.fromFilePath(Texture.java:127)
    at com.shc.silenceengine.core.ResourceLoader.textureLoadHelper(ResourceLoader.java:100)
    at com.shc.silenceengine.core.ResourceLoader.asyncLoadResources(ResourceLoader.java:284)
    at java.lang.Thread.run(Thread.java:745)

    at com.shc.silenceengine.core.SilenceException.reThrow(SilenceException.java:73)
    at com.shc.silenceengine.utils.FileUtils.readToByteBuffer(FileUtils.java:171)
    at com.shc.silenceengine.backend.lwjgl3.opengl.Texture.fromInputStream(Texture.java:144)
    at com.shc.silenceengine.backend.lwjgl3.opengl.Texture.fromFilePath(Texture.java:127)
    at com.shc.silenceengine.core.ResourceLoader.textureLoadHelper(ResourceLoader.java:100)
    at com.shc.silenceengine.core.ResourceLoader.asyncLoadResources(ResourceLoader.java:284)
    at java.lang.Thread.run(Thread.java:745)

AL lib: (EE) alc_cleanup: 1 device not closed

Process finished with exit code 255

Ps
I found another problem in ResourceFilePath::getJarEntries with this line:

String jarPath = URLDecoder.decode(jarUrl.substring(jarUrl.indexOf('/') + 1, jarUrl.indexOf('!')), "UTF-8");

causing this error:

java.io.FileNotFoundException: Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/lib/ant-javafx.jar (No such file or directory)

On mac the fix consist of simply deleting the +1 so we don't skip the first '/'. I couldn't find unit test around these feature. Anyways, it becomes:

String jarPath = URLDecoder.decode(jarUrl.substring(jarUrl.indexOf('/'), jarUrl.indexOf('!')), "UTF-8");

I'll make a PR as soon as I find the time.

from silenceengine.

fagossa avatar fagossa commented on June 6, 2024

I found that the error comes from Texture::fromFilePath(FilePath) because the path specified could not be found.

However, this seems odd as the file do exist in my resources directory: resources/space_ship_gold.png.

As the problem could come from different sources (relative path, my own gradle, jdk bug, etc) I will investigate on the subject and update the issue accordingly.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on June 6, 2024

The texture problem is a separate problem, so please kindly make a new issue for that. I'd like to see what is this statement printing for you:

System.out.println(ResourceFilePath.class.getClassLoader().getResource(filePath.getPath()));

Test that with the file path which is having issue. As far as I can tell, there is something which is trying to fetch from ant-javafx.jar which should not be the case, SilenceEngine does not rely on JavaFX.

from silenceengine.

fagossa avatar fagossa commented on June 6, 2024

I migrated from jdk8_0_25 to jdk8_0_66 because the previous error was related to an ant-javafx.jar not found.

I printed what you suggested and also the absolute path, like this:

System.out.println(ResourceFilePath.class.getClassLoader().getResource(filePath.getPath()));
System.out.println(filePath.getAbsolutePath());

And as long as the searched resource comes from engine's resources directory I get this:

file:/Users/myUser/Documents/myprojects/SEtest/SilenceEngine/build/resources/main/resources/logo_dark.png
resources/logo_dark.png

However, when the resources come from my own resources folder (src/main/resources) then I get:

null
resources/space_ship_mother.png

Just in case my folder tree is as follows

|SEtest
|- AutoInvaders
|-- src
|---- main
|------ java
|------ resources
|
|- SilenceEngine
|-- src
|---- main
|------ java
|-------- resources

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on June 6, 2024

Okay the issue is in the setup, the files in src\main\resources\ in your application will usually go into the root of the JAR, unless configured in the Gradle build script manually. Try calling for your image with just the file name.

FilePath.getResourceFile("space_ship_mother.png").exists(); // Should be true

from silenceengine.

fagossa avatar fagossa commented on June 6, 2024

you're right!!

instead of specifying the resource directory like this:

FilePath.getResourceFile("resource/space_ship_mother.png")

I just need to

FilePath.getResourceFile("space_ship_mother.png")

from silenceengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.