Jump to content
  • Advertisement


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


Md2 problem

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Since one week I try to load these md2 files in Delphi but I still get a huge amount of access violations so I thought I´ll ask you. My first problem is the loading procedure: I dont´t get any errors while executing this procedure but at the end of the event (for example TForm.create, or whenclickedon) I get a strange access violation. procedure MD2.loadfromfile(filename:string); var hdr: MD2_HEADER_TYP; Ffile:file; begin AssignFile(Ffile, filename); try Reset(Ffile, 1); BlockRead(Ffile, hdr, SizeOf(hdr)); if hdr.magic <> 844121161 then exit; if hdr.version <> 8 then exit; //getmem(Fframes,hdr.frameSize*hdr.numFrames); FFrames:=allocmem(hdr.frameSize*hdr.numFrames); seek(Ffile,hdr.offsetFrames); blockread(Ffile,Fframes, hdr.frameSize*hdr.numFrames); //getmem(FglCommands,hdr.numGlCommands*sizeof(longint)); Fglcommands:=allocmem(hdr.numGlCommands*sizeof(longint)); seek(Ffile,hdr.offsetGlCommands); blockread(Ffile,FglCommands, hdr.numGlCommands*sizeof(longint)); fnumFrames := hdr.numFrames; fnumGlCommands := hdr.numGlCommands; FframeSize := hdr.frameSize; FnumTriangles := hdr.numTriangles; finally closefile(Ffile); end; Sorry for my english but I hope you can a least understand my code:-)

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!