Project 1: Into Space! CG Concepts Needed

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Part I: Basics of Computer Graphics Viewing Transformation and Coordinate Systems Chapter
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 5: Viewing
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
Macromedia Flash MX 2004 – Design Professional Macromedia Flash MX DRAWING IN.
OpenGL (II). How to Draw a 3-D object on Screen?
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Picking. What is picking? Selecting an object on the screen What does this require? –Get Mouse Location –Compute what objects are rendered at the position.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Week 2 - Wednesday CS361.
2D Graphics: Rendering Details
Korea University Korea University Computer Graphics Laboratory Computer Graphics Laboratory Jung Lee, Chapter 13.
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
1 Figures are extracted from Angel's book (ISBN x) The Human Visual System vs The Pinhole camera Human Visual System Visible Spectrum Pinhole.
Computing & Information Sciences Kansas State University Lecture 20 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 21 of 42 William H. Hsu.
Geometry: 2-D Transformations Course web page: Chapter #3.
1 Better Interactive Programs. 2 Objectives Learn to build more sophisticated interactive programs using ­Picking Select objects from the display Three.
Transformational Geometry CS418 Computer Graphics John C. Hart.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Viewing CS418 Computer Graphics John C. Hart. Graphics Pipeline Homogeneous Divide Model Coords Model Xform World Coords Viewing Xform Still Clip Coords.
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
Digital Media Dr. Jim Rowan ITEC So far… We have compared bitmapped graphics and vector graphics We have discussed bitmapped images, some file formats.
MAE152 Computer Graphics for Scientists and Engineers Fall 03 Display Lists.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
1 Graphics CSCI 343, Fall 2015 Lecture 6 Viewing, Animation, User Interface.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
Digital Media Lecture 5: Vector Graphics Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
Introduction to Graphics Programming. Graphics API.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
2.01 Understand Digital Raster Graphics
The Human Visual System vs The Pinhole camera
- Introduction - Graphics Pipeline
In the name of God Computer Graphics.
Computer Graphics and Visualization (06 CS 65)
Transformations Introduction to Computer Graphics and Animation
Adobe Flash Professional CS5 – Illustrated
Introduction to the Mouse
Chapter 3 Drawing In the World.
Graphics Fundamentals
Better Interactive Programs
2D Viewing Pipeline.
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
2.01 Understand Digital Raster Graphics
CS451Real-time Rendering Pipeline
Line and Character Attributes 2-D Transformation
Real-time Computer Graphics Overview
Chapter 5 Working with Images
WINDOWING AND CLIPPING
Digital Media Dr. Jim Rowan ITEC 2110.
Chapter Lessons Use the Macromedia Flash drawing tools
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Display Lists & Text Glenn G. Chappell
Better Interactive Programs
WINDOWING AND CLIPPING
Programming with OpenGL Part 2: Complete Programs
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Computer Graphics 3Practical Lesson
Window to Viewport Transformations
CS297 Graphics with Java and OpenGL
2.01 Understand Digital Raster Graphics
2.01 Understand Digital Raster Graphics
Hierarchical Modeling
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Presentation transcript:

Project 1: Into Space! CG Concepts Needed Introduction to Computer Graphics CSE 470 Arizona State University Dianne Hansford

What you’ll find here … Transformation order in OGL Viewports ObjectWorldViewportWindow Bitmapped Fonts Display lists Push/Pop Attributes

Transformations in OGL Given: a unit square centered at the origin Write: OGL code that 1) translates by one unit in x, and then 2) rotates by 90 degrees Solution: glRotatef(90.0, 0.0, 0.0, 1.0); glTranslatef(1.0, 0.0, 0.0); drawsquare(); glFlush(); The point: specify OGL commands in opposite order of occurance. In matrix notation: v’ = I R T v RedBook: see Ch 3 Modeling sections we’ll discuss how T gets in a matrix later!

Viewports Defines a rectangular region in window for drawing Example: Powerpoint slide edit viewport, slide layout viewport, slides overview viewport. Example: Spacecraft control viewport and space viewport window viewports

Viewports glViewport(x, y, width, height) Parameters in terms of pixels Keep in mind that the windowing system returns [x,y] relative to the origin at the upper-left corner, but the viewport is defined relative to the origin at the lower-left corner. height x y width -- when ready to draw, set the appropriate viewport -- aspect ratio of viewport (should =) aspect ratio of ortho2D -- when window resized, must resize viewport

Coordinate Systems Object  World  Viewport  Window Input geometry: e.g. star vertices created at origin local coords space or spacecraft scene global coords portion of window you’ll draw to input geometry should be transformed (translate, rotate, scale) to live in your world window to viewport to world transformation needed

Bitmapped Fonts set position glRasterPos2f(x, y); (in world coordinates) create character glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, ‘H’); you can find more fonts in glut.h Next: Display lists are a good way to use fonts. For 2D bitmapped fonts ok. For 3D stroke fonts might be better – can scale and rotate

Display Lists Rendering modes: immediate and retained immediate: -- sample programs we did so far -- primitives down pipeline then no longer in system (on screen) -- primitives generated with each redraw -- can be slow for complex scene or in client/server environment retained: -- primitives (polygons...) and states (color..) stored as an object in a display list -- internal format makes them fast for display; cached -- good for redrawing geometry multiple times -- good for fast redraw of a complex object/scene

Display Lists Define a single display list: #define SQUARE glNewList(SQUARE, GL_COMPILE); glPushAttrib(GL_CURRENT_BIT); glColor3f(1, 0, 0); glRectf(0, 0, 1, 1); glPopAttrib(); glEndList(); Draw this display list glCallList(SQUARE); see next topic: Attributes forming of display list called compiling it RedBook: See Ch 7

Multiple Display Lists When working with many display lists for example: text the multiple list utilities are nice find the starting point for 256 consecutive, free integers for DL font_base = glGenLists(256); for(i=0; i < 256; i++) { glNewList(base + i, GL_COMPILE); glutBitMapCharacter(GLUT_BITMAP…., i); glEndList(); } … char *text; glListBase(font_base); glCallLists( (GLint) strlen(text), GL_UNSIGNED_BYTE, text); start accessing DL from base

Attribute Groups State variables are grouped see chapter 2 “Attribute Groups” for a list Example: all line characteristics (width, stipple, pattern, …) in GL_LINE_BIT Example from display list slide: glPushAttrib(GL_CURRENT_BIT); glColor3f(1, 0, 0); glRectf(0, 0, 1, 1); glPopAttrib(); > save current state > change the color and draw > restore the state as it was