PDA

View Full Version : Finding positions!!!!


alert
2005.04.20, 12:16 PM
Felows!!!

Anyone nows a way to retrieve the position of a certain polygons points in scene (like a depht; the more point left, or right; etc...)...
Or the construct of a routine is the only way?...

Thanks... :ninja:

ThemsAllTook
2005.04.20, 04:52 PM
You can use feedback mode (red book, chapter 13, I believe), or get the projection and modelview matrices and do the math yourself.

What are you trying to accomplish?

- Alex Diener

alert
2005.04.21, 11:43 AM
Load a 3d scene (object obj or 3ds) and put automatically avatars (people walking) in some points of this scene, like: the most left and right point, the most deep, etc...

Alert

Fenris
2005.04.21, 12:19 PM
Ah, this is easy. You just have to look at every vertex and look for the highest and lowest coordinates in all directions - for instance, min x, min y, max x, max y. There is no way to determine this using OpenGL alone, you have to look at every vertex "by hand". Once you have that info, it should be a piece of cake to construct "most left", "deepest", "center", "center back" and so on.

alert
2005.04.21, 12:45 PM
How look to vertex´s "by hand"? I read some 3d Objects (3ds, obj, ect; like houses) without knowing them... How can i access to those imported vertex´s?

LongJumper
2005.04.21, 01:18 PM
Just add to the object class two vectors, min and max. Each time you read in a new vertex, check the x, y and z of that vertex with your min and max vertexes. If it's >max or <min, put that value into min or max. But don't copy the entire vertex.

Fenris
2005.04.21, 01:44 PM
alert, how are you reading the files? What library, or are you doing it by yourself? I need more info to guide you here. :)

alert
2005.04.22, 07:00 AM
I use for example GLM the Nate Robin´s to loader obj models.... Can i access to coordinates of GLM imported vertex´s, and test the max, min or deepest vertex like said LongJumper?

LongJumper
2005.04.24, 09:26 PM
.obj files are just a list of vertices. So when you read them in, test each vertex for against the min's and maxes you have. Oh and make sure to set the first vertex you read in to the min and max values, since if you set them to some arbitrary number you'll have lots of problems if the model is all on one side of an axis or something similar.

alert
2005.04.26, 10:25 AM
ok... Thanks all for the help....

Alert