Hi guys.
I create a texture and set an Image to it like that:
final Texture2D ta = new Texture2D();
ta.setAnisotropicFilterPercent(0);
ta.setMinificationFilter(MinificationFilter.NearestNeighborNoMipMaps);
ta.setMagnificationFilter(MagnificationFilter.NearestNeighbor);
URL texURL = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, texName);
Image image = TextureManager.loadImage(texURL, false);
ta.setImage(image);
final TextureKey tkey = new TextureKey(texURL, false, image.getFormat());
ta.setTextureKey(tkey);
ta.setImageLocation(tkey.getLocation().toString());
The texture and image are loaded fine and show up as intended.
Now when I load another image and want to copy it over the original image like that:
texURL = ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, texName2);
image = TextureManager.loadImage(texURL, false);
DisplaySystem.getDisplaySystem().getRenderer().updateTextureSubImage(ta, 0, 0, image, 0, 0, 256, 256);
I get the following exception:
java.lang.IllegalArgumentException: Number of remaining buffer elements is 32768, must be at least 196608
at org.lwjgl.BufferChecks.throwBufferSizeException(BufferChecks.java:136)
at org.lwjgl.BufferChecks.checkBufferSize(BufferChecks.java:151)
at org.lwjgl.BufferChecks.checkBuffer(BufferChecks.java:156)
at org.lwjgl.opengl.GL11.glTexSubImage2D(GL11.java:2752)
at com.jme.renderer.lwjgl.LWJGLRenderer.updateTextureSubImage(LWJGLRenderer.java:1825)
at com.jme.image.TextureAnimated.setTime(TextureAnimated.java:68)
at com.jme.image.TextureAnimated.update(TextureAnimated.java:40)
at jmetest.renderer.TestTextureAnimation.simpleUpdate(TestTextureAnimation.java:86)
at com.jme.app.SimpleGame.update(SimpleGame.java:60)
at com.jme.app.BaseGame.start(BaseGame.java:85)
at jmetest.renderer.TestTextureAnimation.main(TestTextureAnimation.java:81)
Both images are the same size and everything, i just copied the same image and renamed it. The images are DXT1 .dds images. Debugging shows that both images have 32768 bytes of data right before the call.
Thanks for any help.
dhdd