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

Crash on iOS #16

Open
Snehks opened this issue Apr 27, 2021 · 8 comments
Open

Crash on iOS #16

Snehks opened this issue Apr 27, 2021 · 8 comments

Comments

@Snehks
Copy link

Snehks commented Apr 27, 2021

Hi, I am getting the following crash on iOS.

com.badlogic.gdx.utils.GdxRuntimeException: File not found: gdxvfx/shaders/screenspace.vert (Classpath)
 	at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:142)
 	at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:638)
 	at com.badlogic.gdx.files.FileHandle.estimateLength(FileHandle.java:239)
 	at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:204)
 	at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:197)
 	at com.crashinvaders.vfx.gl.VfxGLUtils.compileShader(VfxGLUtils.java:103)
 	at com.crashinvaders.vfx.gl.VfxGLUtils.compileShader(VfxGLUtils.java:79)
 	at com.crashinvaders.vfx.effects.LensFlareEffect.<init>(LensFlareEffect.java:61)

The project works fine on desktop and Android.

@metaphore
Copy link
Member

Hi @Snehks,
Thanks for the report.
Sorry for the delay, but I do not actively maintain this project atm.
I will check on the issue next week and hopefully prepare a new release for LibGDX 1.10.0

@Laurent1967
Copy link

Hi, I get this error too. Have you already found some time to look at this ?
Thanks !

@Laurent1967
Copy link

This issue is still there after the update to libGDX 1.10.0

@metaphore
Copy link
Member

Hi, sorry for not coming back to you earlier on this one.
The problem was identified a while ago and still didn't get any resolution.

The issue here is with the specifics of MobiVM. iOS modules basically don't pick up the library's built in asset files (including those shader vert/frag ones).

While there's technically still no easy fix, one workaround would be to extract the library's assets and add them to iOS module manually. For that you'd need to

  1. Grab the entire gdx-vfx/effects/assets dir and place it to the root of your iOS submodule.
  2. In your robovm.xml file add a resource configuration entry like so
<config>
  ...
  <resources>
    <resource>
      <directory>assets</directory>
      <includes>
        <include>**</include>
      </includes>
      <skipPngCrush>true</skipPngCrush>
    </resource>
    ...
  </resources>

That should do the trick. Please let me know if you have any issues with that.

@Laurent1967
Copy link

Laurent1967 commented Dec 30, 2021 via email

@lucas-viva
Copy link

lucas-viva commented Jul 18, 2022

Hey @metaphore, thanks for providing an workaround.

If I understood this correctly, the vert/frag files are read using Gdx.files.classpath, for example here:

Gdx.files.classpath("gdxvfx/shaders/screenspace.vert"),

I tested the workaround and I believe it doesn't work because when the FileHandle tries to read it, it loads from the classpath here.

Do you have any suggestions on alternatives? (maybe using Gdx.files.internal given it will try both the internal and classpath types?)

Cheers!

@metaphore
Copy link
Member

metaphore commented Jul 18, 2022

Unfortunately, the MobiVM team hasn't provided any helpful insight as of yet and I don't really have any good workaround for the vfx-effects module.

The only thing that can be done now, is to grab the effects code, replace all the classpath file references with internal. That requires having all the vert and frag shader files to be manually added to your game's assets...

@lucas-viva
Copy link

Thanks!

I copied the code for the time being, replacing the references.

Note for future readers: you have to do it to iOS only. For Android, still use the classpath call. I didn't test for other platforms but I believe it is a good idea keep using classpath.

Cheers!

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

4 participants