hi there,
i want to display an image in a HUD. the problem is that the image displayed is smaller than the original image (which is not the desired/expected behaviour).
here's the source image: http://moenia.sourceforge.net/images/screenshots/source.png
…and here's the result: http://moenia.sourceforge.net/images/screenshots/result.png
…which i would expect to be the same size as the source.
here's a test case:
import com.jme.app.SimpleGame;
import com.jme.image.Texture;
import com.jme.renderer.Renderer;
import com.jme.scene.Spatial;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
public class TestCase extends SimpleGame {
protected void simpleInitGame() {
Texture texture = TextureManager.loadTexture("source.png", Texture.MM_LINEAR,
Texture.FM_LINEAR);
int imageWidth = texture.getImage().getWidth(), imageHeight = texture.getImage().getHeight();
Quad imageQuad = new Quad("image.quad", imageWidth, imageHeight);
imageQuad.setRenderQueueMode(Renderer.QUEUE_ORTHO);
imageQuad.setCullMode(Spatial.CULL_NEVER);
imageQuad.setLightCombineMode(LightState.OFF);
TextureState textureState = DisplaySystem.getDisplaySystem().getRenderer()
.createTextureState();
textureState.setTexture(texture);
textureState.setEnabled(true);
imageQuad.setRenderState(textureState);
AlphaState alpha = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
alpha.setSrcFunction(AlphaState.SB_SRC_ALPHA);
alpha.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
alpha.setTestFunction(AlphaState.TF_GREATER);
alpha.setBlendEnabled(true);
imageQuad.setRenderState(alpha);
imageQuad.getLocalTranslation().set(display.getWidth() / 2, display.getHeight() / 2, 0);
rootNode.attachChild(imageQuad);
rootNode.updateRenderState();
rootNode.updateGeometricState(0, true);
}
public static void main(String[] args) {
TestCase app = new TestCase();
app.setDialogBehaviour(FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
app.start();
}
}
am i mistaking when i assume that "1 ortho unit" == "1 pixel unit" ?
i'd be very glad for any hint.