-
-
Notifications
You must be signed in to change notification settings - Fork 205
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 recovery from volatile texture cache results in vertically flipped image and other issues #2163
Comments
In this code:
The call |
The |
Yes I see, and given The cocos2d-x version of Texture2DGL::getBytes has that |
Flipping the image contents may be a slow process, and which gets worse with larger image size, so would any flipping happening at the time the image is being saved to the cache cause issues with when the Android app is about to be put into the background? The reason is because of Activity.onPause(), and this specific section:
We use It would be like this:
If this is done, then we can do heavy processing when reading the texture data, meaning flipping etc., without any issues when the application is being put into the background. If we don't want to change it to the above, then perhaps we should do the flipping on recovering images from the volatile texture cache, since there are no time restrictions at this point. We would have to store a flag in the texture cache entry to indicate whether the image needs to be flipped or not. |
I have remember it, and I make a PR for fix above 2 issues: #2166 |
Steps to Reproduce:
this.mGLSurfaceView.setPreserveEGLContextOnPause(false);
inAxmolActivity.java
Two separate issues.
The first issue is that an image is created from the render texture in order for it to be saved in the cache, but the texture data read via
glReadPixels
results in the flipped image.The second issue is that that if the texture disappears if the application is put into the background more than once, meaning the EGL context loss event happens more than once.
Example of original RenderTexture output:
After first recovery from context loss:
After another recovery, it's complete blank.
The text was updated successfully, but these errors were encountered: