PDA

View Full Version : modelView - origine translation


nv_dv
03-Jul-2006, 18:07
hi there

issuing with transforms onto modelview-matrix

when i create vertex_group (one actually) the only thing seem moving its
vertex... (hooo :grin: )
seriously, my goal its to translate [vertex] while they turn on themselve
but once i translate i figure out that the rotate axe away
i wonder if there's a way to move the origine

i tryed this
-----------------------------------
glRotatef(ax, 1.0,0.0,0.0);
glRotatef(ay, 0.0,1.0,0.0);
glRotatef(az, 0.0,0.0,1.0); // i'm aint sure about that View or Model ?

glPushMatrix();
glTranslatef(to origine);
glRotatef(pr, 0.0,0.0,1.0);
glTranslatef(to curent pos);
glVertex..........; glPopmatrix();

------------------------------------------
its ok when turn on the same place
but + translate...

-------------------------------------------
...
glPushMatrix();
glTranslatef(to origine);
glRotatef(pr, 0.0,0.0,1.0);
glTranslatef(to curent pos);
---- glTranslatef(0.02,0.0,0.0); -----
glVertex..........; glPopmatrix();
------------------------------------------
rotate away :sad:

if someone got a trick about modelview thing and/or origine translating
any help or link wloud be great.

alright that it and keep on GL :razz:

darkblu
03-Jul-2006, 22:43
aside from the fact that you posted your question in the wrong forum (i'm sure you meant to post here (http://www.beyond3d.com/forum/forumdisplay.php?f=22))

you seem to have one basic misunderstanding re OGL transformation pipe: the model-view operator (just as all others OGL transform operators) takes right-hand side sub-operators in a column-major transformation (aka operator-leftism). so the following operator sequence:

glRotate()
glTranslate()
glVertex()

will produce a [R]x[T]xV sequence (in column-major notation). i.e. the 2nd transform comes on the right-hand side of the 1st transform, and the vertex vector comes last (so the cumulative transform operator is on the left-hand side of the vector, hence 'operator-leftism').

IOW, when you want to rotate something around its origin and then translate it you do:

glTranslate()
glRotate()
glVertex()

carry on and good luck with OGL!

nv_dv
04-Jul-2006, 05:47
-wong place_post-
oups :shock:

truthly i never check out this(link) before( escuse me for that mistake )


-Ogl-
man u're saving me, thankx darkblu

Geo
15-Aug-2006, 00:49
Fixing Last Post link. . .

nv_dv
29-Nov-2006, 14:43
now it's works :)
-------------------init func----------
...
glTranslatef(.0,.0,-1.0);
...



----- RENDER ------
float ry,rx;
float mx,mz;

----------------------------
init motion X / Y with whatever u want
-----------------------------

render(){
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

glPushMatrix();

glTranslatef(mx,.0,mz);
glRotatef(ry, .0,.0,.0);
glRotatef(rx, .0,.0,.0);

glCallList(list_idx[0]);
----------------------------------
or glVertex() glEnd() as u wish
----------------------------------

glPopMatrix();

glFlush();

(rx+=2.0)%360;
(ry+=2.0)%360;
}

----------------------------------
yeah i'm still in the wong place sorry about it