fix screen width/height issue on Intel/Linux
add command-line option to set png_skip_frames when taking screenshot series
This commit is contained in:
@@ -157,6 +157,7 @@ void deleteDemo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* gPngFileName = 0;
|
const char* gPngFileName = 0;
|
||||||
|
int gPngSkipFrames = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -763,7 +764,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
|||||||
loadCurrentSettings(startFileName, args);
|
loadCurrentSettings(startFileName, args);
|
||||||
|
|
||||||
args.GetCmdLineArgument("fixed_timestep",gFixedTimeStep);
|
args.GetCmdLineArgument("fixed_timestep",gFixedTimeStep);
|
||||||
|
args.GetCmdLineArgument("png_skip_frames", gPngSkipFrames);
|
||||||
///The OpenCL rigid body pipeline is experimental and
|
///The OpenCL rigid body pipeline is experimental and
|
||||||
///most OpenCL drivers and OpenCL compilers have issues with our kernels.
|
///most OpenCL drivers and OpenCL compilers have issues with our kernels.
|
||||||
///If you have a high-end desktop GPU such as AMD 7970 or better, or NVIDIA GTX 680 with up-to-date drivers
|
///If you have a high-end desktop GPU such as AMD 7970 or better, or NVIDIA GTX 680 with up-to-date drivers
|
||||||
@@ -1101,24 +1102,6 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
//printf("---------------------------------------------------\n");
|
//printf("---------------------------------------------------\n");
|
||||||
//printf("Framecount = %d\n",frameCount);
|
//printf("Framecount = %d\n",frameCount);
|
||||||
|
|
||||||
if (gPngFileName)
|
|
||||||
{
|
|
||||||
|
|
||||||
static int skip = 0;
|
|
||||||
skip++;
|
|
||||||
if (skip>4)
|
|
||||||
{
|
|
||||||
skip=0;
|
|
||||||
//printf("gPngFileName=%s\n",gPngFileName);
|
|
||||||
static int s_frameCount = 100;
|
|
||||||
|
|
||||||
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
|
||||||
//b3Printf("Made screenshot %s",staticPngFileName);
|
|
||||||
s_app->dumpNextFrameToPng(staticPngFileName);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (gFixedTimeStep>0)
|
if (gFixedTimeStep>0)
|
||||||
{
|
{
|
||||||
@@ -1153,6 +1136,25 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gPngFileName)
|
||||||
|
{
|
||||||
|
|
||||||
|
static int skip = 0;
|
||||||
|
skip--;
|
||||||
|
if (skip<0)
|
||||||
|
{
|
||||||
|
skip=gPngSkipFrames;
|
||||||
|
//printf("gPngFileName=%s\n",gPngFileName);
|
||||||
|
static int s_frameCount = 100;
|
||||||
|
|
||||||
|
sprintf(staticPngFileName,"%s%d.png",gPngFileName,s_frameCount++);
|
||||||
|
//b3Printf("Made screenshot %s",staticPngFileName);
|
||||||
|
s_app->dumpNextFrameToPng(staticPngFileName);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (gui2 && s_guiHelper && s_guiHelper->getRenderInterface() && s_guiHelper->getRenderInterface()->getActiveCamera())
|
if (gui2 && s_guiHelper && s_guiHelper->getRenderInterface() && s_guiHelper->getRenderInterface()->getActiveCamera())
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ void Reset(Tree &tree, Jacobian* m_ikJacobian)
|
|||||||
// Update target positions
|
// Update target positions
|
||||||
|
|
||||||
void UpdateTargets( double T2, Tree & treeY) {
|
void UpdateTargets( double T2, Tree & treeY) {
|
||||||
double T = T2 / 20.;
|
double T = T2 / 5.;
|
||||||
target1[0].Set(0.6*b3Sin(0), 0.6*b3Cos(0), 0.5+0.4*b3Sin(3 * T));
|
target1[0].Set(0.6*b3Sin(0), 0.6*b3Cos(0), 0.5+0.4*b3Sin(3 * T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -753,8 +753,10 @@ void SimpleOpenGL3App::swapBuffer()
|
|||||||
m_window->endRendering();
|
m_window->endRendering();
|
||||||
if (m_data->m_frameDumpPngFileName)
|
if (m_data->m_frameDumpPngFileName)
|
||||||
{
|
{
|
||||||
writeTextureToFile((int)m_window->getRetinaScale()*m_instancingRenderer->getScreenWidth(),
|
int width = (int)m_window->getRetinaScale()*m_instancingRenderer->getScreenWidth();
|
||||||
(int) m_window->getRetinaScale()*this->m_instancingRenderer->getScreenHeight(),m_data->m_frameDumpPngFileName,
|
int height = (int) m_window->getRetinaScale()*this->m_instancingRenderer->getScreenHeight();
|
||||||
|
writeTextureToFile(width,
|
||||||
|
height,m_data->m_frameDumpPngFileName,
|
||||||
m_data->m_ffmpegFile);
|
m_data->m_ffmpegFile);
|
||||||
m_data->m_renderTexture->disable();
|
m_data->m_renderTexture->disable();
|
||||||
if (m_data->m_ffmpegFile==0)
|
if (m_data->m_ffmpegFile==0)
|
||||||
|
|||||||
@@ -516,6 +516,9 @@ void X11OpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
|
|||||||
|
|
||||||
m_data->m_dpy = MyXOpenDisplay(NULL);
|
m_data->m_dpy = MyXOpenDisplay(NULL);
|
||||||
|
|
||||||
|
m_data->m_glWidth = ci.m_width;
|
||||||
|
m_data->m_glHeight = ci.m_height;
|
||||||
|
|
||||||
if(m_data->m_dpy == NULL) {
|
if(m_data->m_dpy == NULL) {
|
||||||
printf("\n\tcannot connect to X server\n\n");
|
printf("\n\tcannot connect to X server\n\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user