New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendertexture produces upside down result #116
Comments
I can't change it. It happens for the most optimized RenderTexture implementation (FBO), which directly renders to the target texture. |
It isn't possible to somehow to create a warning for it while running in Debug? Like if you are clearing the texture without having displayed it? So if we are doing a debug build we will get a warning printed out that we might be trying to use a unfinished texture? Or is that not a valid detection for it and is there no way to detect it? Or you could do so that if Clear has been called then the texture returned in GetTexture will use an invalid OpenGL texture id and then nothing will be shown until Display is called(where you correct the OpenGL texture again) or something like that. But that might be overly complex to fix just something like this. Not really important, just trying to come up with some solutions so that others won't fall into the same trap as I did. Like you pointed out it's something that happens inside the FBO and warning the user that he might be using the RenderTexture wrong is much work for little gain and maybe even will give false negative warnings. |
It would require to add ugly stuff to sf::Texture, I don't want to do that ;)
It is valid to get a reference to the target texture at any time: before/during/after rendering. So GetTexture always returns a valid texture.
If something goes wrong then read the doc. Isn't it enough? ;) |
Suspected as much
Well people are lazy and stupid, including me and they most probably won't read it until they've whined about it on the forum and then been told to read the documentation. Most generally, if something behaves unexpected then it is wrong. But like I said, this is more effort than gain really. |
It caught me out as well, it's simple when you know what's happening but not very intuitive. Thanks for the explanation. |
This one got me hard. But i see it was indeed my fault. |
Just got me. Would've taken me quite some time to realize I was missing a display, old post much appreciated :-) |
It is more like an unexpected behaviour more than a bug but still it blew me back a couple of hours in tracking down the source and it all came down to this.
If you render to a rendertexture and do not call Display before trying to use it, it might be possible for you to get a upside down result. It's not a major bug but it is confusing at the time if you just by accident missed to make the proper call. Having nothing being changed should be the proper behaviour if you ask me. It would also make it easier for the developer to guess what he did wrong.
Here's code for a simple example:
I've compiled and tested this on Windows, MinGW with Debug library and Nvidia card only.
The text was updated successfully, but these errors were encountered: