View Full Version : help with selection ad picking??
I am working on a drawing application(CSharp and Opengl)that uses mouse based picking..
for predefined drawing it is easy because you can reuse the function in GL_SELECT mode but
How will selection/picking work when I draw with the help my mouse e.g. clicking at two places to draw a line and then switching to selection mode, since the drawing has to be done in selection mode as well ...does the program has to remember all the points??
06-18-2007, 11:50 PM
You have to remember it not only for picking but also for window updates.
Use Model View Controller design pattern.
Model is your list of points.
View is your OpenGL code
Controller is your mouse listener that adds/modifies points.
could you please explain how to store these points effeciently?
and another question, if I create a figure triangle or a quad using a single drawing command can it's indivisual edges be selected/picked?
06-19-2007, 02:51 AM
Q1: don't know, vectors? try it and then profile your app, next time you choose the right method for the first time ;-)
Q2: yes, you can select the edges individually, but you have to "draw" them in selection mode separately.
First draw the triangles/quads, then draw only the outline edges. use different names or name stack to differentiate the triangle and edges).
See example in OpenGL programming guide, (picking car components).
Then in the selection result you will get both names when user selects edge (thats because the edge is too close to the triangle itself). You can then search for the edge name in the result list and then for triangle to get the edges first.
how will selection/picking work for an imported drawing...e.g. i want to select/pick drawing in my application that was created in another software such as AutoCad or Paint
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.