1 / 15

CS450 – Lect. 2 & 3

CS450 – Lect. 2 & 3. Figures and such. Pinhole camera model. Imaging with pinhole camera. Clipping Window. Camera Specification. Position Orientation Focal length Film size (field of view). Sepinski Gasket. Recursively Subdivided Triangle Approach 1 : Pen-Plotter

Download Presentation

CS450 – Lect. 2 & 3

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. CS450 – Lect. 2 & 3 Figures and such

  2. Pinhole camera model

  3. Imaging with pinhole camera

  4. Clipping Window

  5. Camera Specification • Position • Orientation • Focal length • Film size • (field of view)

  6. Sepinski Gasket • Recursively Subdivided Triangle • Approach 1 : Pen-Plotter • Calculate 2-D vertex projection points • Use moveto(x,y) & lineto(x,y) to draw triangles • Apprach 2 : OpenGL, etc. • Specify 3-D vertex positions of object • Specify camera model • System projects lines into 2-D and renders

  7. OpenGL Types • Definitions found in gl.h and glu.h // samples … #define Glint int #define GLfloat float

  8. Defining Vertices • Coordinate systems • World Coordinates (3-D) • Real numbers and any scale we desire • Device & Screen Coordinates • Integer positions of pixels • Functions that define 2-D & 3-D vertices • glVertex2i(Glint x, Glint y) • glVertex3f(GLfloat x, GLfloat y, GLfloat z) • glVertex3fv(vertex) // vertex[3] contains x,y,z • Etc …

  9. Defining an Object Face (shape) • Geometric objects are specified by a sequence of vertices between begin and end function calls • Example: // line segment in 2-D from (x1,y1) to (x2,y2) glBegin(GL_LINES); glVertex2f(x1,y1); glVertex2f(x2,y2); glEnd();

  10. OpenGL API Basics • Primitive Functions • Define WHAT (points, line segments, text, …) • Attribute Functions • Define HOW (color, texture, typeface, …) • Viewing Functions • Define CAMERA (location, orientation, clipping, focal length, …) • Transformation Functions • Object MODIFICATION (translation, rotation, scaling, …) • Input Functions • INPUTS (mouse, keyboard, trackball, …) • Control Functions • OpSys interaction (window management, error handling, …)

  11. Function Naming • OpenGL • gl*() • Graphics Utility Functions • glu*() • GL Utility Toolkit (GLUT) • glut*() • #include <GL/glut.h>

  12. Object Types • GL_LINES // each pair of vertices defines a lines • GL_LINE_STRIP // connected sequence of lines • GL_POLYGON // connected line seq. looping back to start • Must be simple, flat & convex to render correctly • GL_TRIANGLES // each triplet forms triangle • GL_QUADS // each quad of vertices forms quadrangle • GL_TRIANGLE_STRIP //each triplet forms a triangle • GL_QUAD_STRIP // each new vertex pair used with previous pair • GL_TRIANGLE_FAN // each vertex used with previous pair // general format of object definition glBegin( object_type ); glVertex*( … ); glVertex*( … ); … glEnd();

  13. Color • Use RGB (additive) color model • Amount of Red, Green & Blue is specified as a value in the range 0.0 … 1.0 • Examples: // to set the current color glColor3f(R,G,B); // to set the clearing (background) color glClearColor(R,G,B,1.0); // the 4th value is opacity 0.0 .. 1.0 // to actually clear the display window glClear();

  14. Viewing • Viewing (Clipping) Rectangle • Defines portion of world seeable from camera • Viewing Volume • Defines volume of world that is seeable • Viewing rectangle is the FRONT face of the viewing volume

  15. Projections • Orthographic (parallel) • Specifying the viewing volume gluOrtho(left,right,bottom,top,near,far) gluOrtho2D(left,right,bottom,top) • Perspective

More Related