Skip to content

"loadTexture()"/"loadMesh()" throw NullPointerException (only using Eclipse) #1905

@Nathipha

Description

@Nathipha

First of all: I'm still using version 3.0.1 of the framework and I'm aware that you won't be able to fix the problem yourself but I'm wondering if anyone has come across anything similar and has a suggestion what I could try to fix it.

My app loads .obj files (and their textures) at runtime and displays certain ones depending in which direction you're looking. I had to do a couple of changes to deal with a Bundle that's passed from another Android app (non-VR) but I didn't change anything about the way the objects and textures are loaded (didn't even touch anything close to it), still I'm now experiencing a weird problem:

Every time I try to load a texture or .obj file, it throws a NullPointerException:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.io.InputStream.markSupported()' on a null object reference

My code for it:

File f1 = new File(path, jpgname);
GVRAndroidResource ar = new GVRAndroidResource(f1);
GVRTexture tex = gvrcontext.loadTexture(ar);
GVRMaterial mat = new GVRMaterial(gvrcontext);
mat.setMainTexture(tex);

GVRSceneObject obj = new GVRSceneObject(gvrcontext);
GVRRenderData render = new GVRRenderData(gvrcontext);
File f2 = new File(path, objname);
GVRMesh mesh = gvrcontext.loadMesh(new GVRAndroidResource(f2));
render.setRenderingOrder(GVRRenderingOrder.TRANSPARENT);
render.setMesh(mesh);

I already checked, "f1", "f2" and "ar" aren't "null", the problem seems to be caused by something in "loadTexture"/"loadMesh".

The actual weird part is: This only happens if I start the app through Eclipse (Run - Run As - Android Application). If I start it by tapping the icon on my phone, everything's working fine - it's loading the same objects and textures without a problem and there are no errors or exceptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions