Skip to main content
GameDev.net gamedev.net
🔒 Locked

3D Model Loading & 2D Sprite Animations

Started by DriveByBaptism May 26, 2011 at 9:53 AM 2 replies 1.8k views
Original Post
DriveByBaptism
DriveByBaptism
I've been goggling my butt off for the past few days trying to find OpenGL specific tutorials/code snippets online that deal with the above two problems.

I was wondering if any of you have used anything to solve the above two problems I need to complete. If not sites, the how about any books? Namely; will this book teach me the topics? http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321498828/ref=pd_sim_b_5

Any help would be appreciated.
haegarr
haegarr
Neither the one nor the other topic is strictly related to OpenGL, and it would IMHO be a mistake to introduce such a strict relation artificially.

Loading a model means to convert its data from a file format to an application internal format. This internal format may or may not be close or even identical to something directly suitable for use with a specific graphics API. Nowadays hardware based graphics APIs are good in processing vertex arrays, either as SOA or (even better) as AOS. This organization is also good for compact memory footprints and iteration by the CPU (as opposed to the "vertex is an object on the heap" approach). So it is "natural" to choose such an internal format. Going for an own internal format may have advantages when it comes to processing. E.g. meshes that can be split, support LODs, ... may need more data than those standard vertex attributes.

When necessary, multiple variants of the same mesh may exist, e.g. adapted representations. The standard internal format may be used to compute other formats (e.g. one that is fitted best for the version of a specific graphics API found on the running computer). Perhaps the mesh in internal format can be dropped once the adapted representation is computed. However, even if you restrict the problem to OpenGL, there are still version / extension differences (immediate mode vs. vertex arrays vs. VBOs; OpenGL vs. OpenGLES, ... ) and hardware issues (e.g. occupying an amount of a POT multiple (including negative exponents) of 32 bytes per vertex) and perhaps even OS specific things.

With sprite animation things are similar. Sprite means that a rectangular, screen aligned face is mapped onto the screen using a texture slice for coloring and masking. And sprite animation probably means that the placement of the face on the screen and/or the slice of the texture is altered at runtime. How the animation is represented internally and processed from frame to frame is a matter of the animation system, but not of the rendering (in the sense of drawing graphics) system. The outcome may or may not already fit into a specific graphics API.

With the above I already introduced implicitly how I deal with the said issues. Other people may (and will) see these things in another way, of course.
mmakrzem
mmakrzem
On my website you'll find code that I wrote that lets you load FBX files and render them. In the OpenGL tips and tricks section, you'll also find a video tutorial that shows how to do sprite animation. Enjoy!
smasherprog
smasherprog
Check out http://assimp.sourceforge.net/ It can load more model file formats that you will know what to do with . The design is simple too.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.