fullscreen render prob

Started by
1 comment, last by dazscott 18 years, 8 months ago
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.
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?
Hack my projects! Oh Yeah! Use an SVN client to check them out.BlockStacker
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.

This topic is closed to new replies.

Advertisement