3
\$\begingroup\$

Hey all, i'm currently using Lib3ds to load models into my C++/OpenGL project. So far, i've been follow the model loading tutorial found here.

The tutorial gives a good example of how to draw the vertices and normals using VBO's, but so far i've been lost as how to do the same thing with materials.

Could i get an explanation/example of how to both load and draw materials of my meshes using Lib3ds and OpenGL?

\$\endgroup\$
2
\$\begingroup\$

Explanation: every mesh face has a material, basically you need to load each material and during rendering:

for each mesh do
   for each face do
      setup face material
      draw face
   end
end

But this will be inefficient and the ideal would be to group faces by material. You can after load process the mesh and group the faces with the same material, then you can draw each face batch at once for each material.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.