Random jerks while smoothly panning tiled image...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Random jerks while smoothly panning tiled image...

Amey
Hello,
I am using JOGL with SWT GLCanvas (com.jogamp.opengl.swt.GLCanvas) to show a large medical image. The image is BigTiff with Tiled image pyramids (each resolution in the pyramid is tiled (512x512)). I have to implement smooth zoom/pan operations on the image.
I have created shared GL context to load the image tiles and create their texture in the background thread. And another thread running through FPSAnimator calls the display at 60 FPS. In the display thread, I only draw the textures which are currently in the viewport.
Below is my display implementation.

           @Override
            public synchronized void display( GLAutoDrawable drawable )
            {
                if( camera != null && scene != null )
                {
                    //draw the scene now
                    GL2 gl2 = drawable.getGL().getGL2();
                    drawable.swapBuffers();

                    gl2.glClear( GL.GL_COLOR_BUFFER_BIT );

                    gl2.glMatrixMode( GLMatrixFunc.GL_MODELVIEW );
                    gl2.glLoadIdentity();

                    try
                    {
                        //below method simply draws the textures
                        virtualSpace.draw( gl2, cloneCamera, clientArea, 0, 0 );
                    }
                    catch( Exception e )
                    {
//
                    }

                    gl2.glEnd();
                    gl2.glFinish(); //force to finish the commands on the GPU

                    if( tweenManager != null )
                    {
                        try
                        {
                            tweenManager.update( 0.017f ); //this updates the pan/zoom animation
                        }
                        catch( Exception e )
                        {
//
                        }
                    }
                }
            }

With this, my animation works smooth, but randomly it has jerks. Looks like the animation jumps few pixels which it should not. I see that some draw calls are taking longer time (60-80ms).
Could someone help me with resolving this problem?
Let me know if you need more information about my program.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Random jerks while smoothly panning tiled image...

gouessej
Administrator
Hi

Please provide a complete example. It's difficult to guess what could cause your problem.
Julien Gouesse | Personal blog | Website