Graphics

Reply
Accepted Solution

How to draw debug info on top of everything else?

I'm drawing some debug info using the code from the examples, such as:

GameScene.AdHocDraw += () => 
{
Director.Instance.GL.ModelMatrix.Push();
Director.Instance.GL.ModelMatrix.SetIdentity();//go in world space

Director.Instance.GL.SetBlendMode(BlendMode.Normal);
Director.Instance.SpriteRenderer.DefaultFontShader.SetColor(ref Colors.Yellow);

Director.Instance.SpriteRenderer.DrawTextDebug(
 GetDebugInfo(),
 GameScene.LocalToWorld(new Vector2(100f, 100f)), 
 GameScene.Camera2D.GetPixelSize() * EmbeddedDebugFontData.CharSizei.Y
);

Director.Instance.GL.ModelMatrix.Pop();
};

 The problem that I have is that the debug text is drawn below all other graphics so I can't see it.

 

I've tried setting the VertexZ on all my sprites but I can't get them lower than than the debug text. Anyone know how to fix this?

 

Thanks

Please use plain text.

Re: How to draw debug info on top of everything else?

Hi YstafYakuza,

 

A simple way that you can get around these ordering issues that you are seeing is to adjust the order of the Node's which are appearing on top of the text. 

 

scene.AddChild( sprite, -1 );

The -1 will result in the sprite being drawn on the bottom, and hence underneath the debug text. I appreciate that this may not be the best of solutions, but I will enquire as to whether there are any alternative options that you can try. 

 

Thanks

James

PlayStation®Mobile Dev Team
Please use plain text.

Re: How to draw debug info on top of everything else?

Thanks for helping.

 

How is that different from setting Sprite.VertexZ to -1? I would have thought that I was basically doing the same thing already.

Please use plain text.

Re: How to draw debug info on top of everything else?

Well the VertexZ property would help if you were drawing items into the 3d space (although you'd need to look at the Znear property of the Camera class). The -1 on the AddChild call specifies the draw order of the sprites, so in this example making the sprite be the first drawn (i.e. at the bottom).
PlayStation®Mobile Dev Team
Please use plain text.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。