You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to capture a part of my scene with a code similar to the following (the design resolution is 1920*1080):
unsigned int SIZE_X = 960;
unsigned int SIZE_Y = 540;
unsigned int POS_X = 100;
unsigned int POS_Y = 100;
RenderTexture* texture = RenderTexture::create(SIZE_X, SIZE_Y);
texture->setVirtualViewport(Vec2(POX_X, POS_Y),
Rect(0, 0, 1920, 1080),
Rect(0, 0, SIZE_X, SIZE_Y));
texture->begin();
this->visit();
texture->end();
texture->saveToFile("test.png", Image::Format::PNG);
I've tried a lot of different combinations of parameters, but whatever I do, at most the pixels from the rectangle 0, 0, SIZE_X, SIZE_Y are captured, the rest is filled with transparent pixels. Also the offset is wrong.
Here is the result of the code above for a mockup scene, where red means transparent pixel:
All the pixels that I have displayed in red are empty and they shouldn't, and the offset is wrong.
The text was updated successfully, but these errors were encountered:
Nyrio
changed the title
RenderTexture::setVirtualViewport() misses a lot of pixels
RenderTexture::setVirtualViewport() misses a lot of pixels and has wrong offset
Mar 5, 2018
I wanted to capture a part of my scene with a code similar to the following (the design resolution is 1920*1080):
I've tried a lot of different combinations of parameters, but whatever I do, at most the pixels from the rectangle 0, 0, SIZE_X, SIZE_Y are captured, the rest is filled with transparent pixels. Also the offset is wrong.
Here is the result of the code above for a mockup scene, where red means transparent pixel:
All the pixels that I have displayed in red are empty and they shouldn't, and the offset is wrong.
The text was updated successfully, but these errors were encountered: