MS3D ASCII Models and Vertex Arrays problem
I'm having trouble using ms3d ascii models and vertex arrays. The code I'm using is based upon code by Marco Monster. Rendering the model normally using glVertex3f() etc. calls works fine, but when I tried to convert it to use va's it goes, well, crazy. The source is here so if anyone could take a look, I'd be very grateful.
Thanks.
[edited by - sibbo2001 on July 11, 2002 8:38:49 PM]
Do you really expect somebody to do that? explain close what happens.. digging through somebody''s code, understanding what he''s trying to do etc. takes _a lot_ of time. So.. explain..
Phil
Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
)
Phil
Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
Sorry, I guess I should have been clearer. Basically, what happens is the matrix rotations and translation go awry, and the model mecome severely fragmented, and I can''t understand why this happens as I''m using exactly the same matrix operations as in the old function.
If anyone is kind enough to take a look, the problem is in the CMS3DAscii.cpp file, and the function is CMS3DAscii::Render().
If anyone is kind enough to take a look, the problem is in the CMS3DAscii.cpp file, and the function is CMS3DAscii::Render().
ok. Seems your drawing code is still buggy. the reason for the animation glitches were pretty simple, and that was you were going through each triangle and rotating/translating the verticies each had.. but a lot of triangles were linked to THE SAME verticies. so several verticies were rotated/translated many, many times.
once fixed it shows the actual renderer isn''t right. as a lot of triangles are missing.
also note you will be leaking A LOT of memory (about 4mb/second) because of this line:
Vertex *Vert = new Vertex[Shapes[k].nNumVertices];
which has no matching delete []..
in which case anyway, you should have a buffer setup to the size of the biggest ''shape'' object. as memory reallocation/deallocation is _VERY_ slow. (although your only effected by the former here
)
once fixed it shows the actual renderer isn''t right. as a lot of triangles are missing.
also note you will be leaking A LOT of memory (about 4mb/second) because of this line:
Vertex *Vert = new Vertex[Shapes[k].nNumVertices];
which has no matching delete []..
in which case anyway, you should have a buffer setup to the size of the biggest ''shape'' object. as memory reallocation/deallocation is _VERY_ slow. (although your only effected by the former here

I also have a good feeling that you arn''t releasing your GL context correctly. although I didn''t look into it, because frankly, it''s your problem.
Thanks a lot for the help, guess I still have a lot of learning to do. The code should be quite easy to fix now you told what''s going wrong, and thanks for the heads up about the GL rendering context, seems I was calling DestroyWindow instead of my class'' destroy window/release gl function.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement