PDA

View Full Version : Hmm all the transformation's passed to opengl



lynear
01-07-2002, 10: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

lynear
01-08-2002, 07:44 PM
Does Anyone know this is kinda important i now there opengl gurus out there


Dan

lynear
01-08-2002, 10:30 PM
Haha figured it out...

-first off my math was bad (don't get **** off the internet and not check it).

-second off i was changing the world coordinates(hehe not enough JOLT) and i wasn't translating after i was rotating

-third didn't have update u v texture stuff.

-fourth i was intermixing float[16] 1D matrices with 2D so that is bad i stuck to just 1D.

-fifth no one will ever read this so why am i writing it...

Dan

rIO
01-09-2002, 12:00 AM
I was reading it, but u have been faster than me... http://www.opengl.org/discussion_boards/ubb/smile.gif

rIO.sK www.spinningkids.org (http://www.spinningkids.org)