Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. camera movement with the fractional time value
QtWS25 Last Chance

camera movement with the fractional time value

Scheduled Pinned Locked Moved QML and Qt Quick
opengl under qm
2 Posts 2 Posters 705 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sajis997
    wrote on 11 Mar 2015, 19:00 last edited by SGaist 3 Nov 2015, 20:12
    #1

    Hello,

    I am going through an functional opengl application which I shall be trying to move to Qt with QtQuick and C++ integration. I am following the post "OpenGL under QML"

    The typical opengl application has a render function as follows:

      //timing related calcualtion
    
      //store the current time , which is initially ZERO
      last_time = current_time;
    
      //now ge the current time
      current_time = glutGet(GLUT_ELAPSED_TIME)/1000.0f;
    
      //calculate the fractional time difference
      dt = current_time-last_time;
    

    Initially the current_time and last_time is initialized to ZERO. The fractional value dt is then used to do the camera movement within the scene. How do I achieve something similar from Qt Quick. Probably there is a better way to achieve the same issue in QtQuick. Any hint ?

    By the way, is it possible to enable the code highlighter here in the post. I used do it using the [code] ...... [/code] , but it is not working here.

    Thanks

    [edit: add missing coding tags: 3 ` before and after the code SGaist]

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 11 Mar 2015, 22:26 last edited by A Former User 3 Nov 2015, 22:26
      #2

      Hi,
      you can do this in Javascript like this:

      var t0 = new Date()
      var t1 = new Date()
      var dt = t1 - t0; // delta in ms
      

      Cheers!

      1 Reply Last reply
      0

      2/2

      11 Mar 2015, 22:26

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved