Announcement

Collapse
No announcement yet.

SDK v5.10.01 VFB can not save image

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SDK v5.10.01 VFB can not save image

    demo code:
    int main(int argc, char **argv)
    {
    RendererOptions ro;
    ro.showFrameBuffer = true;
    ro.enableFrameBuffer = true;
    VRayInit init(true);
    VRayRenderer* renderer;
    try
    {
    renderer = new VRayRenderer(ro);
    renderer->vfb.show(true, true);
    }
    catch (const VRay::VRayException ex)
    {
    std::cout << ex.what() << std::endl;
    }

    bool result = renderer->vfb.loadImage("123.exr");
    result = renderer->vfb.saveImage("123.bmp");
    }
    Same code in SDK 4.30.3.1 works fine,but in SDK 5.10.01
    VFB UI can't display, vfb.loadimage return true,but vfb.saveimage return false.

  • #2
    Hi, I just tried those functionalities and everything seems okay. What OS are you using? Also, check if renderer->getLastError() has any error in it.

    Comment


    • #3
      I have try it on win10 and CentOS7,both return false. renderer->getLastError() return "File write error."

      Comment


      • #4
        Okay, the first thing to check is why the VFB UI is not showing. Can you try to attach a callback to the LogMessage event before you try to show the VFB and copy the log:
        Code:
        void logMessage(VRay::VRayRenderer &renderer, const char* message, VRay::MessageLevel level, double instant, void* userData) {
            switch (level) {
            case VRay::MessageError:
                printf("[ERROR] %s\n", message);
                break;
            case VRay::MessageWarning:
                printf("[Warning] %s\n", message);
                break;
            case VRay::MessageInfo:
                printf("[info] %s\n", message);
                break;
            case VRay::MessageDebug:
                // Uncomment for testing, but you might want to ignore these in real code
                printf("[debug] %s\n", message);
                break;
            }
        }
        
        ...
        
        renderer = new VRayRenderer(ro);
        renderer->setOnLogMessage(logMessage);
        renderer->vfb.show(true, true);
        Also, does the VFB UI display if you start an actual render, or you can't make it appear at all?
        Last edited by dimitar.bashliev; 11-05-2021, 06:37 AM.

        Comment


        • #5
          Originally posted by dimitar.bashliev View Post
          Okay, the first thing to check is why the VFB UI is not showing. Can you try to attach a callback to the LogMessage event before you try to show the VFB and copy the log:
          Code:
          void logMessage(VRay::VRayRenderer &renderer, const char* message, VRay::MessageLevel level, double instant, void* userData) {
          switch (level) {
          case VRay::MessageError:
          printf("[ERROR] %s\n", message);
          break;
          case VRay::MessageWarning:
          printf("[Warning] %s\n", message);
          break;
          case VRay::MessageInfo:
          printf("[info] %s\n", message);
          break;
          case VRay::MessageDebug:
          // Uncomment for testing, but you might want to ignore these in real code
          printf("[debug] %s\n", message);
          break;
          }
          }
          
          ...
          
          renderer = new VRayRenderer(ro);
          renderer->setOnLogMessage(logMessage);
          renderer->vfb.show(true, true);
          Also, does the VFB UI display if you start an actual render, or you can't make it appear at all?
          The VFB UI can't display in debug mode (VS2017). When I start an actual render, it can display normally. So this question doesn't matter much.

          I try to sleep 5 second after vfb.loadimage, then vfb.saveimage return true. The image created correctly.

          Is vfb.loadimage executed asynchronously? How do I know the execution is over?

          Comment


          • #6
            It turns out that this was in fact a problem - loadImage returns before the image is fully loaded. It has already been fixed, so if you try any build after April 27, you should be okay.

            Comment


            • #7
              Originally posted by dimitar.bashliev View Post
              It turns out that this was in fact a problem - loadImage returns before the image is fully loaded. It has already been fixed, so if you try any build after April 27, you should be okay.
              Thanks a lot! But I can't found any build after April 27 in https://nightlies.chaosgroup.com/ or https://download.chaosgroup.com/?lic...254&product=49

              Comment


              • #8
                Can you check the nightlies again? It should be visible now.

                Comment


                • #9
                  Originally posted by dimitar.bashliev View Post
                  Can you check the nightlies again? It should be visible now.
                  Thank you very much. Everything is okay now!

                  Comment

                  Working...
                  X