Skip to content

Commit 9bbb719

Browse files
committed
Fix orientation
1 parent de977a4 commit 9bbb719

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

lib/djvApp/Tools/ExportTool.cpp

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ namespace djv
6262
tl::timeline::DisplayOptions displayOptions;
6363
ftk::ImageType colorBuffer = ftk::ImageType::RGBA_U8;
6464
std::shared_ptr<ftk::gl::OffscreenBuffer> buffer;
65+
std::shared_ptr<ftk::gl::OffscreenBuffer> buffer2;
6566
std::shared_ptr<tl::timeline::IRender> render;
6667
GLenum glFormat = 0;
6768
GLenum glType = 0;
@@ -465,6 +466,9 @@ namespace djv
465466
p.exportData->buffer = ftk::gl::OffscreenBuffer::create(
466467
p.exportData->info.size,
467468
offscreenBufferOptions);
469+
p.exportData->buffer2 = ftk::gl::OffscreenBuffer::create(
470+
p.exportData->info.size,
471+
offscreenBufferOptions);
468472

469473
// Create the progress dialog.
470474
p.progressDialog = ftk::ProgressDialog::create(
@@ -534,25 +538,37 @@ namespace djv
534538
auto video = p.player->getTimeline()->getVideo(t, ioOptions).future.get();
535539

536540
// Render the video.
537-
ftk::gl::OffscreenBufferBinding binding(p.exportData->buffer);
541+
{
542+
ftk::gl::OffscreenBufferBinding binding(p.exportData->buffer);
543+
p.exportData->render->begin(p.exportData->info.size);
544+
p.exportData->render->setOCIOOptions(p.exportData->ocioOptions);
545+
p.exportData->render->setLUTOptions(p.exportData->lutOptions);
546+
p.exportData->render->drawVideo(
547+
{ video },
548+
{ ftk::Box2I(0, 0, p.exportData->info.size.w, p.exportData->info.size.h) },
549+
{ p.exportData->imageOptions },
550+
{ p.exportData->displayOptions },
551+
tl::timeline::CompareOptions(),
552+
p.exportData->colorBuffer);
553+
p.exportData->render->end();
554+
}
555+
556+
// Flip the image.
557+
ftk::gl::OffscreenBufferBinding binding(p.exportData->buffer2);
538558
p.exportData->render->begin(p.exportData->info.size);
539-
p.exportData->render->setOCIOOptions(p.exportData->ocioOptions);
540-
p.exportData->render->setLUTOptions(p.exportData->lutOptions);
541-
p.exportData->render->drawVideo(
542-
{ video },
543-
{ ftk::Box2I(0, 0, p.exportData->info.size.w, p.exportData->info.size.h) },
544-
{ p.exportData->imageOptions },
545-
{ p.exportData->displayOptions },
546-
tl::timeline::CompareOptions(),
547-
p.exportData->colorBuffer);
559+
p.exportData->render->setOCIOOptions(tl::timeline::OCIOOptions());
560+
p.exportData->render->setLUTOptions(tl::timeline::LUTOptions());
561+
p.exportData->render->drawTexture(
562+
p.exportData->buffer->getColorID(),
563+
ftk::Box2I(0, 0, p.exportData->info.size.w, p.exportData->info.size.h));
548564
p.exportData->render->end();
549565

550566
// Write the output image.
551567
auto image = ftk::Image::create(p.exportData->info);
552568
glPixelStorei(GL_PACK_ALIGNMENT, p.exportData->info.layout.alignment);
553-
#if defined(dtk_API_GL_4_1)
569+
#if defined(FTK_API_GL_4_1)
554570
glPixelStorei(GL_PACK_SWAP_BYTES, p.exportData->info.layout.endian != ftk::getEndian());
555-
#endif // dtk_API_GL_4_1
571+
#endif // FTK_API_GL_4_1
556572
glReadPixels(
557573
0,
558574
0,

0 commit comments

Comments
 (0)