Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Design of a modern data driven renderer

This topic is 2225 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

Hi guys.
I'm trying to create a modern rendering system, trying being the keyword. I want to make something that is API independent and data driven. All my research points me in the direction of using render lists. I can somewhat comprehend what is entailed, but ownership confuses the crud out of me. I'm a tools programmer, graphics is something i'm aware of but i can't remember the last time i wrote a shader. Please bare with me as some of this is going to be described a bit higher level than i would like to.

So i have a GameObject which contains a RendererComponent. The RendererComponent owns a RenderCommand and a Material. The material contains a shader, and all the variables (textures, matrices etc…) that the shader needs. The RenderComponent is responsible for filling out the RenderCommand based on it's material.
[source lang="cpp"]class RenderCommand {
Independent VBO;
u32 numTriangles;
u32 numVerts;
// topology?
// kvp for shader values?
// Blend mode
Obviously i want rendering to batch based on MaterialState rather than having to make one draw call for each object.
To achieve batching i have each camera own a list of RenderCommands, this is of course filled with objects visible after all sorts of culling.
After the render commands have been queued up, sort them based on material, and material properties to avoid state changes where possible.
The game Renderer has an ExecuteRenderCommand function, that takes a render command as an argument. Lets assume the implementation (OpenGL, vs DirectX) is loaded from a dll.
Finally submit the RenderCommands to the Renderers ExecuteRenderCommand function

First question, Am i even in the ballpark with this? I was not able to find any information on making a data driven renderer with RenderCommands.
Are there any good articles / books / online resources on the topic?

I'm also thinking about making RenderCommand abstract and subclassing it to VBORenderCommand, DisplayListRenderCommand, etc… Enabling some higher level system to choose which command to use based on the device the code is running on. Any objections to this? Maybe a better approach?

Should i abstract RenderCommand away from the RenderComponent? Something like
[source lang="cpp"]foreach(gameObject in visibleObjects)
camera.renderCommands.add(gameObject->renderComponent->FillCommand(new RenderCommand()));[/source]

where FillCommand returns the argument that was passed in?

All of the above code is assuming that i'm going to be passing pointers to VBO's around. Is there any instance where making a new VBO and copying over the source data would be benefitial?

Again, i'm a tools programmer, so this is all new to me, sorry if the questions are dumb.

Thanks so much for taking the time!

Share this post

Link to post
Share on other sites
This is a very long thread from last year, but might be of interest: http://www.gamedev.net/topic/604899-frostbite-rendering-architecture-question/

Share this post

Link to post
Share on other sites
@kd7tck Thanks for the tip, looking at the file format right now.

@Hodgman I don't know how i didn't find that thread. thanks, it's exactly what i was looking for!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!