1 / 15

Basics of Graphics

Basics of Graphics. Basics of Graphics. (4,0). (0,0). Pixels: “ dots ” that make up a picture Resolution: number of pixels in the whole picture (1024 x 768) Coordinates: pixel positions. (3,4). (0,3). Positioning. Remember that (0,0) is the upper left corner. Textels.

tate-carver
Download Presentation

Basics of Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basics of Graphics

  2. Basics of Graphics (4,0) (0,0) • Pixels: “dots” that make up a picture • Resolution: number of pixels in the whole picture (1024 x 768) • Coordinates: pixel positions (3,4) (0,3)

  3. Positioning • Remember that (0,0) is the upper left corner

  4. Textels • Coordinate value inside the texture (image) (0,0) (200,0) (0,0) (100,0)

  5. Color Model • Primary colors: red, blue, green • Subtractive color model: Absence of all colors is white. (medium: ink, paint) • Additive color model: Adding all colors together creates white. (medium: light) • RGB color model: additive model of red, green, and blue light • Bit depth: number of distinct colors allowed • Humans can see 10 million colors, so 24-bit color is ideal.

  6. Video Hardware • 2 parts: monitor & video card • Video card: memory cache for monitor • Pixels on monitor are points of light, so they fade away after a few milliseconds. • Monitor refreshes the scene continuously • Refresh rate: number of redraws per second (75-85 Hz)

  7. Images • Transparency • Opaque • Transparent • Translucent

  8. Images File Formats • Vector: describes image geometrically • Can be resized without degradation • Not supported • Raster: describes image by pixels • GIF: opaque or transparent, 8-bits of color, high compression • PNG: any transparency, up to 24 bit color, same compression as GIFs • JPEG: opaque, 24-bit only, better compression rate for photos • XNA Proprietary Format ????

  9. XNA Basics • Program.cs – like Main, main entry point • Game1.cs – rename it! This is the main game driver • Content folder – for images and sounds • using statements – C# for “import” (copy XNA ones into new classes) • namespace – C# for “package” • colon is used for “extends”

  10. Game Framework • Constructor • Initialize • Load/Unload Content • Update • Draw • Update/Draw usually based on time

  11. New classes • Right-click on main folder, choose Add, then New Item • Choose class, and re-name the class before clicking “Add”

  12. Content • Right-click on Content folder, choose New… Existing Item. Choose the kind of item you want and then browse for it. • Works for images and sounds • Stores as XNA Proprietary formats • Refer to content by their asset names (in the property window) • In LoadContent()… • Content.Load<Texture2D>(“imageName”); • Content.Load<SoundEffect>(“sound”);

  13. SpriteBatch • Do the drawing in XNA • spriteBatch.Begin(); • spriteBatch.Draw… (many overloads) • spriteBatch.End();

  14. GraphicsDeviceManager • Gives access to screen properties graphics.PreferredBackBufferWidth graphics.IsFullScreen = true;

  15. Finally… • Don’t put too much in Game1. • Use your OO techniques! • Make a disco ball and a bouncing guy.

More Related