View Full Version : Rubberbanding Tutorial
02-27-2003, 03:18 PM
Does anybody know of a tutorial that will teach me rubberbanding?
02-27-2003, 03:48 PM
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);
for j:=0 to (length(Curve) - 1) do
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, @Curve[j]); // let gl work out the eqn's
for i:=0 to 100 do // step of curve drawn, how many lines is it made of....
03-01-2003, 03:21 PM
Here is a little hint.
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,
[This message has been edited by heath (edited 03-01-2003).]
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.