PDA

View Full Version : How to read models from different files and arrange them in a scene?



xiaoyin
05-17-2006, 08:52 PM
I want to read some models from diefferent files and want to arrange them in a scene.Is there any convenient way to do?
If I want to adjust models' size and position relatively,what should I do?
Thank you!

mikael_aronsson
05-18-2006, 01:25 AM
Get yourself a tutorial on transformations in OpenGL (google or this website for example).

You do something like this in your rendering code:


// For each model you want to render
glPushMatrix();
glTranslate( ...);
glScale( ...);
// render one model here
glPopMatrix();
And repeat for each model, you can of course also put in a glRotate( ...) when you need to rotate your model, make sure you put the rotate/translate/scale calls in the correct order depending on the effect you want.

xiaoyin
05-19-2006, 12:44 AM
mikael_aronsson,thanks for your help.But I have another question,is it possible to change the model itself which i want to read,other than change the view-model matrix or projection matrix. For example, how to use program to change the model from 3ds file?

Mridul
06-09-2006, 01:16 AM
U can do this,
first u need to make a common data structure which can represent the scene, (can think of scene graphs); then try building the translators.. which can convert all u'r files into this data structures.

xiaoyin
06-09-2006, 03:18 AM
I don't understand your meaning exactly.Would you please say it in more details?
Thank you!