views:

89

answers:

2

I'm trying to use the Assimp library to import models to a rudimentary OpenGL application with VBO use.

If I understand it correctly glDrawElements is one of the ideal modern ways to draw things.

But how do we get that information from a generic import library?

If you have specific Assimp library knowledge it's appreciated.

--

What is generally the process to generate these?

+1  A: 

From the documentation it looks like the aiFace::mIndices from an aiMesh::mFaces index into aiMesh::mVertices.

aiVector3D looks like it's laid out such that you should be able to able to just call glVertexPointer() with mVertices and use mIndices directly in your glDrawElements() call.

genpfault
+3  A: 

Collect all indices from aiMesh::mFaces in a single buffer. Make sure to pass aiProcess_Triangulate to Assimp as postprocessing flag (amongst aiProcess_JoinVertices and whatever seems useful to you), and skip over points and lines or handle them separately.

The various data streams in aiMesh - such as aiMesh::mVertices and aiMesh::mNormals need to be set as GL input data streams (glVertexPointer, ...).

Alexander Gessler