How to load my custom MIPMAP

Hi , I have a question , JME3 how to load custom mipmap , I can not find , can you help me ?

The mipmaps are in the image ByteBuffer after the LOD level 0. In the mipmapSizes array you specify the size in bytes of each level including the LOD level 0

sorry , I am a freshman , can you speak detailedly ? thank you !

The Image class has two fields, ByteBuffer data (which is retrieved via Image.getData(0)) and int[] mipmapSizes. The mipmaps are stored in the data field sequentially, starting at LOD level 0 until N-1, where N is how many mipmap levels the image is supposed to have. To know which mipmap size is which, you use the mipmapSizes array which has the size in bytes of each mipmap level.



In your case you have an image with no mipmaps, so you generate them. If your image size is 64x64, you generate a 32x32 mipmap (level 1), and write it into the data field after the original 64x64 image. Now you can put an entry in the mipmapSizes array at index 1 (corresponding to level 1) that has the size of your 32x32 mipmap. Repeat the process until you reach the LOD level 6 which is 1x1 since jME3 most likely won’t accept partial mipmap data.



If you still don’t understand then you need to look at the appropriate documentation regarding texture rendering and mipmaps.

1 Like

thank you , I know some , I think I need to read more basic knowledge

I have an another question , how to store the image in the GuiNode ? I want to use GPU to store a image in the guiNode , the image size is 10241024 , and now I plan store it as 512512

[java]

@Override

public void simpleInitApp() {

flyCam.setDragToRotate(true);

Quad quad = new Quad(1024, 1024);

Geometry cube = new Geometry("My Textured quad", quad);

Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");

Texture tex_ml = assetManager.loadTexture("D:\download\1024_1024.jpg");

mat_stl.setTexture("ColorMap", tex_ml);

cube.setMaterial(mat_stl);

guiNode.attachChild(cube);

guiNode.setLocalTranslation(0, 0, 0);

// rootNode.attachChild(cube);

// rootNode.setLocalTranslation(0, 0, 0);

cube.scale(0.5f);



inputManager.addMapping("store", new KeyTrigger(KeyInput.KEY_S));

inputManager.addListener(new ActionListener() {



@Override

public void onAction(String name, boolean isPressed, float tpf) {

if(name.equals("store")&&isPressed){

System.out.println("store the image !");

// ((LwjglRenderer)renderer).getContext().

}

}

}, new String[]{"store"});

}

[/java]

sigh no triple posting please :roll: You already opened a tread extra for that question.

sorry , I am so sorry … my net speed is too slow , so I click it double

to@ Momoko_Fan

can you tell me how to generate a image , If my image size is 1024×1024,and how to generate a 512×512 mipmap , I can find the image through the { ((LwjglRenderer) renderer).getContext().boundTextures[0] } , but it’s size is also 1024x1024 !

Read the manual