Skip to content

Commit

Permalink
Merge pull request #795 from dartsim/simwindow
Browse files Browse the repository at this point in the history
Fix inconsistent frame rate of GlutWindow -- DART 6.1.1
  • Loading branch information
jslee02 authored Oct 15, 2016
2 parents f72ad71 + 9f13d1b commit eaf8539
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 69 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@

## DART 5

### Version 5.1.4 (2016-10-14)

1. Fixed inconsistent frame rate of GlutWindow
* [Pull request #794](https://github.com/dartsim/dart/pull/794)

### Version 5.1.3 (2016-10-07)

1. Updated to support Bullet built with double precision (backport of [#660](https://github.com/dartsim/dart/pull/660))
Expand Down
3 changes: 3 additions & 0 deletions dart/gui/GlutWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ void GlutWindow::initWindow(int _w, int _h, const char* _name) {
#endif
// TODO: Disabled use of GL_MULTISAMPLE for Windows. Please see #411 for the
// detail.

glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
// Note: We book the timer id 0 for the main rendering purpose.
}

void GlutWindow::reshape(int _w, int _h) {
Expand Down
1 change: 1 addition & 0 deletions dart/gui/GlutWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class GlutWindow {
GlutWindow();
virtual ~GlutWindow();

/// \warning This function should be called once.
virtual void initWindow(int _w, int _h, const char* _name);

// callback functions
Expand Down
8 changes: 2 additions & 6 deletions dart/gui/SimWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,13 @@ void SimWindow::keyboard(unsigned char _key, int _x, int _y) {
switch (_key) {
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating) {
if (mSimulating)
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay) {
if (mPlay)
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating) {
Expand Down
6 changes: 0 additions & 6 deletions dart/gui/SoftSimWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,12 @@ void SoftSimWindow::keyboard(unsigned char key, int x, int y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating)
{
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
// case '[': // step backward
// if (!mSimulating)
Expand Down
4 changes: 1 addition & 3 deletions examples/addDeleteSkels/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
switch (_key) {
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating) {
if (mSimulating)
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'q': // Spawn a cube
case 'Q': { // Spawn a cube
Expand Down
6 changes: 0 additions & 6 deletions examples/atlasSimbicon/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,12 @@ void MyWindow::keyboard(unsigned char _key, int _x, int _y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating)
{
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating)
Expand Down
8 changes: 2 additions & 6 deletions examples/bipedStand/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,13 @@ void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
switch (_key) {
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating) {
if (mSimulating)
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay) {
if (mPlay)
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating) {
Expand Down
6 changes: 0 additions & 6 deletions examples/hybridDynamics/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,12 @@ void MyWindow::keyboard(unsigned char _key, int _x, int _y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating)
{
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating)
Expand Down
6 changes: 0 additions & 6 deletions examples/jointConstraints/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,12 @@ void MyWindow::keyboard(unsigned char key, int x, int y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if(mSimulating)
{
mPlay = false;
glutTimerFunc( mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc( mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating)
Expand Down
6 changes: 0 additions & 6 deletions examples/mixedChain/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,12 @@ void MyWindow::keyboard(unsigned char key, int x, int y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating)
{
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating)
Expand Down
8 changes: 2 additions & 6 deletions examples/rigidCubes/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,13 @@ void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
switch (_key) {
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating) {
if (mSimulating)
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay) {
if (mPlay)
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating) {
Expand Down
6 changes: 0 additions & 6 deletions examples/rigidShapes/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,12 @@ void MyWindow::keyboard(unsigned char key, int x, int y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating)
{
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating)
Expand Down
6 changes: 0 additions & 6 deletions examples/softBodies/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,12 @@ void MyWindow::keyboard(unsigned char key, int x, int y)
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating)
{
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay)
{
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating)
Expand Down
8 changes: 2 additions & 6 deletions examples/vehicle/MyWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,13 @@ void MyWindow::keyboard(unsigned char _key, int _x, int _y) {
switch (_key) {
case ' ': // use space key to play or stop the motion
mSimulating = !mSimulating;
if (mSimulating) {
if (mSimulating)
mPlay = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case 'p': // playBack
mPlay = !mPlay;
if (mPlay) {
if (mPlay)
mSimulating = false;
glutTimerFunc(mDisplayTimeout, refreshTimer, 0);
}
break;
case '[': // step backward
if (!mSimulating) {
Expand Down

0 comments on commit eaf8539

Please sign in to comment.