How to find out if a frame started

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

How to find out if a frame started

Post by KungFooMasta »

Hello,

I'm working on a 2D Renderer that uses Ogre, which I plan to release to the community, however there is just one last thing I couldn't figure out.

As I understand it, the RenderSystem performs render operations to render targets. In order to setup the render system for rendering, the _beginFrame and _endFrame APIs are called. My question is, is there a way to tell if the render system is currently rendering a frame? (At a particular point in time, how to tell if _beginFrame has been called?)

The reason to know this is to make the library easier for users. The Renderer class I'm making can be used at any time, however it can be called during frame rendering, or before/after frame rendering, and theres is a slight change in render system configuration for these cases.
Creator of QuickGUI!
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 538

Re: How to find out if a frame started

Post by Kojack »

There's nothing I can find in the render systems or scene manager that would indicate it's between the begin and end frame. Mostly both of those methods just directly call the underlying graphics api, so maybe directx or opengl has something. Although the dx11 renderer actually does nothing when _beginFrame or _endFrame are called, they are empty (except an exception). (freaky, directx11 doesn't use beginscene?)

You might be able to roughly work it out by using a render queue listener. Between the _beginFrame and _endFrame the closest listener events are firePreRenderQueues and firePostRenderQueues. There's not much code between them and the frame methods, and none of it looks user accessible. So those should be roughly similar, just set a bool on and off in the listener.
Post Reply