Game Development Community

Always render an object, even if it is out of view

by Paul Gaynor · in Torque Game Engine · 03/07/2004 (6:33 pm) · 6 replies

Hi,

I am trying to get a SceneObject to always onRender().
Is there a way to set it to render even when out of view?

Thanks,
Paul

#1
03/07/2004 (8:08 pm)
I don't know of any...Why do you want to call render it if its out of view (i.e. should not render anything visible)?

If you do really want it to render --> change the bounding box so that it is always in view
If you always want to draw something on screen --> make it a GUI control and add it to playGui
If it is just to do some calculation --> make it a gamebase object and put your calculations in processTick

-Pascal
#2
03/07/2004 (11:25 pm)
Paul,

There's absolutely no good reason to do this. I presume you want this because you're using the 'onRender()' to do some additional updating to the object itself? If so, then perhaps you should be using an object based upon the 'GameBase' class which has time-integration built-in and can therefore update independant of rendering.

- Melv.
#3
03/08/2004 (6:43 pm)
Thanks for the replies,

What I am doing is, I have created an object that draws lines between 2 (other) objects (dglPoint2Screen(), dglDrawLine() ), this object(connectionLines) is a SceneObject using onRender() to draw the lines. the lines have to exist when the connectionLines Object is not in view (it doesnt have any model associated with it, just a point in 3d space). The easiest solution was to make it always render.

The next idea was to convert it into a GuiObject but the first attempts failed. Deriving from GameBase is a solution that I was not aware of. What sort of changes would need to be made to this SceneObject to make it work as a GameBase?? How about a GuiObject? Any other suggestions?

Thanks,
Paul
#4
03/08/2004 (6:55 pm)
Why not just make the objBox/worldBox big enough so that it contains both objects it should draw a line between? That would make it draw itself appropriately (but not always). Otherwise you could set mObjBox to infinite and it should always draw.

-Pascal
#5
03/08/2004 (7:18 pm)
I will look into it, what sort of problems(high resource cost?)are seen when you have an object with an infinite mObjBox?

-Paul
#6
03/08/2004 (7:53 pm)
I think objects get put in an extra overflow bin so it would get checked every frame -- but if you want to be drawn every frame anyway I don't think that's a problem.

-Pascal