Hi, I've been following the tutorials over on ogldev, and I have managed to get obj models to load using vao's. However, when I try and use collada, if there is more than one mesh in the scene they all get drawn in the middle. I think this is an issue with the transformation matrix for the node, but when I try and implement a recursive render like the one in the sample, I get an unhandled exception for the aiMatrix that gets the transformation for the root node. Is this an issue with the model that I am trying or is it my program?
What does the debugger say about this crash? To me it sounds like the root node pointer is null, which is probably an error in the loading process. Maybe the file path just didn't fit, which results in a nullptr for the scene. Check the return codes and the log messages, and verify the scene structure with AssimpView to see what you should expect to handle in your own application.
Unhandled exception at 0x0128cbee in Prototype.exe: 0xC0000005: Access violation reading location 0xfeef02f2.
That's the error I get when I run the program, and if i check AssimpView, it says that there are two meshes, then a VisualSceneNode with 0 meshes, and two meshes coming from this node. Does this mean that the root node does not contain any meshes?
To my knowledge, the OBJ loader generates one node below the root node for each mesh. That means that you have a root node without meshes and two subnodes with one mesh each.
That crash description, btw, does not say anything. Use your debugger to see the exact line in your code that caused the crash and the variable contents at the time of the crash. AssimpView loads the file, which means that Assimp is not the cause of the crash, which means that your code is the source of the crash. You'll have to correct this issue for yourself, I can't help you there.
do you use the developer snapshot or the current release? I am asking this because we had some issues with the obj-loader in the last release, which are already solved, but not released yet.
The debugger can help you to identify the place of your described crash ;-).
Ok, it's definitely an issue with the scene being loaded, if I check it while it is debugging, it says that nothing can be evaluated, which explains why the program is having issues when obtaining the transformation for the node. From the look of it, it seems that as soon as the init function is finished, for some reason the scene becomes empty again. I think I'll just need to check through my code to see what's going on.
Ok, I've managed to fix that problem, the importer was being declared in the init function, so once I made that global everything loads. Thanks for the help!
My program no longer crashes but all meshes still load in the same spot. I tried getting the transformation for each node and rendering the meshes after but they still appear in the wrong place.
Of course the scene is gone when the importer instance is destroyed. Please read the documentation.
Please let me clarify something: the thread title says "exporting collada". Are you really talking about the Assimp exporter interface? Which means: do you read some 3d file using Assimp, export this to Collada, and then read it via some other program and all the meshes appear in the same spot?
I'm asking because from the thread contents I got the impression that you're not using the exporter interface at all, but you're just struggling with basic concepts of 3D rendering and basic concepts of the programming language you're using. If you're just rendering an Assimp scene, how do you set the transformation matrix? You can calculate it recursivly like the OpenGl example, but you also have to transmit it to your vertex shader and use it there - or set the OpenGL transformation matrix in case you're still using fixed function pipeline.
Sorry, I meant rendering an Assimp scene, I was pretty tired when I made the topic! I've managed to solve this issue now, I created a function that took the transformations for each node, and applied it to the position of the vertices. Thanks for all the help!
Good to see it's solved. Good luck on your further endeavours.
Log in to post a comment.