I want to use jmonkey api to create a texture viewer

Hi, i need to create a texture viewer that reads dds textures from files and displays them into a jpanel or something similiar. I would like to know which jmoneky functions are the best for what i want to do.

This should give you some insight: DDSPreview.java

As my program is not a jmonkey project to make that code works i suppose i have to import some librarys so i have imported all the .jar files in the lib folder of the jm3 buikd files and putting the code the DDSPreview.java you told me many of the imports are ok but there are still a few of them that can be resolved,this ones are:
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.scene.PreviewRequest;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.SceneListener;
import com.jme3.gde.core.scene.SceneRequest;

What i have to import to solve this?

This falls under SDK development, so following this tutorial will get you the libraries you need. You would add the library “SDK Core”.

This is quite an extensive procedure just for a DDS previewer. I suspect there are far easier ways, though I have no experience with the dds format, so can offer no viable alternatives.

Well the normal engine can load dds, no need for the sdk then?

load via ssetManager

then you can use part of this to get a bufferdimage out of it

[java]
@Override
public void writeImageFile(OutputStream outStream, String format, ByteBuffer imageData, int width, int height) throws IOException {
BufferedImage awtImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Screenshots.convertScreenShot(imageData, awtImage);
ImageIO.write(awtImage, format, outStream);
}
[/java]
-> See the screenshot app state, and just change it os it does not save, but gives you the bufferd image.
-> Start jme itself headless so only the swing gui is visible.

Well and thats it mostly.

Btw if this is not for learning, but for something else,
GIMP has a very good dds plugin http://registry.gimp.org/node/70
And for thumbnails in windows http://www.nvidia.de/object/dds_thumbnail_viewer.html

I have quite different experience with dds plugin for GIMP. I was not able to convince it to generate proper mipmaps and I recall having some issues with cubemaps as well. Barely usable for me.
It might be related to 64-bit version of it - maybe 32-bit version is ok.

Well I use it under linux, might be that this makes all the difference :slight_smile:

@Empire Phoenix said: Well the normal engine can load dds, no need for the sdk then?

load via ssetManager

then you can use part of this to get a bufferdimage out of it

[java]
@Override
public void writeImageFile(OutputStream outStream, String format, ByteBuffer imageData, int width, int height) throws IOException {
BufferedImage awtImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Screenshots.convertScreenShot(imageData, awtImage);
ImageIO.write(awtImage, format, outStream);
}
[/java]
-> See the screenshot app state, and just change it os it does not save, but gives you the bufferd image.
-> Start jme itself headless so only the swing gui is visible.

Well and thats it mostly.

Btw if this is not for learning, but for something else,
GIMP has a very good dds plugin http://registry.gimp.org/node/70
And for thumbnails in windows DDS Thumbnail Viewer|NVIDIA

As my texture viewer will be also an importer of textures into a game´s file and this games uses some diferent dds types i would like to know if with that code is it possible to give the possibility to user to import a texture in some format like .png and then convert it to dds with that code to extract the dds raw data and write it ito the file.