Forum Discussion
xhonzi
11 years agoHonored Guest
Draw 2D GUI Texture onto Quad Mesh?
viewtopic.php?f=41&t=7724 This is perhaps a repeat of my question in this other thread. I'm having trouble building a 2D texture (not material) to place on a plane or quad mesh. This is to draw s...
xhonzi
11 years agoHonored Guest
"xhonzi" wrote:
So I need to call GL.clear once per frame- before all of the ONGUI calls. I thought making a script that makes a single GUI.draw call at GUI.layer 2000 (further out than all of my other GUI layers) and having it draw almost nothing- paired with a single GL.clear after it would work... but so far no dice.
Still struggling with this. I stumbled upon WaitForEndOfFramehttps://docs.unity3d.com/Documentation/ScriptReference/WaitForEndOfFrame.html, and tried setting a bool that would cause the next OnGUI call (presumably the first of the next frame) to GL.clear before it drew anything else. I couldn't get it to work. I don't understand iEnumerators, so that's probably why.
What sort of worked was setting that bool in the update() method on my mesh. I'm not sure when the mesh's update is called in relation to the GUI.draws... but it works- sort of. I have also tried lateupdate() and PreRender() (on a camera) to set the bool, but they all have the same "works- sort of" effect.
What works- with a single rendertexture receiving several layers from several OnGui calls- I seem to be getting all of my layers. I might be missing some, but I haven't notitced anything yet.
What doesn't work- in a scene with two rendertextures (a cutscene mesh with a texture and a GUI mesh with a seperate texture) the GUI texture's GL.clear isn't working correctly. The whole texture is black and opaque (instead of black and transparent) when nothing is drawn to the GUI texture. When GUI elements with transparent parts are drawn to the texture, those parts are transparent, but not the rest of the texture. When the cutscene is over and the cutscene mesh is disabled, then the GUI layer goes transparent.
On a lark, I tried tying my GL.clear to the depth of the GUI elements instead, which also sort of worked, but ended up culling a lot of layers I needed. But that's the most successfull version of everything I've tried- though I suspect it's the most hacky.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 months ago
- 11 months ago
- 11 months ago
- 7 months ago