Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - gex

Pages: [1]
1
Graphics / Issue with RenderTexture to Image copy
« on: July 16, 2019, 12:20:14 am »
Hey there

First of all I try to explain what I am doing before going into the specific issue I encountered and where I will appreciate any help and experience.

SFML version 2.5.1 on windows, dynamic linked in c++ 11

I am using SFML Graphics for creating a rasterized output containing text and a QR code, which can be added to print output (yeah, not best for print, but reality for a lot of legacy applications, but we use high resolutions to get best quality). When everything is drawn, it is exported/saved as PNG/JPEG or whatsoever. Initially I created one "large" RenderTexture and used is one canvas where I drew all the stuff. when finished I copied the texture to an Image and saved it to a file. This worked fine on Desktop machines.

So now for the fun part:
Then we made tests on target machines and some of them were Windows Server (2012 / 2016) machines, where no RenderTexture larger than 1000x1000 or maybe 1024/1024 could have been created. So the obvious thing to do was to split it up to multiple RenderTextures and then combined it into the final Image. Now it still worked on my Machine and it did on the target Windows Server machines. However it did only work properly on the windows server machine if our executable was executed directly (both traditional win32 exe and console application). As soon as the same binaries with same commands and data were executed as a subprocess of another programm, parts of the output image went black (/or gray when saved as png). This messed up part did only occur in the largest RenderTexture, so I like to illustrate this with two pictures

layout_lines.png is created using "debug layout" option, which draws green lines around all layout areas, which currently match a RenderTexture each.

https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=25561.0;attach=4391;image


and as you can see in the following example.jpg, in the largest layout area, the end / bottom is messed up.
https://en.sfml-dev.org/forums/index.php?action=dlattach;topic=25561.0;attach=4389;image



From a code perspective the following pattern is followed:
sf::RenderTexture rt;
if (!rt.create(width, height)) {
            throw ...;
}
rt.clear(sf::Color::White);

// multiple draw calls
rt.draw(...);

rt.display();
const sf::Texture &texture = rt.getTexture();
img.copy(texture.copyToImage(), an_x_pos, a_y_pos);
 

I am passing the RenderTexture as a reference to other functions in order to draw to it.

At the moment I am unable to reproduce the issue on any of my machines at hand - I ran the examples on azure virtual machines (server) and was able to reproduce the RenderTexture size limit but not black/gray-area issue. What am I missing, does any one have an idea what goes wrong there?

Pages: [1]