Jump to content
  • Advertisement
Sign in to follow this  

[MDX] Rendering to multiple controls with different sizes

This topic is 4310 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, how can I render to different controls, when they have different client sizes, without getting the output stretched? Basicly, I would like to submit a Control (or backbuffer dimensions) to BeginScene, but that's not possible. If I send my Control to Present, it obviously gets stretched if my Control doesn't have the same size as the Control I initialized my Device with. Is there an easy way to do what I'm looking for? What is the recommended way?

Share this post

Link to post
Share on other sites
It seems to me that you could make a collection out of all the controls you want to render to and then use a foreach to handle the specifics. Maybe something like:

ArrayList list = new ArrayList(20);

//Add controls to list

foreach(Control c in list)
device.Transform.Projection = Matrix.ProjectionFovLH((float)(Math.PI/4), c.Width / c.Height, 1.0f, 100.0f);
//Render the scene and apply any necessary transforms etc

Hope that helps you out. This untested code, btw, so it may need some tweaking.


[EDIT]I originally typed this.Invalidate vice c.Invalidate[/EDIT]

[Edited by - u235 on January 28, 2007 12:33:05 AM]

Share this post

Link to post
Share on other sites
Accutually, I figured it doesn't matter, all I need to do is set the BackBuffer to some big size (well, bigger than the biggest control), and use the source and destination rects when calling Present(). This works because all rendering so far is orthographic or pretransformed (XYZRHW).

It does feel like a VERY ugly solution though.. I think I've heard something about multiple rendertargets or something like that, although I doubt it helps with what I'm trying to achieve here.. :p

I really appreciate your help, but it doesn't really feel like a solution.. Also, it'll look like crap if the first control (the one I use when creating the device) is alot smaller than another .. :p

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!