What are the best libraries/frameworks for doing 3D and/or Zoom interfaces in Java?
I'd like to be able to do some prototyping of creating new types of interfaces for navigating within data and representing object graphs/relationships.
Low and no cost options are better. Open Source is also a plus.
UPDATE:
The higher level the api the better. Ideally I could set some properties (color, shape, etc) on my virtual object, register it with the visualization environment/engine, hook in callback functions...for example when a user hovers, clicks or double clicks on an object my code would get kicked off, and the visualization environment would handle the rest. So the rendering of the objects, navigation, zoom, user interaction would all be handled by the engine. Tall order probably, but this seems like it could exist as a reusable/generic tool.
Java3D is a pretty good 3d visualization in library. OpenGL is a standard 3d graphics library and JOGL is a port to Java.
Haven't done more than play with it, but you may want to look into processing. You could build some virtual objects, then pan around it with the mouse.
You might try JMonkeyEngine. It's higher level than Java3D and JOGL.
Related
I have a data flow diagram (a diagram that looks like a flow chart). It has a set of specific geometrical components like rectangles, circles, ellipses and arrows.
What I'm trying to achieve is to detect these shapes and be able to know which component is connected to which component (through the lines) and finally read the text inside each one to extract data from the diagram and do further processing. It is also notable to mention that the diagram will not be drawn by hand but computer generated so we don't have to worry about angles and ratios being inaccurate.
I'm currently working in Java and I was wondering if this is going to be possible since Java is not the best language when it comes to image processing (correct me if I'm wrong). And if it's possible I'd you guys to point out where I should start looking.
I think Java is fine, and it has many libraries to process images. ImageJ is just one example. Personally, I like to use Python, so I write scripts in this language using Java API of the DMelt platform. Look at the documentation of this projecst, wiki. Here is a link to a few examples.
Doing this in Java wasn't a great idea because mainly the lack of online resources. After a good amount of research, I found that the best and the easiest approach was the use of C# and Emgu CV which is a cross platform .Net wrapper to the OpenCV image processing library.
This example helped me to get started with detecting basic geometrical shapes like Lines, Rectangles and Triangles.
Currently, I am working on a OpenGL project and here is the screenshoot what I did
The question is, I want to add texts(degrees) to compass and want to do that with pure OpenGl methods. I found TextRenderer class however, couldn't manage to download it and use it. How to use TextRenderer class in my Java project? If there is any other way of adding text besides TextRenderer, would love to hear it.
My second and most important question is about merging swing/awt methods with OpenGL and using multiple objects. I wrote the program with only using one GL2 object and worked perfectly, is it sensible to use multiple openGL objects on the same frame? Furthermore, using swing methods and openGL methods together is a good idea?
I want to add texts(degrees) to compass and want to do that with pure OpenGl methods.
Unless you can live with not very pleasantly looking center stroke fonts, you have no choice but to use help from some other library or API.
Theoretically OpenGL can collaborate with OpenVG, but so far overall support for OpenVG is very poor, and OpenGL interoperability even worse. But say you had a proper working OpenVG – OpenGL interoperability working, then OpenVG was the way to go.
Practically you have to something different. A very fruitful approach is to use a font renderer library (like FreeType) together with some layout engine (like Pango) to produce an outline stroke list of the text to be rendered, which in turn can be either rendered directly using some extension by NVidia (http://www.opengl.org/registry/specs/NV/path_rendering.txt available only on the most recent NVidia GPUs) or manually tesselated into triangles, either on the CPU or by a combination of GPU Geometry and Tesselation Shaders. A huge drawback of drawing glyphs as tesselated filled outlines with OpenGL primitives is, that they will look very dirty (due to aliasing) if the used framebuffer doesn't have a multisample format (full screen antialiasing)
The next best thing is rendering the text to an image and copying that to the GPU and overlay that over the scene by rendering a textured quad. You should apply all text transformations already when rendering the quad, so that the font hinting system can make the proper adjustments on the transformed glyphs before rasterizing them.
Another approach is using texture mapped fonts. I implemented two TMF engines myself so far, but personally I advise against using this approach these days, as TMFs are resource hogs. A 200kiB TTF font can blow up to several megabytes of texture data. Maybe one day I or somebody else implements a TrueType or OpenType rendering engine with OpenCL, CUDA or Compute Shader, but until then rendering text with OpenGL is dirty business.
It boils down to
Crisp Look
Memory Efficient
Computationally Efficient
→ choose 2
After doing little research, I ve figured out how to install it and use it correctly.
Firstly, go to that web site and download suitable version of jogl for your os in case you dont have any library:
http://jogamp.org/deployment/autobuilds/master/jogl-b1011-2013-06-19_05-41-38/
Then, download that jar file and add it to your user library.
http://www.java2s.com/Code/Jar/j/Downloadjogl20jar.htm
That file contains the TextRenderer class.
If you dont know how to make one, use that link:
http://riccardotramma.com/2011/04/setup-eclipse-to-develop-opengl-glut-apps-in-java-cc-on-windows-mac/
Then, follow the instructions: http://download.java.net/media/jogl/jogl-2.x-docs/com/sun/opengl/util/awt/TextRenderer.html
It's very easy to use, I perfectly added numbers to my compass. However, not efficient as far as I can tell.
I am seeking an API or program which I can use to create Shapes graphically in Java (specifically closed shapes). A tool simalar to paint in windows, but without the colors and such. After the shapes are created, I will be using them as part of a simulation program, so I need to get access to the actual java Shape objects.
I could create my own tool using Java2D, but I am sure I would be wasting my time as there must be some useful tools out there. However, after a long time scowering google, I had no luck. Any tips would be much appreciated.
Here's an article describing how to do it accompanied with source code that you might be able to use.
I'm looking for a high-level java graphic library for creating artistic text, watermarks, resize, crop, image identification and manipulation.
ImageMagic is a good example of such library, but its java ports are somewhat problematic (they either run imagemagic through JNI or via commandline and are hellish to deploy to servers).
Ideally I'd like to have similar functionality to ImageMagic, but pure Java and open-source, free to use.
Has anyone seen something like that?
This is for a server-side component. A service that manipulates images of various web formats (png, jpg, gif etc).
Java has its own libraries, of course (Graphics2D) but I'm looking for something of higher level.
Here are several use cases:
Resize and crop images. If it has "smart resize" or "smart crop" that'll be cool, for example seam carving resize, or cropping by points of interest in the photo
Drawing artistic text on images. Using fonts, colors, text effects (3d text, charcoal and other effects)
Embedding watermarks.
Layering images, using images as background, masking with images etc.
Image identification such as - number of colors, stdev etc.
As mentioned, Java in its Graphics2D supports all of the above but is too low level so I'm looking for something that's nicer to work with.
Thanks!
Java Advanced Imaging ( JAI ) sounds like what you want. From the website:
The Java Advanced Imaging API provides
a set of object-oriented interfaces
that support a simple, high-level
programming model which lets you
manipulate images easily.
I found it relatively simple to work with. And the performance was better than spinning off ImageMagic processes.
Use ImageJ. In addition to being a neat program, it can be used as a library.
The Apache SVG Batik library can
be used to display some vectorial
drawing in SVG.
The eclipse project
contains a library called Graphical
Editing Framework (GEF) shipped with
a painting and layout plug-in called
Draw2D. see
http://whf.poac.ac.cn/codeopen/jiaocheng/java2s/Code/Java/SWT-JFace-Eclipse/2D.htm.
Raw Java2D makes it quite easy to do resizing and cropping (just make sure that you reduce in powers of 2, the backend doesn't handle this automatically). I only found JAI useful for my usage to do color quantization... the rest of the pipeline seemed unnecessary for basic functions.
I am looking for a toolkit that will allow me to design widgets containing 2D graphics for an elevator simulation in Java. Once created, those widgets will be integrated with SWT, Swing, or QtJambi framework.
Background information:
I am developing an Elevator Simulator for fun. My main goal is to increase my knowledge of Java, Eclipse IDE, and more importantly concurrency. It is certainly fun and I enjoyed implementing this State Machine Pattern.
Anyway, I am at a point where I would like to see the Elevator on the screen and not limit myself to log its operations on the console.
I will probably choose SWT, Swing, or QtJambi for the UI controls but I am wondering what to do with the graphical part of the simulation.
You can use an SWT canvas (or Swing canvas, or OpenGL canvas via JOGL, ...), and set it up as an Observer of your simulation, and whenever the simulation state changes, you can redraw the new state.
You could get some abstract graphics out of a Graph visualisation tool such as JGraph. You could use this to visualise which state your elevator is in. However, i'm not sure how flexible these sort of graph visualisation tools are and whether you can add your own graphics and animations.
Are you sure you actually want to be using widgets. Would using Graphics2D+friends and your own abstractions not be a better fit?