lynear

01-07-2002, 09:43 PM

Okay here is what i am trying to do... is i am trying to make my own gltranslate function basically with out conventionally glMultMatrixf or glLoadMatrix... so i decided to do a little research and here is what i came up with... that if you group objects to move the same ( i call it clustering ) then i assign it a

float m[16]

btw the code is all in C.

so the structure goes

cluster(contains triangles and numtriangles and [obj matrix])

->

triangle which contains vertexes

->

vertexes which contain x,y,z,u,v

so i made my own glulookat function and decided to begin from there... i got everything working for the glulookat function (my implementation) i could walk around and all, strafe movement with mouse. so now i want to really see how OpenGl works by doing this little project.

But i need some help. My algo in pseudocode:

T=transformation matrix.

cluster.objmatrix=clusters matrix

res=result

MatrixBy= Matrix multiplying

(maybe i am doing this wrong I haven't really looked into it. I got it off a site who offers sound advice--not a good practice, but for times sake i decided to.)

glGetFloatv(GL_MODELVIEW_MATRIX,m)

//^ not sure about this... don't think i need it

MatrixBy( T, cluster.objmatrix, res );

MatrixBy( res, m, res );

and then for each vertex i multiply it by a triangle vertex...

sector1.triangle[triloop].vertex[0] = MatrixbyVertex(res,sector1.triangle[triloop].vertex[0]);

then i draw each triangle in a loop if you want my code just request it.

Thanks for listening,

Dan

float m[16]

btw the code is all in C.

so the structure goes

cluster(contains triangles and numtriangles and [obj matrix])

->

triangle which contains vertexes

->

vertexes which contain x,y,z,u,v

so i made my own glulookat function and decided to begin from there... i got everything working for the glulookat function (my implementation) i could walk around and all, strafe movement with mouse. so now i want to really see how OpenGl works by doing this little project.

But i need some help. My algo in pseudocode:

T=transformation matrix.

cluster.objmatrix=clusters matrix

res=result

MatrixBy= Matrix multiplying

(maybe i am doing this wrong I haven't really looked into it. I got it off a site who offers sound advice--not a good practice, but for times sake i decided to.)

glGetFloatv(GL_MODELVIEW_MATRIX,m)

//^ not sure about this... don't think i need it

MatrixBy( T, cluster.objmatrix, res );

MatrixBy( res, m, res );

and then for each vertex i multiply it by a triangle vertex...

sector1.triangle[triloop].vertex[0] = MatrixbyVertex(res,sector1.triangle[triloop].vertex[0]);

then i draw each triangle in a loop if you want my code just request it.

Thanks for listening,

Dan