View Full Version : How to stretch a single line segment
10-04-2005, 09:02 AM
I want to be able to stretch a line segment in OpenGL while holding one of its end points fixed in space. Is there a quick way to do this?
10-04-2005, 11:12 AM
This is not really an OpenGL question.
You would use OpenGL to draw the line, that is trivial, but the stretching etc will require user input and interraction and that's a case of simple code and GUI input.
The line drawing only repeats over time with new endpoints.
10-05-2005, 08:05 AM
Thanks for the reply.
Redefining the line endpoints is what I was hoping to avoid by using OpenGL somehow. I'm trying to render normal vectors on a CAD model, and adjust the length through the GUI, but having to re-build the display list every time the user enters a new value is slowing down the program (I'm trying to use a slider bar, and the interactive adjustment is the problem).
I was hoping to find an OpenGL "trick" to make this process run faster.
10-10-2005, 02:32 PM
Well I'm no expert, but it seems to me you should be able to at least simulate changing one value while keeping the rest of the display steady.
One thought is to show a prerendered image(since it's already there anyway) and display the dynamicly rendered bit seperatly, on top of the background.
You might even want to pop up a new window, since you're doing all sorts of slieght of hand. That would keep it's logic seperate from the main program, and let you zoom in, too.
1 store the adjusting segment/vector's id in a variable
2 pop up a window with the model at vertices
3 take out the dynamic part, storing the anchor point at an xy location.
3 render whats left, once. Store rather than diplay.
4 display that texture as a background(texture on a plane shaped into a rectangle at a certain distance.
5 do your thing with a new object, all of one segment big. Make sure it's anchored to the xy location.
6 pass those values back out when done, updating the one vertex that changed.
That might make your segment disapear if you put it "behind" your texture, so maybe you can put the texture at x2 distance, x2 size. (hmm, that might not matter in CAD, that's all vecter graphics, right?)
Another thought is to somehow keep large parts of the render process from updating while you do your thing, but that's way beyond me.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.