gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > modelview problem

#96927 - Rajveer - Sun Aug 06, 2006 5:18 pm

hi guys, i have a problem with the modelview matrix.

when i call glLoadIdentity();, push this onto the matrix stack, translate it with glTranslatef(so its in the view) and render my model it works fine, so do rotations with glRotate.

now ive defined my own matrix[16], and changed values so its the identity matrix too, as in the following:

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

the translation vector (4th column, rows 1-3) translate the object fine, but for some reason the object is not drawn properly (as in vertices are sharing the same coords or something).

multiplying it with rotation matrix with a call from glRotate doesnt rotate it properly, it seems to be rotating at weird intervals and even then not properly.

at the moment the matrix is defined as s32, changing to float screws things up more as even changing the translation vector doesnt do anything now.

anybody got any ideas?

#96929 - omaremad - Sun Aug 06, 2006 5:22 pm

matrices have to be in a certain fixed point alignment before being sent to the hardware

try f32 matrices and use flottof32(1.0) to test you matrix, ndslib converts the matrix to ds format from the f32 format

#96930 - Rajveer - Sun Aug 06, 2006 5:26 pm

cheers for the reply!

you mean libnds or the older ndslib? (using libnds atm)

thought it was a prob with types too, tried changing the matrix to f32 but didnt do anything, not too sure on how to use floatof32(1.0) hehe. got any tips?

EDIT: wow...it worked! cheers! you dont know how much of an idiot i feel like now ;)