[MDX] Rendering to multiple controls with different sizes

Started by
1 comment, last by DvDmanDT 17 years, 2 months ago
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?
Advertisement
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 listforeach(Control c in list){    device.BeginScene();    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    device.EndScene();    device.Present(c);    c.Invalidate();}



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

-AJ

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

[Edited by - u235 on January 28, 2007 12:33:05 AM]
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...
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

This topic is closed to new replies.

Advertisement