Jump to content
  • Advertisement
Sign in to follow this  
dazscott

fullscreen render prob

This topic is 4833 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'm working on a strategy game and up until now I have been just rendering in windowed mode(for ease of debugging), the graphics are scaled to the window and change relative to the size of the window. I have been experimenting with fullscreen rendering (code from a tom miller book) but the scale of the rendered meshes and the sprite are way off. ie. windowed
fullscreen this is the code I was using for window mode
// Set our presentation parameters
			PresentParameters presentParams = new PresentParameters();


			presentParams.SwapEffect = SwapEffect.Discard;

			Format current = Manager.Adapters[0].CurrentDisplayMode.Format;//*
			presentParams.AutoDepthStencilFormat = DepthFormat.D16;
			presentParams.EnableAutoDepthStencil = true;
			

				presentParams.Windowed = true;
			}
and this is what I’m using at the moment
// Set our presentation parameters
			PresentParameters presentParams = new PresentParameters();


			presentParams.SwapEffect = SwapEffect.Discard;

			Format current = Manager.Adapters[0].CurrentDisplayMode.Format;//*
			presentParams.AutoDepthStencilFormat = DepthFormat.D16;
			presentParams.EnableAutoDepthStencil = true;
			
			if(Manager.CheckDeviceType(0,DeviceType.Hardware, current, current, false))
			{

				presentParams.Windowed = false;
				presentParams.BackBufferFormat = current;
				presentParams.BackBufferCount = 1;
				presentParams.BackBufferWidth = ScreenWidth;
				presentParams.BackBufferHeight = ScreenHeight;
				presentParams.DeviceWindow = this.targetControl;
				presentParams.BackBufferFormat = Format.X8R8G8B8;
				presentParams.PresentationInterval = PresentInterval.Default;
				
			}
			else
			{
				presentParams.Windowed = true;
			}
			
		
			// Create device
			device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
			
			// Hook the device reset event
			device.DeviceReset += new EventHandler(this.OnDeviceReset);
			this.OnDeviceReset(device, null);
thanks for any light shed on this.

Share this post


Link to post
Share on other sites
Advertisement
It seems you have a problem with the scaling and/or positioning code rater than with the device creation. Are you using some kind of resolution dependent scaling that breaks when the resolution is changed for some reason?

Remember that Managed DX automatically resizes your scene in windowed mode if the window changes size, unlike regular DX which streches the scene to fit the window. Could this be the cause of your problem, if the windowed scene actually have been resized without you knowing so?

Share this post


Link to post
Share on other sites
thanks for pointing that out, the scene in windowed mode was being resized automatically. Anyway, I have it looking ok in fullscreen now that I made a few adjustments, and I can easily switch between both windowed and fullscreen.

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!