Problems

Hi all! :slight_smile:



I've updated jme from version 0.10 to CVS yesterday,but i've encountered some small problems executing my project.


  1. I use textured quads to show bullets,and in some case i want them to become full transparent. Before the update of jme i was using the setSolidColor() and getDefaultColor() in order to modify the colors (and alpha) of a Quad,but now the getter method doesnt exist anymore… I think i cannot use materials because the lights are off on the quads. What can i do?


  2. Using display list now gives me some graphic artifacts.

    I have a ship model loaded from disk. I add to the ship alpha/material/texture states. When i enable display list (i use only lockMeshes()),the specular highlight start to flashing,then the light itself on the model disappear completely…



    Another question…

    If i modify a material or texture state on a locked mesh,jme will destroy then recreate the display list or i have to do that myself with the unlock methods?



    Thanks in advance! :wink:
  1. they have moved to the batches - simply get the first batch if you know you have just one (e.g. for a Quad)
  2. no idea



    another question: think you have to do it yourself (the engine does not notice such changes afaik)

locking does not include states in the display lists, so it should take effect immediately. (assuming you did it right.)

Thanks fo the replies.  :slight_smile:

I solved the first problem,but i dont know how to fix the display list problem…

This is the code:



"THIS" is a class (ShipNode) that extends NODE.

Loading the model…


URL texPath = new File(System.getProperty("user.dir")+"./resource/graphic/player").toURL();
jmeReader.setProperty("texurl",texPath);
jmeReader.setProperty("bound","sphere");
jmeReader.loadBinaryFormat(shipNode,new ByteArrayInputStream(buffer));


Assign render state then enables display list...

this.chiocciolaCore = ((Node)this.getChild("ms3d file")).getChild("ChiocciolaCore");
this.chiocciolaCannons = ((Node)this.getChild("ms3d file")).getChild("ChiocciolaCannons");
this.chiocciolaLights = ((Node)this.getChild("ms3d file")).getChild("ChiocciolaLights");

this.setLocalScale(1.2f);
this.setRenderQueueMode(Renderer.QUEUE_INHERIT);
this.setLightCombineMode(LightState.INHERIT);
this.setCullMode(Spatial.CULL_INHERIT);

this.ms = (MaterialState) this.chiocciolaCore.getRenderState(RenderState.RS_MATERIAL);
this.ms.setEnabled(true);
this.ms.setAmbient(new ColorRGBA(0.0f,0.0f,0.0f,1.0f));
this.ms.setDiffuse(new ColorRGBA(0.0f,0.0f,0.0f,1.0f));
this.ms.setSpecular(new ColorRGBA(1.0f,1.0f,1.0f,1.0f));
this.ms.setEmissive(new ColorRGBA(0.0f,0.0f,0.0f,1.0f));
this.ms.setShininess(10.0f);

this.ts = (TextureState) this.chiocciolaCore.getRenderState(RenderState.RS_TEXTURE);
this.ts.setEnabled(true);
Texture t = this.ts.getTexture();
t.setApply(Texture.AM_ADD);
t.setMipmapState(Texture.MM_LINEAR);
t.setFilter(Texture.FM_LINEAR);
t.setWrap(Texture.WM_CLAMP_S_CLAMP_T);
t.setCorrection(Texture.CM_PERSPECTIVE);

AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
as.setEnabled(true);
as.setBlendEnabled(true);
as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
as.setTestEnabled(true);
as.setTestFunction(AlphaState.TF_GREATER);

//texture
TextureState ts = (TextureState)this.chiocciolaLights.getRenderState(RenderState.RS_TEXTURE);
ts.setEnabled(true);
Texture t2 = ts.getTexture();
t2.setApply(Texture.AM_REPLACE);
t2.setMipmapState(Texture.MM_LINEAR);
t2.setFilter(Texture.FM_LINEAR);
t2.setWrap(Texture.WM_CLAMP_S_CLAMP_T);
t2.setCorrection(Texture.CM_PERSPECTIVE);

this.chiocciolaLights.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
this.chiocciolaLights.setRenderState(as);
this.chiocciolaLights.setCullMode(Spatial.CULL_NEVER);
this.chiocciolaLights.setLightCombineMode(LightState.OFF);
this.chiocciolaLights.setTextureCombineMode(TextureState.REPLACE);

//use Display List
this.chiocciolaCore.lockMeshes();
this.chiocciolaCannons.lockMeshes();

I think i've resolved this issue by calling updateGeometricState() before the call to lockMeshes()…