PDA

View Full Version : rubberbanding in opengl



princeoflightning
02-24-2004, 01:11 AM
Hi, I'm stuck with yet another problem in Opengl.
Here we go-
I need to use rubberbanding in my graphics package that is more or less similar to the Paint Brush app in Windows.
Right now, i've implemented it somewhat like this:
1)Enter XOR mode.
2)Draw the line to display it.
3)And redraw the old line(to erase it) and redraw it(to draw the new line) whenever the mouse motion callback function is invoked.
The code works just fine, but for the flicker when I move the mouse rapidly.

It gets worse for the rectangle, worser for the circle( and ellipse) and worst for the bezier curve (for the bezier I cant just see the curve at certain times.)

The code is similar to F.S. hill Jr' code for rubberbanding.

Ya, I cant afford a SGI workstation until I get a solution for this prob!!

My comp has a TNT2 (AGP) as the graphics accelerator (decelerator!!).
HELP!!!!

AdrianD
02-24-2004, 01:05 PM
are you using doublebuffering ?

princeoflightning
02-25-2004, 04:12 AM
Nope i'm not doing so at present coz i'm stuck trying to implement it- fullscreen mode activation occurs only after I send an event to the mouse.
That should not happen- Fullscreen mode should be activated without any stimuli.

AdrianD
02-25-2004, 05:23 AM
Originally posted by princeoflightning:
Nope i'm not doing so at present coz i'm stuck trying to implement it....

But you have to use it, to avoid the flickering.
plaese go to the beginner forum, and ask for doublebuffering or just take a look at _any_ code for openGL... its one of the most basic functions.(take a look at the codeexamples at this site...)

jwatte
02-25-2004, 05:27 PM
I agree that "beginners" is probably better.

double-buffering != full-screen. SWAP_COPY is used when not full-screen (and is usually quite fast).