Search Results

Search found 2 results on 1 pages for 'croco'.

Page 1/1 | 1 

  • Mouse Speed in GLUT and OpenGL?

    - by CroCo
    I would like to simulate a point that moves in 2D. The input should be the speed of the mouse, so the new position will be computed as following new_position = old_position + delta_time*mouse_velocity As far as I know in GLUT there is no function to acquire the current speed of the mouse between each frame. What I've done so far to compute the delta_time as following void Display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1.0f, 0.0f, 0.0f); static int delta_t, current_t, previous_t; current_t = glutGet(GLUT_ELAPSED_TIME); delta_t = current_t - previous_t; std::cout << delta_t << std::endl; previous_t = current_t; glutSwapBuffers(); } Where should I start from here? (Note: I have to get the speed of the mouse because I'm modeling a system) Edit: Based on the above code, delta_time fluctuates so much 34 19 2 20 1 20 0 16 1 1 10 21 0 13 1 19 34 0 13 0 6 1 14 Why does this happen?

    Read the article

  • speed up the update of glutidle()

    - by CroCo
    I have a client that sends data at 1KHz (i.e. 0.001 sec) to a master over Internet using UDP protocol. In Master, I need to draw an object, but the problem is that the update of GLUT is slower than the client's update. I have tried to use glutTimerFunc(0,glutIdle, 0); but still slow. Is there a way to speed up the update rate of drawing? I need to update Display() every 0.001 sec. Any suggestions? I'm using windows 7.

    Read the article

1