Jump to content

  • Log In with Google      Sign In   
  • Create Account


Vertex/Model Selection in my Modeler Program.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 iwoplaza   Members   -  Reputation: 171

Like
0Likes
Like

Posted 26 August 2012 - 01:21 PM

I have a problem. I wrote a modeler to create models with my format, but I want to be able to select individual vertices with my mouse or select which model I want to edit. Screen of the program:

Posted Image

So can you give me some tutorials or tips.

I'm using:
OpenGL - drawing.
DevIL - images.
fStream - FileLoader.

I'm from Poland so if you could use some clear language.

Thanks in advance.

Edited by iwoplaza, 26 August 2012 - 01:22 PM.


Sponsor:

#2 Jivi   Members   -  Reputation: 276

Like
2Likes
Like

Posted 26 August 2012 - 01:34 PM

you have to first get the screen coordinates of your mouse, you convert it from camera space to model space and cast a ray from that point in the direction of the camera normal and then, the closest face you hit, you check which model it belongs to and then, you add the model to the select list or however you handle selection.
For vertices, from the closest face you hit if any, you check each of its vertices and then, add a padding or radius to each vertex which probably should get smaller based on distance from the camera and then, check if the ray collides with the sphere surrounding any vertex given the radius or padding. Then if any collision to any vertex occurs, choose the closest. I think this should do it.

#3 iwoplaza   Members   -  Reputation: 171

Like
0Likes
Like

Posted 26 August 2012 - 01:39 PM

Thanks man. I was thinking of it before but i was wondering if there is better way to do it.
But thanks :). If anyone knows another way of doing it please tell me.

#4 Jivi   Members   -  Reputation: 276

Like
0Likes
Like

Posted 26 August 2012 - 02:12 PM

I dont know if its related to what you want but you might just want to check this out
http://www.gamedev.net/topic/630006-picking/

#5 powly k   Members   -  Reputation: 649

Like
0Likes
Like

Posted 26 August 2012 - 04:48 PM

The easiest way to do this is use an offline buffer (or alpha if you don't do blending) to render an ID number and then do glReadPixels() with mouse coordinates and read back your ID. That way you can pick anything that you draw, no complex math involved, nothing can go wrong and it doesn't slow you down a lot. Readback from GPU isn't that fast, but going through massive amounts of geometry (if you plan on having such) a second time and on the CPU is way slower than reading a value you've already calculated.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS