Scrollable canvas

Started by mrumpf, March 07, 2006, 15:21:21

Previous topic - Next topic

mrumpf

I am new to OpenGl and have a few problems:

I am writing an application with a large 2D-canvas and a non-standard scrollbar. I found out that I can scroll the canvas with the translated/f command. However, the graphical display is flickering while scrolling.

1. Is this the best way to implement something like a viewport for scrolling?

2. How can I stop the flickering?

3. How do the coordinates for the translation-command correspond with the pixel coordinates on my screen?

Thank you in advance,
Mike

TalanOFF

I'm pretty new to the whole OpenGL stuff but I fixed my flickering issues by using double buffering.

While the front one is beeing drawn the back buffer is beeing filled. After you've performed single drawing of a frame just flip the buffers by calling (whatever method your canvas provides for it) canvas.swapBuffers() (for the GLCanvas in SWT 3.2).

If you already use double buffering make sure not to flip buffers twice.

Oh, what graphics library do you use? Swing/AWT/SWT or other?

Signed: TalanOFF

mrumpf

@TalanOFF

I am using the SWT library 3.2