window to viewport
play

Window to Viewport CS418 Computer Graphics John C. Hart Graphics - PowerPoint PPT Presentation

Window to Viewport CS418 Computer Graphics John C. Hart Graphics Processing Vertex Fragment Scan Converter Shader Shader Window to Viewport Viewport Coordinates (0,VRES-1) (HRES-1,VRES-1) Physical per-pixel integer coordinates


  1. Window to Viewport CS418 Computer Graphics John C. Hart

  2. Graphics Processing Vertex Fragment Scan Converter Shader Shader Window to Viewport

  3. Viewport Coordinates (0,VRES-1) (HRES-1,VRES-1) • Physical per-pixel integer coordinates • Also called screen or device coordinates gl.viewport(x,y,w,h) • x,y – lower left pixel • w – width • h – height • Sometimes (0,0) is in the upper left corner (e.g. for mouse input) (0,0) (HRES-1,0)

  4. Window Coordinates (-1,1) (1,1) • Logical, mathematical floating-point coordinates • WebGL defaults to a window extending from (-1,-1) to (1,1) • This is the normalized (0,0) coordinate system you would use to plot an equation – Origin at the middle – All four quadrants (-1,-1) (1,-1)

  5. Window to Viewport (-1,1) (1,1) • Translate lower-left corner of window (-1,-1) to the lower-left corner of viewport (0,0) (0,0) (-1,-1) (1,-1)

  6. Window to Viewport (0,2) (2,2) • Translate lower-left corner of window (-1,-1) to the lower-left corner of viewport (0,0) 1 1 1 1 1 (1,1) (0,0) (2,0)

  7. Window to Viewport (0,VRES-1) (HRES-1,VRES-1) • Translate lower-left corner of window (-1,-1) to the lower-left corner of viewport (0,0) 1 1 1 1 1 • Scale upper-right corner from (2,2) to upper-right corner of viewport (HRES-1) 2 (VRES-1) 2 1 (0,0) (HRES-1,0)

  8. Window to Viewport (HRES-1) (HRES-1) (HRES-1) 1 1 2 2 2 (VRES-1) = (VRES-1) (VRES-1) 1 1 2 2 2 1 1 1

  9. Graphics Processing Vertex Fragment Scan Converter Shader Shader (HRES-1) (HRES-1) 2 2 (VRES-1) (VRES-1) 2 2 1

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend