Jump to content
  • Advertisement
Sign in to follow this  
DriveByBaptism

OpenGL 3D Model Loading & 2D Sprite Animations

This topic is 2608 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

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!