Rubberbanding Tutorial

Hi.

Does anybody know of a tutorial that will teach me rubberbanding?

Thanks

Define rubber banding! do you mena plot points with the mouse and then draw a nice curve around them??
This is delphi but you get the idea…
(sorry for the lack of code tags)
a ‘curve’ has 4 points 2 control points and 2 x/y/ points, you can work out the control points (if you have ever used corel draw etc you know what they are). so you make up the whole ‘band’ from lots of 2 x/y point curves. I worked out control points by taking a vector between end_curve_1 and start_curve_2 and then taking a point 15 along vecotr and 15 normal to vector. I am very sure this is clumsy. Best to try this with a couple of points and play about with the numbers to get an idea. You can have the code for calc’ing contrl points if you like

procedure TStereo_window.DrawBezierLoop(Curve:array of a_curve);
var
i, j:integer;
begin
for j:=0 to (length(Curve) - 1) do
begin
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, @Curve[j]); // let gl work out the eqn’s
glEnable(GL_MAP1_VERTEX_3);
glLineWidth(1);

glBegin(GL_LINE_STRIP);

for i:=0 to 100 do   // step of curve drawn, how many lines is it made of....
  glEvalCoord1f( i/100);

glEnd();

end;
end;

Here is a little hint.
http://www.opengl.org/developers/faqs/technical/rasterization.htm#rast0110

And a third approach, one which I like, is use to use PBuffers. Render your primary content to a PBuffer. This will be your pristine copy. Then copy PBuffer to Back Buffer, draw your transient graphics (rubber banding stuff) on the Backbuffer, swap buffers for each overlay redraw.

The nice thing about this, is that your overlay graphics can be full color.

Hope this helps,
Heath.

[This message has been edited by heath (edited 03-01-2003).]