niobe
04-20-2012, 02:02 PM
Hi Forum
As you can see from the subject header, it relates to bounding boxes.
I would like to write a function that would allow me to pass a mesh object to a function that returns the max and min of x,y and z coords of that object.
The algorithm is pretty straight forward. But, what I am struggling with is to get the vertex data of an arbitrary mesh object in the first place, in order to read the data and find the min&max of xyz.
A concrete example:
Say I have a function glutSolidSphere() /*this might be any other function that draws an object*/
, and I would like to transform this object and then find its vertex data. So...
glPushMatrix();
find_maxmin_xyz_of_object(temp_x,temp_y,temp_z);//or something of this sort.
glTranslatef(0.5, 2.5, 0.0);
glScalef(1.0, 1.0, LETTER_DEPTH);
glutSolidSphere(1,5,5);
glPopMatrix();
As you can see, with calling an arbitrary function that generates an object, it is required to find the vertex data of this object.
I had a look at pre-compiled objects, such as display lists, but I was still faced with the challenge of getting the vertex data of that display list object.
PS
I think this could be especially useful in scene-graphs.
Thank you for your time.
As you can see from the subject header, it relates to bounding boxes.
I would like to write a function that would allow me to pass a mesh object to a function that returns the max and min of x,y and z coords of that object.
The algorithm is pretty straight forward. But, what I am struggling with is to get the vertex data of an arbitrary mesh object in the first place, in order to read the data and find the min&max of xyz.
A concrete example:
Say I have a function glutSolidSphere() /*this might be any other function that draws an object*/
, and I would like to transform this object and then find its vertex data. So...
glPushMatrix();
find_maxmin_xyz_of_object(temp_x,temp_y,temp_z);//or something of this sort.
glTranslatef(0.5, 2.5, 0.0);
glScalef(1.0, 1.0, LETTER_DEPTH);
glutSolidSphere(1,5,5);
glPopMatrix();
As you can see, with calling an arbitrary function that generates an object, it is required to find the vertex data of this object.
I had a look at pre-compiled objects, such as display lists, but I was still faced with the challenge of getting the vertex data of that display list object.
PS
I think this could be especially useful in scene-graphs.
Thank you for your time.