So here’s the problem…

I’m going through an optimization phase and now it comes to mathematic (and god know i totally su*k at mathematics… )

I load 3Dds models using the great lib3ds (http://lib3ds.sourceforge.net/index.html)

and i try to adapt their great 3ds player on my cellphone.

right now, i load all the vertices in one big array and i use one gldrawarrays(); to draw the stuff and it works pretty well.

But, since 3ds modellers are lazy (eh did you say developers ?)

they develop their models part by part and then rotate + translate them in order to fit in the rest of the model.

Then it leads to the following situation.

(the original 3ds player)

getting the mesh matrix, (4x4 matrix), getting the vertexes, drawing -> OK.

(my player)

not getting the mesh matrix, getting the vertexes, drawing -> OMG, everything’s screwed ! -> NOT OK.

so in my code i have the following lines :

```
for (j = 0; j < 3; ++j)
{
if (_tex_vertices)
{
_tex_vertices[(int)(*count / 1.5) + j * 2] = mesh->texelL[f->points[j]][0] * self._scalex;
_tex_vertices[(int)(*count / 1.5) + j * 2 + 1] = self._scaley - mesh->texelL[f->points[j]][1] * self._scaley;
}
for (i = 0; i < 3; ++i)
_vertices[*count + j * 3 + i] = mesh->pointL[f->points[j]].pos[i];
}
*count += 9;
```

The thing is that i’m looking for a way to muliply each vertices by the 4x4 matrix of each mesh in order to avoid calling each time glmultmatrixf();

See what i mean ? (i would understand if not ^^)

So i googled openGL matrix on the net and i found that

Rotate

The rotation matrix is a little bit more advanced, you will infact need 3 matrices for 3 dimensions.

One for the X-Axis, one for the Y-Axis and one for the Z-Axis, like this:

X - Axis:

|1 0 0 0|

|0 cos sin 0|

|0 -sin cos 0|

|0 0 0 1|

Y - Axis:

|cos 0 -sin 0|

|0 1 0 0|

|sin 0 cos 0|

|0 0 0 1|

Z - Axis:

|cos sin 0 0|

|-sin cos 0 0|

|0 0 1 0|

|0 0 0 1|

Note! Above I’m talking about rotating in radians not degrees!

I think i need to rotate (or translate ?) each vertices in order to render them correctly, but i just can’t seem the right way to find how to translate a full matrix rotation into a single point…

Thanks in advance for the post, and sorry for the long post ^^’