Results 1 to 5 of 5

Thread: Demonstration of matrix operations

  1. #1
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Demonstration of matrix operations

    TBGL offers 3 basic transformations - translating, rotating and scaling.

    When creating geometry on the fly, we can use TBGL_Translate, TBGL_Rotate and TBGL_Rotate to transform primitives.
    In some situations, we would prefer to work with one triangle mesh, which would have all the transformations baked in.

    Attached script shows multiple techniques:
    - how the matrix magic works under the surface
    - how to bake transformation to data structure
    - how to use hi performance vertex arrays

    Program allows you to cast transformations on triangle, as well as it shows complete dynamic matrix stack listing, so you can observe which parts of matrix represent what.

    ( first 3 columns are orientation of X, Y, Z axes, diagonal reflects scaling, last column translation )


    I hope this will reveal at least part of mysteries related to matrices used in transforms,
    Petr

    UPDATED 29.03.2009
    + Added clearing the buffer
    ! Cleaned up matrix stack code
    Attached Images Attached Images
    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

  2. #2
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Re: Demonstration of matrix operations

    Thanks Petr, for the example.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: Demonstration of matrix operations

    Updated the code,

    it is possible to clear buffer, matrix stack faster and better


    Petr
    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

  4. #4
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    52
    Posts
    944
    Rep Power
    111

    Re: Demonstration of matrix operations

    hi petr, hi kent

    I like the script, very very nice one... and so everyone can see what translation/rotation/scaling of a vertex/triangle are good for you can see after changing the values... good exercise !

    perhaps you can add a new button (I have done a dummy example for you) for realisation the triangle at the new position after changing the values... (moveObjectToNewPosition button) only an idea...

    have all a nice day, it wasn`t so great for me this monday morning, my car no more hasn`t fun to start... electronic problems with lighmachine and cockpit... uff...

    ciao, lionheart
    Attached Images Attached Images
    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: Demonstration of matrix operations

    Hi Frank,

    interesting idea, but I want to keep this example as simple as possible... of course I will not limit any efforts to enhance it


    Petr
    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

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
  •