简体   繁体   中英

From C++ MD2 Loader to C\Objective-C & Cocoa

It is mostly out of boredom, really... This afternoon I decided to make a simple 3D Game on Cocoa & OpenGL based on what I've done on one of my OpenGL class. I'm using the MD2 loading code that is posted at David Henry's "The Quake II's MD2 file format" and I like how it's put together, giving nice explanations, and nice C++ code. I want this to go all Cocoa/Objective-C so I can get the feel for the stuff and I got to a part which I cannot translate to C - I simply do not got enough experience in programming. Here is the code in question, which relates to file reading:

// read frame data...
file.seekg( header.ofs_frames, std::ios::beg );
file.read( (char *)buffer, num_frames * header.framesize );

So, my question is this: is there an equivalent for seek() on C's file functions that I can use? Any related info you think I might find useful?

Thank-you in advance, and bless.

看看fseekfreadstdio.h

Not sure if you're still looking for resources for how to do this, but I found a great tutorial at the Kode80 blog: http://kode80.com/2009/09/24/iphone-md2-example/

There is a sample project in which the author wrote an MD2 reader for Objective-C/OpenGL ES from the MD2 spec ( http://tfc.duke.free.fr/coding/md2-specs-en.html )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM