Search Issue Tracker
Not Reproducible
Votes
0
Found in
Issue ID
626017
Regression
No
[OpenGL] ReadPixel does not work when texture resolution is smaller than active Render Texture
I'm trying to render some GUI elements (labels, boxes) into a rendertexture, then try to readPixels into a Texture2D then render this texture as a GUI element. The idea is to "cache" complex UI elements in a texture so I dont have to re-render the whole thing every frame.
Works fine on Windows.
I've attached a script that reproduced the problem. Just drop it in the asset folder and do "Window->My Window." then scale the window to force a refresh.
In a nutshell, here's what the script does:
- every 100 frames :
- I acquire a temp render texture of 1024x1024 and make it current
- I clear it and render some GUI elements
- I ReadPixel a smaller (512x512) region into a pre-created texture
- every frame I render the texture as a GUI element.
This does not work on OSX.
So, I've narrowed down the problem to doing a ReadPixel into a texture that is smaller than the render texture. (!)
If both the texture and render texture are the same size, everything is peachy on both platforms (test it by setting twidth and theight to 1024)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Add comment