1 / 26

Computer Graphics in Game programming

Computer Graphics in Game programming. Basics. OpenGL. “Hello world” . George Georgiev. Telerik Corporation. www.telerik.com. Table of Contents. Computer graphics 2D 2.5D 3D 3D Graphics Libraries OpenGL Introduction to OpenGL Setting up OpenGL “Hello World”. Computer graphics.

vito
Download Presentation

Computer Graphics in Game programming

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. Computer Graphics in Game programming Basics. OpenGL. “Hello world” George Georgiev Telerik Corporation www.telerik.com

  2. Table of Contents • Computer graphics • 2D • 2.5D • 3D • 3D Graphics Libraries • OpenGL • Introduction to OpenGL • Setting up OpenGL • “Hello World”

  3. Computer graphics Types, Geometry, Libraries

  4. Computer graphics • Computer graphics are • Representation of image data • 2 types – 2D and 3D • Computation-heavy • Closely related to computer geometry • Basic terminology • Primitives • Transformations • Interpolation

  5. Computer graphics • 2-Dimensional (2D) graphics • Space is planar • Units – usually pixels • Use 2D geometry • Drawing order matters • Image files are essential • Pseudo 3-D (2.5D) graphics • Contain per-object depth information • Use oblique projections of 2D objects

  6. Computer graphics • 3-Dimensional (3D) graphics • Provide depth information • Units – whatever you like • Use both 3D and 2D geometry • Drawing order DOESN’Tmatter • except for transparency • Lighting and texturing are essential • Model files are essential

  7. 2D Game Graphics Basics, Common practices

  8. 2D Game Graphics • Primitives • Pixels • Images (textures) • Geometry – Dots, Lines, Triangles (rarely used) • Objects (sprites) • Groups of pixels • Images with transparency • Geometry meshes

  9. 2D Game Graphics • Transformations • Translation • ‘Mirroring’ • Rotation (only for ‘geometry’ sprites) • Scaling (only for ‘geometry’ sprites)

  10. 2D Game Graphics • Coloring • Per-pixel • Per-vertex (‘geometry’ sprites) • Animation • Image sequences

  11. 2D Game Graphics • Rendering process • Create a color buffer (usually a matrix with the screen resolution as dimensions) • Render the background to the buffer • Render the foreground to the buffer • Draw the color buffer to the screen

  12. 2.5D Game Graphics Basics, Common practices

  13. 2.5D Game Graphics • Primitives • Images (textures) • Objects (sprites) • Multiple images, one for each object orientation

  14. 2.5D Game Graphics • Transformations • Translation • ‘Mirroring’ (not often) • Oblique projection (pre-rendered) • Coloring • Per-pixel • Animation • Image sequences

  15. 2.5D Example

  16. 3D Game Graphics Finally…

  17. 3D Game Graphics • Primitives • Geometry – Vertices, Lines, Triangles • Objects (sprites) • Geometry meshes • Triangles (solid) • Lines (wireframe) • Vertices (‘constellations’)

  18. 3D Game Graphics • Transformations • Translation • Rotation • Scaling • Uniform • Non-uniform • Projection • Parallel (mainly orthogonal) • Perspective

  19. 3D Game Graphics • Coloring & Transparency • Per-vertex • Drawing order matters for transparency! • Transparent objects are drawn after opaque ones • Lighting • Per-vertex • Essential • Texturing

  20. 3D Game Graphics • Perspective viewing • Elements • Eye position • View angle • Near clipping plane • Far clipping plane

  21. 3D Game Graphics • Eye position • Usually called camera position • Represents the user’s viewing position • View angle • The camera’s “lens width” • Represents the user’s vision capabilities • 60 or 45 degrees are most commonly used • The larger the view angle, the larger the view volume

  22. 3D Game Graphics • Near clipping plane • The nearest visible distance • Represents the display • Far clipping plane • The farthest visible distance • Objects behind it are not rendered

  23. 3D Game Graphics – view volume • The “Frustum” • The view volume, clipped by • The near clipping plane • The far clipping plane • Contains the visible objects • Visible objects are projected on the near clipping plane

  24. 3D Game Graphics • Rendering process • Create depth and color buffers (matrices with the screen resolution’s dimensions) • Project objects’ vertices on the near clipping plane • Fill depth buffer (interpolating vertices depth) • Clip overlapping objects’ faces (using depth buffer) • Interpolate colors and render color buffer

  25. 3D Game Graphics • Rendering 3D graphics to a 2D screen is a very complicated task • Computation-heavy • Knowledge-heavy • That’s why we use 3D graphics libraries • OpenGL • Direct3D • Nvidia Cuda

  26. Comuputer Graphics in Game programming ? ? Questions? ? ? ? ? ? ? ? ? ?

More Related