Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9057863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:34:20+00:00 2026-06-16T14:34:20+00:00

I have been trying to import and display an fbx file using the FBX

  • 0

I have been trying to import and display an fbx file using the FBX SDK.Untill. I managed to load in the file, but I got stuck at the part where I have to display it.
The questions:

  1. What exactly are those indices?
  2. How should I display the vertices?

Here is the class that I made:

3dModelBasicStructs.h

struct vertex
{
float x,y,z;
};

struct texturecoords
{
float a,b;
};

struct poligon
{
int a,b,c;
};

Model.h

#ifndef MODEL_H
#define MODEL_H
#define FBXSDK_NEW_API

#define MAX_VERTICES 80000
#define MAX_POLIGONS 80000


#include <fbxsdk.h>
#include "3dModelBasicStructs.h"
#include <iostream>
#include <GL/glut.h>
using namespace std;

class Model
{

     public:

         Model(char*);
         ~Model();

         void ShowDetails();

         char* GetModelName();
         void  SetModelName( char* );
         void  GetFbxInfo( FbxNode* );
         void  RenderModel();
                     void  InitializeVertexBuffer( vertex* );

      private:

          char Name[25];

          vertex vertices[MAX_VERTICES];
          poligon poligons[MAX_POLIGONS];

          int *indices;
          int numIndices;

          int numVertices;


};


#endif

Model.cpp

#include "Model.h"






Model::Model(char *filename)
{
cout<<"\nA model has been built!";

numVertices=0;
numIndices=0;

FbxManager *manager = FbxManager::Create();

FbxIOSettings *ioSettings = FbxIOSettings::Create(manager, IOSROOT);
manager->SetIOSettings(ioSettings);

FbxImporter *importer=FbxImporter::Create(manager,"");
importer->Initialize(filename,-1,manager->GetIOSettings());

FbxScene *scene = FbxScene::Create(manager,"tempName");

importer->Import(scene);
importer->Destroy();

FbxNode* rootNode = scene->GetRootNode();
this->SetModelName(filename);
if(rootNode) { this->GetFbxInfo(rootNode); }

}

Model::~Model()
{
cout<<"\nA model has been destroied!";
}


void Model::ShowDetails()
{
cout<<"\nName:"<<Name;
cout<<"\nVertices Number:"<<numVertices;
cout<<"\nIndices which i never get:"<<indices;

}

char* Model::GetModelName()
{
return Name;
}

void Model::SetModelName(char *x)
{
strcpy(Name,x);
}

void Model::GetFbxInfo( FbxNode* Node )
{

int numKids = Node->GetChildCount();
FbxNode *childNode = 0;

for ( int i=0 ; i<numKids ; i++)
{
    childNode = Node->GetChild(i);
    FbxMesh *mesh = childNode->GetMesh();

    if ( mesh != NULL)
    {
//================= Get Vertices ====================================
        int numVerts = mesh->GetControlPointsCount();

        for ( int j=0; j<numVerts; j++)
        {
            FbxVector4 vert = mesh->GetControlPointAt(j);
            vertices[numVertices].x=(float)vert.mData[0];
            vertices[numVertices].y=(float)vert.mData[1];
            vertices[numVertices++].z=(float)vert.mData[2];
            cout<<"\n"<<vertices[numVertices-1].x<<" "<<vertices[numVertices-    1].y<<" "<<vertices[numVertices-1].z;
this->InitializeVertexBuffer(vertices);
        }
//================= Get Indices ====================================
        int *indices = mesh->GetPolygonVertices();
        numIndices+=mesh->GetPolygonVertexCount();
    }
    this->GetFbxInfo(childNode);
}
}

void Model::RenderModel()
{
glDrawElements(GL_TRIANGLES,36,GL_INT,indices);
}
void Model::InitializeVertexBuffer(vertex *vertices)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,0,vertices);
//glDrawArrays(GL_TRIANGLES,0,36);
}

Sadly , When i try to use drawelements i get this error:
Unhandled exception at 0x77e215de in A new begging.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:34:21+00:00Added an answer on June 16, 2026 at 2:34 pm

    2) How should I display the vertices?

    Questions like these indicate, that you should work through some OpenGL tutorials. Those are the basics and you need to know them.

    This is a good start regarding your problem, but you’ll need to work through the whole tutorial
    http://opengl.datenwolf.net/gltut/html/Basics/Tut01%20Following%20the%20Data.html

    1) What exactly are those indices ?

    You have a list of vertices. The index of a vertex is the position at which it is in that list. You can draw vertex arrays by its indices using glDrawElements

    Update due to comment

    Say you have a cube with shared vertices (uncommon in OpenGL, but I’m too lazy for writing down 24 vertices).

    Cube Vertices

    I have them in my program in an array, that forms a list of their positions. You load them from a file, I’m writing them a C array:

    GLfloat vertices[3][] = {
        {-1,-1, 1},
        { 1,-1, 1},
        { 1, 1, 1},
        {-1, 1, 1},
        {-1,-1,-1},
        { 1,-1,-1},
        { 1, 1,-1},
        {-1, 1,-1},
    };
    

    This gives the vertices indices (position in the array), in the picture it looks like

    Cube Vertices with Indices

    To draw a cube we have to tell OpenGL in which vertices, in which order make a face. So let’s have a look at the faces:

    Cube with face edges

    We’re going to build that cube out of triangles. 3 consecutive indices make up a triangle. For the cube this is

    GLuint face_indices[3][] = {
        {0,1,2},{2,3,0},
        {1,5,6},{6,2,1},
        {5,4,7},{7,6,5},
        {4,0,3},{3,7,4},
        {3,2,6},{6,7,2},
        {4,5,0},{1,0,5}
    };
    

    You can draw this then by pointing OpenGL to the vertex array

    glVertexPointer(3, GL_FLOAT, 0, &vertices[0][0]);
    

    and issuing a batches call on the array with vertices. There are 6*2 = 12 triangles, each triangle consisting of 3 vertices, which makes a list of 36 indices.

    glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, &face_indices[0][0]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to import Database through phpMyAdmin. My database file is a.sql
We have been trying to modify the Customer.php file ( import/export ) to get
I have been trying to import this excel file my mysql database, and it
I have been trying to display a list that I build using PySide. It
I've been trying to use 'import poplib' to access gmail, since I have Pop
Have been trying to encrypt an xml file to a string so that I
I have been trying to create a ListView which I can sort using drag
I have been trying to make custom radio buttons using HTML, CSS, and JavaScript.
I have been trying to import iostream into a custom block, I added the
I have been trying to wrap my head around why this is happening but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.