[solved] Can't render a texture from inside of a shape

Started by kennydude, May 06, 2013, 03:44:13 PM

Previous topic - Next topic

kennydude

I'm trying to make JPCT-AE render inside of a shape. Basically, I am inside of a sphere primitive and I want to display a texture.

However, I can't get the texture to show up when I move the camera inside of the sphere. I can make it show by moving outside of the shape though, which is odd and annoying.

Here is my basic code at the moment:

    Texture texture = new Texture(3000, 3000, RGBColor.RED);
    TextureManager.getInstance().addTexture("sphere", texture);

    mSphere = Primitives.getSphere(20);
    //mSphere.calcTextureWrapSpherical();
    mSphere.setTexture("sphere");
    mSphere.build();

    mWorld = new World();
    //mWorld.setAmbientLight(50,50,50);

    mWorld.addObject(mSphere);

    Camera camera = mWorld.getCamera();
    //camera.moveCamera( Camera.CAMERA_MOVEOUT, 30 );
    //camera.setPosition( mSphere.getTransformedCenter() );
    camera.lookAt( mSphere.getTransformedCenter() );
    //camera.moveCamera(Camera.CAMERA_MOVEIN, 5);

    MemoryHelper.compact();


I have tried many variations of the code (commenting and uncommenting areas) but it just refuses to render the red colour at all.

EgonOlsen

Objects will be backface culled by default, i.e. from inside a sphere, nothing will be visible, because you are looking at backfaces only. Try setCulling(false); on the sphere.

kennydude