#### Archived

This topic is now archived and is closed to further replies.

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

## Recommended Posts

In the tutorial you have to calculate the light''s position relative to the local coordinate system of the object. ************************************************************ glLoadIdentity(); // Reset Matrix glRotatef(-yrot, 0.0f, 1.0f, 0.0f); // Rotate By -yrot On Y Axis glRotatef(-xrot, 1.0f, 0.0f, 0.0f); // Rotate By -xrot On X Axis glTranslatef(-ObjPos[0], -ObjPos[1], -ObjPos[2]); // Move Negative On All Axis Based On ObjPos[] Values (X, Y, Z) glGetFloatv(GL_MODELVIEW_MATRIX,Minv); // Retrieve ModelView Matrix (Stores In Minv) lp[0] = LightPos[0]; // Store Light Position X In lp[0] lp[1] = LightPos[1]; // Store Light Position Y In lp[1] lp[2] = LightPos[2]; // Store Light Position Z In lp[2] lp[3] = LightPos[3]; // Store Light Direction In lp[3] VMatMult(Minv, lp); ************************************************************ Why? I don''t understand the point? Can someone please enlight me?? thanks,

##### Share on other sites
transforming light position in model space makes generating shadow volumes easy.

You should never let your fears become the boundaries of your dreams.

##### Share on other sites

Then can someone give me an example on the differens, and what''s so hard??

##### Share on other sites
in that demo (which is pretty simple), it''s a rotating model casting a shadow, the reason why this code is here is so you rotate the light''s position, not the model verticies (ie, do the opposite rotation on the light). that means you rotate 1 point (the light), where if you rotate the model, you rotate potentially 1000''s of points (and then have to rotate the generated shadow coords back again). hence it''s MUCH faster just to rotate the light about the model.

1. 1
Rutin
65
2. 2
3. 3
4. 4
5. 5

• 17
• 10
• 29
• 20
• 9
• ### Forum Statistics

• Total Topics
633415
• Total Posts
3011768
• ### Who's Online (See full list)

There are no registered users currently online

×