export from MilkShape

Started by
3 comments, last by Alina_85 15 years, 1 month ago
Hello everyone! I use C# and CSGL for drawing a complex scene in OpenGL(a house with many rooms, and furniture, streets, trees). I want to add shadows to my scene, so I found a tutorial inspired by nehe 27 lesson...and it's work fine. For testing, I drawn a cylinder and a sphere in MilkShape and I exported them in text format, so I have all vertices coordinates and all the polygons(they are necessary for shadows drawing). There are about 300 polygons. But now, my scene moves very,very slow...And I drawn only 2 objects. What can I do, because I need to draw more complex objects. There is any solution for my problem ? Thanks.
Alina
Advertisement
I guess you are talking about this http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=27

the page doesn't say what type of shadows they are doing but it looks like stencil shadow volume because they are making a call to glStencilFunc and from the screenshots.
Also, don't strictly follow NeHe. Try to not use GL to do your matrix math and then call glGetFloatv. Use your own lib instead.

Try to not use immediate mode (glBegin/glEnd). Use VBOs instead.http://www.opengl.org/wiki/General_OpenGL

Instead of stencil shadow volume, which requires a lot of CPU work, try shadow buffers instead.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
I use openTK and VBO for drawing my objects exported from milkShape, without any shadow. And...for 5 objects my scene moves slow too. Reading and processing the txt file could be a problem ? For one or two objects everytingh is ok. Any idea is apperciated.
Alina
Maybe you are trying to load the model on each frame?
You should load your model only once during the app startup, just after you create the OGL device. Load the model into a VB. Then, during your rendering step, use that VB to render your object.

Guimo
Thanks Guimo ! Now it's just fine. But I have one more question for you. MilkShape export distinct sets of points for every object, I mean not an assembly of points for entire scene. In that case, I have to load each object in distinct vbo ? Can I use an array of vbo ? How many vbo I can use ?
And other problem : on NVidia card's the file exported from milkshape looks like hell... :(
Alina

This topic is closed to new replies.

Advertisement