Search code examples
androidgear-vr

GearVRf - SceneObject not visible with GVSphere Image


I am trying to show a dot/pointer on GVRSphereSceneObject in GearVR. But, only the GVRSphereSceneObject is showing where as scene object hides once the texture image becomes visible. If I add both sphere and object using addSceneObject, then image is shown on one side and rest of view is blacked out.

I couldn't find any issue regarding this and tried samples also. Any help will be greatly appreciated.

Here is the code for adding object over sphere.

    Future<GVRTexture> texture = gvrContext.loadFutureTexture(new GVRAndroidResource(gvrContext, R.raw.pano));

    GVRMaterial material = new GVRMaterial(gvrContext);
    material.setMainTexture(texture);

    boom = new GVRSphereSceneObject(gvrContext, 18, 36, false, material);

    Pointer = new GVRSceneObject(gvrContext,
            new FutureWrapper<>(gvrContext.createQuad(0.05f, 0.05f)),
            gvrContext.loadFutureTexture(new GVRAndroidResource(this.gvrContext, R.drawable.target)));
    Pointer.getRenderData().getMaterial().setColor(Colors.RED[0], Colors.RED[1], Colors.RED[2]);

    Pointer.getTransform().setPosition(0.0f, 0.0f, -1.0f);
    Pointer.setName("Pointer");
    boom.addChildObject(Pointer);
    scene.addSceneObject(boom);

Solution

  • If anyone is struggling with this. Please have a look at this issue.

    Pointer.getRenderData().setDepthTest(false);
    Pointer.getRenderData().setRenderingOrder(SXRRenderData.SXRRenderingOrder.OVERLAY);