Trying to use Vertex Arrays and Buffer Objects

The 3ds materials don’t really map to (core) OpenGL materials. It all depends of what you want to do… If by “material” you mean different diffuse reflectance, then just glEnable(GL_COLOR_MATERIAL) and use the color array. If it is something more complex (like different reflectance model/different texture), then you will have to do it yourself, using shaders, for example.

I need to use the material properties of each face:

mat->ambient
mat->diffuse
mat->specular
mat->shininess

How I introduce all this information into the array? Because I need one color for each element and here I have three and the shininess.

AFAIK, it is not possible with the fixed pipeline. The glColorMaterial allows you to set only one of this parameters via the color array.

Please correct me if I am wrong.

But the combination of these four properties form a final an unic color for each pixel, doesn’t it?
And it’s not possible to calculate this color and to use in the array?

Uhm, this four properties are used in lighting calculation. So the final color of each fragment depend on number of factors like normal cector and position of a fragment, number/position/direction/color of lights etc.
Refer to the specification for more detailed formulas. There is an extension that introduces a secondary color (now part of the core), usually used for a specular component AFAIK, but my experience with fixed pipeline is quite limited, so I may be mistaken. I suggest that you read the specification and see if you find something you could use.

Reading more about the materials issue I’ve arrived at the conclusion that, as somebody suggested, the only option is to use shaders. Even in some books it’s written that the problem with these kind of data structures like VBO is that there isn’t enough support for materials by now.

I’m using the color array with the diffuse parameter while I decide if it’s necessary or not to deal with shaders.

Thanks for all your suggestions.

Finally I resolved the compilation problem with VBOs adding the line
#define GL_GLEXT_PROTOTYPES
to my header file, even I’m not sure about the reason. I use a 2.1 OpenGL version and VBOs are already in the core.

The includes are

glvisor.h

#define GL_GLEXT_PROTOTYPES
#include <qgl.h>
#include <lib3ds/file.h> 
#include <qstring.h>
#include <qpushbutton.h> 

glvisor.cpp

#include <iostream>
#include <stdio.h>

using std::cout;

#include <lib3ds/material.h>
#include <lib3ds/matrix.h>
#include <lib3ds/mesh.h>
#include <lib3ds/node.h>
#include <lib3ds/vector.h>
#include <qcolordialog.h>

#include "glvisor.h"