Chapter 2
Download
1 / 18

Chapter 2 Graphics Programming 24 Jan 20067 - PowerPoint PPT Presentation


  • 311 Views
  • Uploaded on

Chapter 2 Graphics Programming 24 Jan 20067 Sierpinski Gasket pre-Mandelbrot classic found by W. Sierpinski around World War I. generated by recursivly dividing a triangle into four congruent smaller triangles think of the interior triangles as "holes”

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Chapter 2 Graphics Programming 24 Jan 20067' - lotus


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Chapter 2 l.jpg
Chapter 2

  • Graphics Programming

  • 24 Jan 20067


Sierpinski gasket l.jpg
Sierpinski Gasket

  • pre-Mandelbrot classic

    • found by W. Sierpinski around World War I.

    • generated by recursivly dividing a triangle into four congruent smaller triangles

  • think of the interior triangles as "holes”

  • they occupy more and more of the total area, while the "solid" portion becomes as hopelessly fragile


Pseudocode l.jpg
Pseudocode

1. Pick a point at random inside the triangle

2. Select one of the three vertices at random

3. Find a point halfway between the initial point and the randomly selected vertex

4. Display this new point by putting some sort of marker, such as a small circle, at its location

5. Replace the initial point with this new point

6. Return to step 2


Pen plotter l.jpg
Pen Plotter

  • moveto(x,y)

  • lineto(x,y)


Problems with pen plotter model l.jpg
Problems with Pen-Plotter model

  • 3D difficult

    • must convert 3d world to 2d projection explicitly

  • OpenGL allows us to focus on building 3D world and let computer handle projections


Display funtion l.jpg
Display funtion

Check programs online - lectures/chapter1/lab, boat


Coordinate system l.jpg
Coordinate System

3D COORDINATE SYSTEMS

Y

Y

Z

X

X

LEFT HANDED

RIGHT HANDED

Z


Coordinate system in opengl l.jpg
Coordinate System in OpenGL

  • What units are x, y, and z?

    • your choice

    • device independent

    • world coordinate system

  • Before displaying on output device, world coordinates must be converted to device or raster or screen coordinates


Point to remember l.jpg
POINT TO REMEMBER

  • We are studying computer graphics

  • We are not studying OpenGL

    • won’t cover all functions in OpenGL


Graphics system as a black box l.jpg
Graphics System as a Black Box

Function Calls

Output

User

Program

Graphics

System

Input/Output

Devices

Data

Input


Api functions l.jpg
API Functions

  • Primitive Functions

  • Attribute Functions

  • Viewing Functions

  • Transformation Functions

  • Input Functions

  • Control Functions


Opengl what is it l.jpg
OpenGL - What is it?

  • A graphics rendering library

  • API to produce high-quality, color images from geometric and raster primitives

  • Window System and Operating System independent

  • OpenGL “doesn’t do windows”


Opengl l.jpg
OpenGL

  • Most widely adopted graphics standard

  • Introduced in 1992

  • High visual quality and performance

  • Industry standard

  • Stable

  • Reliable and portable

  • Evolving

  • Scalable.

  • Easy to use.

  • Well-documented.


Related apis l.jpg
Related APIs

  • GLU (OpenGL Utility Library)

    • guaranteed to be available

      • tesselators

      • quadrics

      • NURBs, etc.

      • some surprisingly common operations, such as projection transformations (such as gluPerspective)


Related apis16 l.jpg
Related APIs

  • GLX or WGL

    • bridge between window system and OpenGL

  • GLUT

    • portable bridge between window system and OpenGL

    • not “standard”, but uniformly popular


Homework l.jpg
Homework

  • Read Chapter 3

  • Assignment 2 - Program due 01/31/2007

    • Display your scene in 3D. Use at least 5 different graphics primitives.


Glortho gldouble left gldouble right gldouble bottom gldouble top gldouble near gldouble far l.jpg
glOrtho (GLdouble left, GLdouble right, GLdouble, bottom, GLdouble top, GLdouble near, GLdouble far)

  • Creates a viewing volume with a box shape.

  • Direction of projection is parallel to z axis.

  • Viewpoint faces -z axis.

  • glOrtho (0.0, (GLdouble) w, 0.0, (GLdouble) h, -500.0, 500.0);


ad