Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've started looking into using Assimp to load in dae collada files into my game.

I believe I've managed to load the file into aiscene. I am using c++, OpenGL and SFML.

My problem lies with extracting the data from aiscene to use in my game.

My question:

What steps do I need to take to get my model on the screen after I have the data loaded into aiscene?

I don't even know where to start so I would be grateful for any tutorials or books showing this or simple examples?

Thanks very much!

share|improve this question
1  
Did you google for assimp tutorial? –  Jari Komppa Jan 29 '13 at 6:28
    
yes i did but i could find anythign of use, alot of the stuff was about using assimp but not what to do once the data had been loaded into the assimp variable. Also why has my post been minus?? –  Tom Burman Jan 29 '13 at 19:52
    
Maybe your question was downvoted because "assimp loading models" in google gives this as the first result: lighthouse3d.com/cg-topics/code-samples/… which is what you need. –  Luke B. Jan 31 '13 at 18:26

2 Answers 2

You can look at the assimp docs here: http://assimp.sourceforge.net/lib_html/data.html and http://assimp.sourceforge.net/lib_html/structai_scene.html

An asset loaded by assimp is assembled into several data structures. At the top there is the aiScene, which contains both a list of aiMesh mesh data, and an aiNode hierarchy for placing instances of the mesh data using various transforms and parenting. The scene also has a list of all materials and textures.

First you will probably want to create textures and possibly shaders from the list of textures and materials in the scene. The aiMesh data has all of the vertex data you need, so you'll want to create a vertex buffer for each mesh. Each mesh has one material, and each material can have multiple textures (color map, normal map, specular map, etc).

Then you walk the aiNode tree, calculate and set the transform, and draw the mesh referenced by the node. To draw the mesh, bind the shader and textures for the material used by the mesh, and then draw the vertex buffer.

If you want to support animation, you can look at the aiAnimation list in the scene. Each animation consists of a number of channels, which can affect a node's transform matrix. Skeletal animation is done via bone weights for the vertices of a mesh, and is a bit too complicated for this post.

I've written a simple opengl asset viewer based on assimp using the C api, which does skeletal animation. You can look at as an example: https://github.com/ccxvii/asstools/blob/master/assview.c

share|improve this answer

You have to extract the vertecie information. This data is containd inside the assimp model (i used an older version of assimp when i did this ) And from there you have to insert that data in to your buffer, to create a OpenGL buffer so you can use that one to draw the model.

http://ogldev.atspace.co.uk/www/tutorial22/tutorial22.html

Thats probably a perfect tutorial, since it´s about loading the model and using OpenGl. hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.