diff --git a/modules/v4d/samples/vector_graphics.cpp b/modules/v4d/samples/vector_graphics.cpp index 446927b50..c8b7d18f6 100644 --- a/modules/v4d/samples/vector_graphics.cpp +++ b/modules/v4d/samples/vector_graphics.cpp @@ -13,7 +13,9 @@ int main() { //Calls from this namespace may only be used inside a nvg context using namespace cv::v4d::nvg; clear(); - float t = cv::getTickCount() / cv::getTickFrequency(); + + static long start = cv::getTickCount() / cv::getTickFrequency(); + float t = cv::getTickCount() / cv::getTickFrequency() - start; float x = 0; float y = 0; float w = sz.width / 4; diff --git a/modules/v4d/samples/vector_graphics_and_fb.cpp b/modules/v4d/samples/vector_graphics_and_fb.cpp index 057ab02c4..99ef65a74 100644 --- a/modules/v4d/samples/vector_graphics_and_fb.cpp +++ b/modules/v4d/samples/vector_graphics_and_fb.cpp @@ -6,16 +6,19 @@ using namespace cv::v4d; int main() { Ptr window = V4D::make(Size(1280, 720), cv::Size(), "Vector Graphics and Framebuffer"); - +#ifdef __EMSCRIPTEN__ + float start = emscripten_get_now() / 1000.0f; +#endif //Render the framebuffer in the native window in an endless loop window->run([=]() { //Creates a NanoVG context and draws eyes - window->nvg([](const Size& sz) { + window->nvg([=](const Size& sz) { //Calls from this namespace may only be used inside a nvg context using namespace cv::v4d::nvg; clear(); - float t = cv::getTickCount() / cv::getTickFrequency(); + static long start = cv::getTickCount() / cv::getTickFrequency(); + float t = cv::getTickCount() / cv::getTickFrequency() - start; float x = 0; float y = 0; float w = sz.width / 4;