  | | | C++/FTK - AddTriangleList() causes crash. :( | C++/FTK - AddTriangleList() causes crash. :( 2004-07-09 - By Jed
Back Hello All,
I'm in the process of writing an export plugin for a 3D app in an effort to speed up transition from it to XSI. I had already partly hacked out a half-working version before but decided to use the FTK as it makes life a little easier with some of the heirarchies in the models.
Anyway, to the problem...
I've created a mesh and populated the VertexLists and created and poulated NormalLists and UVCoorLists.
The code I used is a combination of what was in the SLTest source and the documentation for CLSBaseShape. I've compiled and run the SLTest exe and it runs fine, but for some reason, when I try do to something similar it crashes for no reason.
Heres the extract of the code I knocked up to test that I was creating the Mesh object correctly.
---code--- // Add a Mesh Model m_Model = m_RootModel->AddMesh(); m_Model->SetName("testmesh"); m_Model->Visibility()->SetVisibility(SI_TRUE);
// Get a hook to this models Mesh. m_Mesh = (CSLMesh*) m_Model->Primitive(); m_BaseShape = (CSLBaseShape*) m_Mesh->Shape(); m_Shape = (CSLShape*) m_BaseShape; // Get a hook to the vertices CSLBaseShape::CSLVector3DArray *l_Vertices = m_BaseShape->GetVertexList(); l_Vertices->Resize(9); // Get a hook to the normals CSLBaseShape::CSLVector3DArray *l_Normals = m_BaseShape->CreateNormals(); l_Normals->Resize(9);
// Get a hook to the UV co-ords CSLBaseShape::CSLVector2DArray *l_UVCoords = m_Shape->CreateUVCoords(); l_UVCoords->Resize(9);
// Set the vertices/Normals for (int i=0;i<9;i++) { (*l_Vertices)[i].Set( 0.0f, 0.0f, 0.0f ); (*l_Normals)[i].Set ( 0.0f, 1.0f, 0.0f ); (*l_UVCoords)[i].Set( 2.0f, 3.0f ); }
// Add a triangle list and fill it. CSLTriangleList* l_TriList = m_Mesh->AddTriangleList(); ---endcode---
The above works absolutely fine without the last line of code, but if I include it and try and run the compiled exe, it gives me the error:
First-chance exception in ftk_test.exe (XSIFTK.DLL): 0xC0000005: Access Violation.
I've check my project settings and its all as per the doumentation for setting it up in the MSVC6 project environment.
I'm at a complete loss! I have no idea what its doing or how to solve it. I'm not the best C++ programmer in the world so I'm really stumped with this one.
Any ideas?
- Jed
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|
 |