Jump to content

  • Log In with Google      Sign In   
  • Create Account


IkarusDowned

Member Since 08 Mar 2009
Offline Last Active Apr 25 2013 01:47 AM
-----

Topics I've Started

Beginner having trouble with transformations in a model hierarchy

01 February 2011 - 09:06 AM

Hi All,
I'm an "old" beginner...someone who played around with OGL and graphics a LONG time ago, and i'm trying to re-learn this stuff again..but running into some conceptual problems.

So i tried searching the Forums, but I couldn't figure out a viable search string to get the results I needed, so I do apologize if this is a re-post.

Anyway, At the moment i'm trying to create a scene with onlya few objects. i'll simplify it for the question as saying i have a "scene" with a big Box A, and inside it a small Box B that is rendered relative to Box A's coordinates.

However, the actual Box A and Box B models are the same; a single Box model that is 10 pixels cubed.
Lets ignore transparencies, assume its a wire-frame box.

So, Box A -> Box B

The way I am doing this in OGL atm is to use the relevant gl<Transformation>() functions.

So, for example using just some psuedocode

void drawNestedBox() {
glPushMatrix();
boxA.draw();
glTranslatef(1.0,0.0,0.0);
glRotatef(5.0,1.0,0.0,0.0);
glScalef(0.5,0.5,0.5);
boxB.draw();
glPopMatrix();
}

The conceptual issue I am having here is, what happens if I want to get, say a vertex / normal vector from boxB into the model-space? i understand I need to make a change of Basis matrix, but I can't seem to find any good REAL examples for this sort of thing; they all seem to "hand wave" the explaination without giving any real examples. Does anyone have any good resources, or maybe willing to explain this to me using the example above?

For more info about it, I want to make a scene-graph and I was planning on using something like a Quad Tree. But, I am having trouble wrapping my head around the following question: if I have a model with sub-meshes, and the mesh itself is glScale() down, how do I get the sub-mesh vertex information in model-space information so I can figure out if it is relvant?

Thanks in advance.






PARTNERS