fixed eye blinking in vector graphics examples

pull/3471/head
kallaballa 2 years ago
parent 3419c4e2a7
commit b98f1598c7
  1. 4
      modules/v4d/samples/vector_graphics.cpp
  2. 9
      modules/v4d/samples/vector_graphics_and_fb.cpp

@ -13,7 +13,9 @@ int main() {
//Calls from this namespace may only be used inside a nvg context //Calls from this namespace may only be used inside a nvg context
using namespace cv::v4d::nvg; using namespace cv::v4d::nvg;
clear(); 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 x = 0;
float y = 0; float y = 0;
float w = sz.width / 4; float w = sz.width / 4;

@ -6,16 +6,19 @@ using namespace cv::v4d;
int main() { int main() {
Ptr<V4D> window = V4D::make(Size(1280, 720), cv::Size(), "Vector Graphics and Framebuffer"); Ptr<V4D> 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 //Render the framebuffer in the native window in an endless loop
window->run([=]() { window->run([=]() {
//Creates a NanoVG context and draws eyes //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 //Calls from this namespace may only be used inside a nvg context
using namespace cv::v4d::nvg; using namespace cv::v4d::nvg;
clear(); 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 x = 0;
float y = 0; float y = 0;
float w = sz.width / 4; float w = sz.width / 4;

Loading…
Cancel
Save