2D application scroll problem

Hi,

maybe someone can help me with a problem I currently have:

I programmed a 2D application which uses the "G" Library of Geosoft (http://geosoft.no/graphics/index.html). This library is built on top of the Java 2D API.

My application draws about 1000 independent graphical objects. These objects are pretty simple (coloured rectangles, circles or simple polygons). I can zoom in this scene and when I then scroll, this scrolling is not really smooth. The scroll bar is not a quarter as fast as I am with the mouse pointer and is jerking! (And there is no animation stuff or something similar running in the background!)

So I was wondering about the reason for this. The number of graphical objects is not the reason, I think. It seems so that Java renders every time all 1000 objects although only a small part of them are visible while I am scrolling.

Do I have to tell Java what is currently visible? I thought Java clips automatically parts outside the viewport?! Or could anything else be the problem? How can I fix it?

Thanks!!

Robert

P.S. Sorry for my bad english ;-)

[1132 byte] By [RBr2000a] at [2007-11-26 13:46:40]
# 1
i have a feeling that you are smart enough to use a backbuffer (doublebuffering).... am i right?If you draw all these "trivial" objects onto a single BufferedImage or Image and draw that image to the screen ONCE, then your jumping should be eliminated.ya welcome.
ArikArikArika at 2007-7-8 1:22:00 > top of Java-index,Security,Cryptography...
# 2

Hi,

the library is using double buffering on its own ("The graphics is double buffered to keep rendering smooth" see the website). So that is probably not the problem? If it would use no double buffering the problem would look like a flickering screen, doesn't it? Not like a jumping scrollbar?!

If I would draw a BufferedImage once wouldn't I loose the object detection functions of the library and other stuff? Because I would like to implement interaction functions for the user.

What about my idea with the clipping? Is it normal that java draws EVERYTHING while only a small part is visible or becomes visible when I'm scrolling?

Robert

RBr2000a at 2007-7-8 1:22:00 > top of Java-index,Security,Cryptography...
# 3

yes yes... double buffering prevents flickering... but if you draw all these objects to a BufferedImage that is displayed to the screen ONCE, then i think this might solve the problem.

When you redraw all the images separately, they are not synchronized to display at the same time. PLEASE at least try drawing all images to an Image then displaying that image. I have a feeling that that will work.

ArikArikArika at 2007-7-8 1:22:00 > top of Java-index,Security,Cryptography...
# 4

Ok! I can try this. But how can I draw this objects to an image? Because the library manages all the drawing stuff. I never use an Graphics object for drawing.

I simply define the geometry of the objects and add them to the scenegraph which is added to the contentpane of a JFrame.

Do I have to change manually things within in the library?

Thanks!

RBr2000a at 2007-7-8 1:22:00 > top of Java-index,Security,Cryptography...