Results 1 to 5 of 5

Thread: Rotation problem

  1. #1

    Rotation problem

    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


    Attached Files Attached Files

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,129
    Rep Power
    732

    Re: Rotation problem

    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.
    Attached Files Attached Files
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3

    Re: Rotation problem

    Thanks Petr , As always Amazing.
    i suggest to Eros to include this specific situation in the samples.
    Regards

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,782
    Rep Power
    10

    Re: Rotation problem

    Quote Originally Posted by zak
    i suggest to Eros to include this specific situation in the samples.
    Done.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Rotation problem

    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

    you can't always get what you want, but if you try sometimes you might find, you get what you need

Similar Threads

  1. World Matrix Rotation
    By Dylan in forum WCHS thinBasic gaming forum
    Replies: 8
    Last Post: 11-11-2010, 16:38

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •