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?
Indices is defined as a GLubyte array of 48 elements; GLubyte is the OpenGL data type for an unsigned byte ( unsigned char ). You could use any of the following unsigned integral OpenGL data types: GLubyte , GLushort , and GLuint , since indices are never negative (signed) or fractional (float/double).
What's the difference between glDrawArrays and glDrawElements ? Can anyone help me? glDrawArrays submits the vertices in linear order, as they are stored in the vertex arrays. With glDrawElements you have to supply an index buffer.
When glDrawElements is called, it uses count sequential elements from an enabled array, starting at indices to construct a sequence of geometric primitives. mode specifies what kind of primitives are constructed and how the array elements construct these primitives. If more than one array is enabled, each is used.
An index buffer is essentially an array of pointers into the vertex buffer. It allows you to reorder the vertex data, and reuse existing data for multiple vertices.
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
, ...).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With