PDA

View Full Version : Rotation problem



zak
18-01-2009, 13:53
hi
the enclosed program will rotate a triangle by pressing keys,
but i have trouble in the situation when i rotate the triangle some degrees to the left then stop, then rotate it down as in the attached captured small movie of a human bone. i have added some rotation in the Z direction
but it is not working as i want.
thanks for help

Petr Schreiber
18-01-2009, 14:38
Hi Zak,

this is common problem I had with OpenGL too - it rotates the object, but it is not done using the object local axes, but global ones.

I attach example for you, which should do what you need, but using TBGL entity system.

Entity system calculates the transformations on its own (partially assembler optimized thanks to Charles) and then passes the final result to OpenGL.

zak
18-01-2009, 15:19
Thanks Petr , As always Amazing.
i suggest to Eros to include this specific situation in the samples.
Regards

ErosOlmi
19-01-2009, 12:23
i suggest to Eros to include this specific situation in the samples.


Done.

Lionheart008
19-01-2009, 18:43
hi zak, hi all :)


this is common problem I had with OpenGL too - it rotates the object, but it is not done using the object local axes, but global ones.

as I have used one of the first nehe lessons with triangle (and rotation) I have had a similar problem some month ago... I can remember it very well... but I have never built a rotation with z-axes with entity system, thank you petr :) good work...


If TBGL_GetWindowKeyState(hWnd, %vk_pgdn) then TBGL_EntityTurn(%sScene, %eTriangle, 0, 0, 1)

so far as I know the x-y rotation of triangle rotation did already exists ;)

good evening, thanks for the good example, Lionheart