Everything related to SDK.
#387223
I'm trying read RenderPreviewBuffer from existing mxi file, but I get incorrect image
First image is a real render preview,
second image what i get
Image
Image
Used files
Can anyone help? What I doing wrong?
Code: Select all
CmaxwellMxi mxi;
    mxi.read("D:/test.mxi");
    dword xRes, yRes;
    dword xPrevRes = xRes, yPrevRes = yRes;
    mxi.getPreviewResolution(xRes, yRes, xPrevRes, yPrevRes);
    mxi.updateDisplay();
    mxi.updatePreview();

    Crgb8 *pRgb8 = mxi.getRenderPreviewBuffer();;

    QImage image(xPrevRes, yPrevRes, QImage::Format_RGB888);
    for(int y = 0; y < yPrevRes; y++)
    {
        for(int x = 0; x < xPrevRes; x++)
        {
            Crgb pRgb;
            pRgb8->toRGB(pRgb);

            QColor color;
            color.setRgbF(pRgb.r, pRgb.g, pRgb.b);

            image.setPixel(x,y, color.rgb());

            pRgb8++;
        }
    }
    m_graphicsScene->addPixmap(QPixmap::fromImage(image));
    image.save("D:/test.png", "PNG");
#387225
Hi,

The beginning of your code is not correct. Is not importat to your problem but it can be confusing for other users ;)
Code: Select all
dword xRes, yRes;
dword xPrevRes = xRes, yPrevRes = yRes;
mxi.getPreviewResolution(xRes, yRes, xPrevRes, yPrevRes);
should be something like
Code: Select all
dword xRes = mxi.xRes(), yRes = mxi.yRes();
dword xPrevRes, yPrevRes;
mxi.getPreviewResolution(xRes, yRes, xPrevRes, yPrevRes);

Regarding the blue image, it seems that it is a RGB/BGR issue, try this
Code: Select all
color.setRgbF(pRgb.b, pRgb.g, pRgb.r);
Sketchup 2024 Released

Any idea of when the Maxwell Sketchup plugin will […]

Will there be a Maxwell Render 6 ?

Let's be realistic. What's left of NL is only milk[…]