Hi all, I'm kind of new to jME, although I can say that a have a good grip of the bases, but now I have run into a problem that I'm not sure of how to go about solving. I built a skybox that builds and shows correctly:
private void buildSkyBox() {
skybox = new Skybox("skybox", 10, 10, 10);
Texture north = TextureManager.loadTexture(
TestSkybox.class.getClassLoader().getResource(
"com/c0mrade/sv/data/textures/north.jpg"),
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear, Image.Format.GuessNoCompression, 0.0f, true);
Texture south = TextureManager.loadTexture(
TestSkybox.class.getClassLoader().getResource(
"com/c0mrade/sv/data/textures/south.jpg"),
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear, Image.Format.GuessNoCompression, 0.0f, true);
Texture east = TextureManager.loadTexture(
TestSkybox.class.getClassLoader().getResource(
"com/c0mrade/sv/data/textures/east.jpg"),
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear, Image.Format.GuessNoCompression, 0.0f, true);
Texture west = TextureManager.loadTexture(
TestSkybox.class.getClassLoader().getResource(
"com/c0mrade/sv/data/textures/west.jpg"),
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear, Image.Format.GuessNoCompression, 0.0f, true);
Texture up = TextureManager.loadTexture(
TestSkybox.class.getClassLoader().getResource(
"com/c0mrade/sv/data/textures/top.jpg"),
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear, Image.Format.GuessNoCompression, 0.0f, true);
Texture down = TextureManager.loadTexture(
TestSkybox.class.getClassLoader().getResource(
"com/c0mrade/sv/data/textures/bottom.jpg"),
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear, Image.Format.GuessNoCompression, 0.0f, true);
skybox.setTexture(Skybox.Face.North, north);
skybox.setTexture(Skybox.Face.West, west);
skybox.setTexture(Skybox.Face.South, south);
skybox.setTexture(Skybox.Face.East, east);
skybox.setTexture(Skybox.Face.Up, up);
skybox.setTexture(Skybox.Face.Down, down);
skybox.preloadTextures();
this.skybox.updateRenderState();
CullState cullState = display.getRenderer().createCullState();
cullState.setCullFace(CullState.Face.None);
cullState.setEnabled(true);
skybox.setRenderState(cullState);
ZBufferState zState = display.getRenderer().createZBufferState();
zState.setEnabled(false);
skybox.setRenderState(zState);
FogState fs = display.getRenderer().createFogState();
fs.setEnabled(false);
skybox.setRenderState(fs);
skybox.setLightCombineMode(Spatial.LightCombineMode.Off);
skybox.setCullHint(Spatial.CullHint.Never);
skybox.setTextureCombineMode(TextureCombineMode.Replace);
skybox.updateRenderState();
skybox.lockBounds();
skybox.lockMeshes();
}
So this is how I made the skybox and this is how I rendered it in the simpleUpdate() method:
protected void simpleUpdate() {
skybox.draw(display.getRenderer());
skybox.updateGeometricState(0.0f, true);
/*more code here*/
}
The problem is that when I move around the screen, using a model attached to a ThirdPersonHandler,
the skybox flickers and distorts the screen, but returns to normal when I stop moving. However, when I looked at another example using a skybox, it looks fine. Any suggestions?