# how to pick a point in the screen?

This topic is 4255 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

how to pick a point in the screen? I know basic skill on picking a object, but I want to pick points which form the object.For example, I uses 4 points to draw a square, I want to pick a point from the 4 points , not the square, how can I do that? How to name?

##### Share on other sites
Assuming you know how matrix's are applied, you can call glGetDoublefv( matrix, *data), where matrix (GL_MODELVIEW etc), data (float [16]).

Since you have the 4 points somewhere in RAM, you have to transform them on the CPU. ie. apply modelview, perspective, perspective divide, ndc to screen. Then just test the 2d mouse with the x,y points.

##### Share on other sites
Thanks for your reply. Maybe your method is good enough, but it is too complicated for me. I hope there is a way that easy to use, and similar with picking a object, using some OpenGL function.

How does 3DMax do this?

##### Share on other sites
Well do you understand the modelview and projection matrices? The only other way to pick stuff in 3d is to draw a ray for the camera, but I really doubt that would ever be used for picking vertices. Especially since you need pixel perfect.

Basically you send opengl some matrices and vertices. It does the work for you (mathematically). Well you yourself have to apply those matrices to each vertex and store them in RAM. Then you can check mouse(x,y) with vertex(x,y).

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633696
• Total Posts
3013401
×