Note that there are some explanatory texts on larger screens.

plurals
  1. POVideo cut in half vertically XNA4 vs2012
    text
    copied!<p>I loaded in a video in my XNA project and I got it to play. The only problem is it's cut in half vertically. The size of the video is 800x600 and the game is 800x600 as well. At first I accidently put a 640x480 version of the video in my Content but then I fixed it to 800x600. That didn't fix the 1/2 vertical though. I thought maybe the 640x480 xnb was still there and was being loaded. I tried looking for it and deleted whatever I thought was relate, but that didn't work as well. Here's a screenshot of the video in half. </p> <p><img src="https://i.stack.imgur.com/z3Tho.png" alt="enter image description here"></p> <p>Here's my code:</p> <pre><code> namespace Bloxel { /// &lt;summary&gt; /// This is the main type for your game /// &lt;/summary&gt; public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; public int WIDTH = 800; public int HEIGHT = 600; Video splash; VideoPlayer player; Texture2D videoTexture; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = WIDTH; graphics.PreferredBackBufferHeight = HEIGHT; graphics.ApplyChanges(); } /// &lt;summary&gt; /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// &lt;/summary&gt; protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); } /// &lt;summary&gt; /// LoadContent will be called once per game and is the place to load /// all of your content. /// &lt;/summary&gt; protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); splash = Content.Load&lt;Video&gt;("splash"); player = new VideoPlayer(); } /// &lt;summary&gt; /// UnloadContent will be called once per game and is the place to unload /// all content. /// &lt;/summary&gt; protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } /// &lt;summary&gt; /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// &lt;/summary&gt; /// &lt;param name="gameTime"&gt;Provides a snapshot of timing values.&lt;/param&gt; protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); if (player.State == MediaState.Stopped) { player.IsLooped = false; player.Play(splash); } base.Update(gameTime); } /// &lt;summary&gt; /// This is called when the game should draw itself. /// &lt;/summary&gt; /// &lt;param name="gameTime"&gt;Provides a snapshot of timing values.&lt;/param&gt; protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); if (player.State != MediaState.Stopped) videoTexture = player.GetTexture(); Rectangle screen = new Rectangle(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); if (videoTexture != null) { spriteBatch.Begin(); spriteBatch.Draw(videoTexture, screen, Color.White); spriteBatch.End(); } base.Draw(gameTime); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload