Sign in to follow this  
Cirus

GL_LINE_LOOP Query

Recommended Posts

Hello All , I need to construct two loops that are disjoint ,using mouse clicks, at different positions in 3D space. Mechanism for loop making:- That is I draw points on window using left click and when I decide to draw a loop , I right click. There is no problem in displaying the first loop , but when I repeat the process of making a second loop, the first loop gets broken because vertices intended for second loop are joining the vertices of first loop. Any suggestions for tackling the problem.Thanks.

Share this post


Link to post
Share on other sites
Hello Cirus

You would need to create two linked list.

One linked list would contain the points of the first loop and the other linked list would contain the points of the second loop.

What remains would become pretty easy..

Best Regards,
Ali B

Share this post


Link to post
Share on other sites
Thank you Ali for your response.I was thinking on similar lines. , but I want to generalise it.To be precise , what if I need to create 100 loops at different locations ?

Thanks once again.

Share this post


Link to post
Share on other sites
If you're using C++, a class which holds the data for a single line loop would be sufficient. You could then simply create multiple classes for each loop you require.

A bit off topic, but (from professional experience) you might want to have the right mouse button remove the last point added, and use a left double-click to close the loop. Not everyone is perfect when they click the mouse, and if you've just created a +100 vertex line loop and made a mistake, you don't want to have to go and do the whole thing over again. :)

Share this post


Link to post
Share on other sites
I agree with your view bpoint.I am signalling the formation of loop by right clicking.Through left click I am drawing points, that indicate the vertices in a single loop.

Problem is, I can't form two seperate loops.

I am able to draw points and also able to implement the right click loop formation mechanism. The thing is OPENGL is conecting the last point of my first loop to first point of second loop and theus giving a distortion.

To illustrate, here is my mechanism :

-- With each mouse click , draw a point.
-- When Right clicked, the number of left clicks before right click will form a loop.

-- Continue with above steps till you are done.

The logic is simple but the problem is not resolved.

I was planning to replace GL_LINE_LOOP by GL_LINE_STRIP and GL_LINE as combo.
Let me see will it work .

Do you have some other suggestion(s) in this regard.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this