need a finger pointed in the right direction

Hi, everyone, how are you?.

I’d like to ask for a bit of orientation for a project I’ll be working on, don’t worry, I’m not asking for the 15-minute guide to build my own Quake 5, I’ll try to describe the problem as well as I can, bearing in mind that, although I have Java experience, none of it is graphics related.

I need to dynamically visualize some charts, oscilloscope and/or histogram type, but I need to update the graphics as fast and smoothly as possible, and not only visualize them, they should be mouse-click aware. Being able to run it in Windows as well as Linux and OS X is a plus.

So far I’ve been googleing and I’m not sure if going for Java 2D is going to be fast enough, although it seems that it is hardware accelerated nowadays.

So, the thing is that I don’t know whether Java 2D is enough, or going for Java 3D/JOGL, or even a game engine, like jMe or LWJGL, is going to be totally overkill.

Besides, I’d like to use this stuff inside an eclipse RCP app, J3DWorkbench-like, (in case this is a limitation for some of the options).

To sum it up, I’m eager to enter this thick jungle of Java graphics, I’d just like to know I’m headed in the right direction.

Thanks a lot in advance, and please excuse my english,
Regards
Antonio

Hi

I’ve not used Java2D for a while, so I can’t really say how it’s improved. Lots of people do use things like LWJGL for 2D. It might be worth looking at Slick.

You’re english is better than some of the native english speakers round here :slight_smile:

Endolf

I have made a oscilloscope type component (It is a while now). You can easily create component like that. If you overight an component that allready deal with mouse event, you will have only to deal with the rendering (extends JLabel for example).
In the paint method, it should like that :


  public void paint(Graphics g)
  {
     if(newData) 
    {
        // update an Image with your oscilloscope data

        newDate = false;
    }

    g.draw(image,0,0,null);
  }

and when you change data :


  public void addPoint(int x,int y)
  {
     // Add you point to an arrayList/Array/...

     newData = true;
     repaint(500); // repaint with a "delay" of 500ms to not redraw everything now if there is others data to add
  }

Well, will it be fast enough ? It all depend of the complexity of your graphics, the speed that you add data,…
If I remember well, I was displaying something like 3 oscilloscopes at the same time over 3s with new data every 10 ms (not sure). And it was working on no so fast computer but the refresh rate was not too fast.

Give it a try on an swing component and if it is not fast enought, it will not be too dificult to convert it to stick.

hey Tony,

I believe you don’t really need to go into slick or something like that to have a nice and fast oscilloscope.
If you use the right stuff in pure java, like bufferedStrategy, you can have a very fast solution . You can easily check this out in my game (look at the signature) or all the other pure java2d game in the “games showcase” section in this forum .

Besides, you might just waste your time learning a whole new library if it happens that the bottleneck resides in the calculation of the waves of your oscilloscope, not in the rendering itself.

So in my opinion you should give Java2d a shot before going into external libraries (which will also give you a little more trouble in deploying your project)

good luck

Wow, thanks guys for the quick answers!

I think I’ll start with Java 2D then, and see how it performs, because if it turns out not to be the best option, having a little 2D knowledge might be useful anyway.

Thanks again,
Regards
Antonio