add option to create mp4 videos from App_AllBullet2Demos, using the

--mp4=video.mp4 note that you have to re-convert for Quicktime
ffmpeg  -f mp4 -vcodec h264 -i test.mp4 -pix_fmt yuv420p test2.mp4
add the option to display text in 3d, used in Coriolis demo
This commit is contained in:
Erwin Coumans
2015-03-25 14:04:26 -07:00
parent 0a04a745dd
commit 2ddd8f78c2
8 changed files with 84 additions and 23 deletions

View File

@@ -275,6 +275,12 @@ struct MyGraphicsPhysicsBridge : public GraphicsPhysicsBridge
}
}
virtual void drawText3D( const char* txt, float posX, float posY, float posZ, float size)
{
btAssert(m_glApp);
m_glApp->drawText3D(txt,posX,posY,posZ,size);
}
};
Bullet2RigidBodyDemo::Bullet2RigidBodyDemo(CommonGraphicsApp* app, CommonPhysicsSetup* physicsSetup)

View File

@@ -55,6 +55,11 @@ struct GraphicsPhysicsBridge
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld)
{
}
virtual void drawText3D( const char* txt, float posX, float posZY, float posZ, float size)
{
}
};
///Bullet 2 specific physics setup, that allows to share code between old and new demo frameworks

View File

@@ -744,6 +744,7 @@ void SimpleOpenGL3App::swapBuffer()
}
m_window->startRendering();
}
// see also http://blog.mmacklin.com/2013/06/11/real-time-video-capture-with-ffmpeg/
void SimpleOpenGL3App::dumpFramesToVideo(const char* mp4FileName)
{
@@ -751,8 +752,17 @@ void SimpleOpenGL3App::dumpFramesToVideo(const char* mp4FileName)
int height = (int)m_window->getRetinaScale()*m_instancingRenderer->getScreenHeight();
char cmd[8192];
sprintf(cmd,"ffmpeg -r 60 -f rawvideo -pix_fmt rgba -s %dx%d -i - "
"-threads 0 -y -crf 0 -b 50000k -vf vflip %s",width,height,mp4FileName);
#ifdef _WIN32
sprintf(cmd, "ffmpeg -r 60 -f rawvideo -pix_fmt rgba -s %dx%d -i - "
"-y -crf 0 -b:v 1500000 -an -vcodec h264 -vf vflip %s", width, height, mp4FileName);
#else
sprintf(cmd, "ffmpeg -r 60 -f rawvideo -pix_fmt rgba -s %dx%d -i - "
"-threads 0 -y -crf 0 -b 50000k -vf vflip %s", width, height, mp4FileName);
#endif
//sprintf(cmd,"ffmpeg -r 60 -f rawvideo -pix_fmt rgba -s %dx%d -i - "
// "-threads 0 -y -crf 0 -b 50000k -vf vflip %s",width,height,mp4FileName);
// sprintf(cmd,"ffmpeg -r 60 -f rawvideo -pix_fmt rgba -s %dx%d -i - "
// "-threads 0 -preset fast -y -crf 21 -vf vflip %s",width,height,mp4FileName);