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

camera movement with the fractional time value

Scheduled Pinned Locked Moved QML and Qt Quick
opengl under qm
2 Posts 2 Posters 1.0k Views 2 Watching
  • 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.
  • sajis997S Offline
    sajis997S Offline
    sajis997
    wrote on last edited by SGaist
    #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 last edited by A Former User
      #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

      • Login

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