Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Rendering question

This topic is 5755 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was just wondering how most people handle rendering, I''m doing an event driven game, and so I decide what''s going to be rendered as I go, depending on the user input. How do you handle that? Do you make some kind of queue and render all at once? or render each item when it comes up? or something else?

Share this post

Link to post
Share on other sites
Do you make some kind of queue and render all at once?

Yep, the heart of our engine works in roughly that way.

The main reason is so that we can sort by rendering style to minimise hardware state changes (current texture(s), renderstates, shader handles etc).

Another thing it helps with is Z sorting when dealing with alpha - all alpha stuff which needs sorting (not all does) needs to be rendered after anything which writes to the Z buffer to work properly so we can trivially batch that too.

A downside is when you come to debug a problem, say the 23rd DrawPrimitive() call blows up, tracing back to which code passed wrong data to the higher level batching code can be a problem since the sorting means the rendered stuff is now in essentially a random order compared to the higher level game code. I''d advise augmenting your batching structures with some info to ease the tracing of bad data.

Our engine also allows a few advancements on top of the basic idea of batching, for example:

a) Display lists (OpenGL style) of draw calls with both inline vertex/index/matrix data as well as references to preloaded data.

b) All the draw calls from a particular frame can be cached to do things which take advantage of frame to frame coherence (e.g. "camera hasn''t moved so don''t clear").

c) Draw calls are added to a "view" - a view can be a viewport of a render target, a render target texture, a different monitor etc

["Draw calls" in our engine are higher level calls and command structures which specify rendering style, which matrices to use, which textures to use, which buffers to use, parameters for any shaders involved in achieving the "style" etc. A draw call only uses one style at a time so higher level model style (etc) grouping is the responsibility of higher level code]

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!