Author Topic: Rendering GUI on Surface  (Read 2945 times)

ludos1978

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Rendering GUI on Surface
« on: April 08, 2014, 10:12:29 AM »
Hi,

I'm having some complicated and uncommon task to do.

I'm working on a virtual 3d book that has bendable pages for a augmented reality application for an exhibition. It's based on a sqlite database, a combination of Mega-Fiers and custom scripting to bend the page and an GUI system that should help layouting the page. I'm currently trying NGui as GUI toolkit (alternatives are Daikon Forge or implementing a rudementary GUI system myself).

a rougth description how it works:
- the system instantiates a prefab of a page
- the camera renders the page into a rendertexture
- the page prefab is deleted
- the texture is applied to the page mesh
(and lot's of other things in the background)

i have a problem at the moment:
- when i call render just after instantiating a page it does not render the new page, but it seems as it's rendering a old content.
it looks like ngui is caching something or needs to be notified of the change?

any hints on what i need to modify or call to fix this problem?

thanks
« Last Edit: April 08, 2014, 02:52:26 PM by ludos1978 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Rendering GUI on Surface
« Reply #1 on: April 09, 2014, 02:58:11 AM »
NGUI's draw calls get created in UIPanel's LateUpdate() call, so if you attempt to draw something right after instantiation, nothing will happen. Only Awake() and OnEnable() functions will execute. Start(), Update() and LateUpdate() will be missing. You need to delay the rendering until the end of frame -- just yield WaitForEndOfFrame().