Advertisement

Md2 problem

Started by September 10, 2001 12:01 PM
-1 comments, last by nousername 23 years, 5 months ago
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:-)

This topic is closed to new replies.

Advertisement