This project is read-only.

2D Rendering using SpriteBatch Problem

Apr 17, 2012 at 3:25 PM

I am trying to get my graphical UI to render on the screen of an AR scene based on Tutorial 8. For some reason it won't render though. I've done this several times on just XNA games but it won't work with Goblin. I'm guessing it has something to do with a conflict with the UI renderer for Goblin. 

 

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);
            spriteBatch.Begin();
            Vector2 pos = new Vector2(200, 200);
            spriteBatch.Draw(SpriteTexture, pos, Color.White);
            spriteBatch.End();

            scene.Draw(gameTime.ElapsedGameTime, gameTime.IsRunningSlowly);
        }
    }

Coordinator
Apr 18, 2012 at 4:09 PM

scene.Draw(....) will clear the background internally using GraphicsDevice.Clear method, so if you want to add any of your UI graphics on top of the 3D objects rendered by the scene graph, use scene.RenderBeforeUICallback or scene.RenderAfterUICallback properties to set the delegate function to be called at the appropriate phase of the render pipeline. For some explanations see the API documentation and the User Manual under the "User Interface" -> "2D GUI" section.

Ohan

Apr 20, 2012 at 7:30 PM

Thank you for your reply.