Sign in to follow this  

rendering: decoupling and canvases

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

Hello, I am in the process of writing a simple renderer for my project which basically creates a single window (I am using OGL under XP but my question is not about OGL specifically) which is used to display the few object contained in my scene. While fleshing out a basic class layout for this I had a thought. How could one render to many canvases both within a game and within the operating system? For instance I may eventually wish to embed the system in a standard windows application (maybe as a preview plane or something). I may also like to have a kind of multi-canvas system in-game as shown in the (not particularly good!) diagram below (where view 1 & 2 are the views from the purple cameras 1 & 2). The question is not so much about how to achieve this using a particular API (although information along such lines would certainly be appreciated) but about how one might structure (through the use of design patterns,decoupling,etc..) the game's rendering engine (I am a big OO fan!) in order to provide this functionality in a structured and intuitive manner. Thanks, algorhythmic

Share this post


Link to post
Share on other sites
Model-View architecture. Separate the data (the model) completely from any graphical representation that is used to describe it (the view). This way, you can have n-number of views all based off the same data. You can do this nicely by using the Observer design pattern where you register your views as "listeners" of the data and when it changes, it notifies all listeners, which then update themselves with the new data. The boost::signal class can be used for this, though there are other ways as well.

The goal is that the model knows absolutely nothing about any view, or even if any views exist. It simply triggers its notify messages whenever it needs to, and any if anything's listening, that listener can deal with the changes.

Share this post


Link to post
Share on other sites

This topic is 4871 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this