Advertisement

Wondering about the Lesson4 Game tutorial...MD2 format question

Started by April 14, 2003 11:27 PM
1 comment, last by Compaqx101x 21 years, 10 months ago
Hi guys. Well I''ve been working on an MMORPG (massively multiplayer online role playing game) in Java for a college project and I can load MS3D files (however because I use Java3D instead of open gl-my fault-I''m not going to try to do animations with the MS3D file format) and I''m trying to load MD2 files to handle animations as they are just held as frame data and easy to load. So I decided to look at this tutorial here at nehe and to try to convert some of the C++ code into Java code. Things started off okay and are going pretty well. But these lines keep confusing me: glCommands= new long [header.numGlCommands*sizeof(long)]; if(glCommands==NULL) return false; fseek(file, header.offsetGlCommands, SEEK_SET); fread(glCommands, header.numGlCommands*sizeof(long), 1, file); I don''t see why an array of type long is being created to hold the number of gl Commands multiplied by the size of a long. I thought one would just create an array of the number of GlCommands and pass the long variables into it. Maybe I''m just reading this wrong or making a stupid mistake with C++ array and data copy format. I guess because I don''t think it''s possible to just copy data into a structure or an array using something like fread in Java I would just like some clarification. If this doesn''t make sense, just let me know and I''ll clarify. Thanks, Compaq
yes the *sizeof(long) in the new operator does seem somewhat pointless... maybe just a little logical slipup by whoever made the tut...

| - Project-X - my mega project.. getting warmer - | - adDeath - an ad blocker I made - | - email me - |
Advertisement
thanks .

This topic is closed to new replies.

Advertisement