Class 10 Part 1 What values to use for Frustum The Trick

Slides:



Advertisements
Similar presentations
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
Advertisements

Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 4.
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
Objectives Learn to build arbitrary transformation matrices from simple transformations Learn to build arbitrary transformation matrices from simple transformations.
OpenGL 3D and Animation for Simulating a Solar System
OpenGL (II). How to Draw a 3-D object on Screen?
OpenGL Matrices and Transformations Angel, Chapter 3 slides from AW, Red Book, etc. CSCI 6360.
The Viewing Pipeline (Chapter 4) 5/26/ Overview OpenGL viewing pipeline: OpenGL viewing pipeline: – Modelview matrix – Projection matrix Parallel.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Project 6 Tumbling Cube Fri, Nov 21, 2003 Due Mon, Dec 8, 2003.
Modeling with OpenGL Practice with OpenGL transformations.
1.2: Transformations G-CO.6 Use geometric descriptions of rigid motions to transform figures and to predict the effect of a given rigid motion on a given.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Advanced Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 31, 2003.
Transformations Tutorial
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
Viewing and Transformation. Pixel pipeline Vertex pipeline Course Map Transformation & Lighting Primitive assembly Viewport culling & clipping Texture.
Chap 3 Viewing and Transformation
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
CS559: Computer Graphics Lecture 12: OpenGL - Transformation Li Zhang Spring 2008.
 The terms LMB, MMB, RMB, and mouse wheel (MW).
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 17 Animations, Loops.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
TA: Ryan Freedman Sushma Kini Chi Zhou.  Due Date: March , 12:30 PM  We want a zip folder named cs418_mp1_{netid}.zip which contains  Source.
OpenGL LAB III.
The Modelview Stack Lecture 9 Wed, Sep 12, The Modelview Stack OpenGL maintains a stack of matrices. The matrix on top of the stack is the current.
OpenGL Matrices and Transformations Angel, Chapter 3 slides from AW, Red Book, etc. CSCI 6360/4360.
ENGINEERING 1D04 Tutorial 4. What are we doing today? Focus Functions Scope of Variables Returning Values Objects Graphics library Aliasing Events Mouse.
Under the direction of Susan Rodger
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Introduction of OpenGL - 3D Graphic and Animation
- Introduction - Graphics Pipeline
Transformations Introduction to Computer Graphics and Animation
CSE 167 [Win 17], Lecture 5: Viewing Ravi Ramamoorthi
Transformations By: Christina Chaidez Math 1351.
Computer Graphics CC416 Week 15 3D Graphics.
2D Imaging and Transformation
Summary of Properties of 3D Affine Transformations
3D Transformation.
Graphics Fundamentals
Transformation and Viewing
CS451Real-time Rendering Pipeline
COORDINATE PLANE The plane containing the "x" axis and "y" axis.
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Class 11 timers Iron Maiden example Double Buffering BallAndTorus
Class 10 Part 1 What values to use for Frustum The Trick
Lesson: 10 – 8 Equations of Circles
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Chapters 5/4 part2 understanding transformations working with matrices
Class 12 Complex object with moving parts
Making Procedural Methods
MATH 8 – UNIT 1 REVIEW.
Projection in 3-D Glenn G. Chappell
in Statistical Physics
The Modelview Matrix Lecture 8 Mon, Sep 10, 2007.
Input and Interaction Ed Angel
Geometric Transformations
University of New Mexico
Input and Interaction Ed Angel
Trick Words Level 1 Press space bar to begin and then again after student has read each word.
Transformations Dilations Translations Reflections Rotations.
Class 12 idle function timers Iron Maiden example Double Buffering
3D Modelling Workshop By Keith Phelan!.
Making an Ice Cream Cone
Hierarchical Modeling
Transformations Project
Preview of 3-D Graphics Glenn G. Chappell
Projections.
Presentation transcript:

Class 10 Part 1 What values to use for Frustum The Trick Relative vs Absolute Placement glPushMatrix glPopMatrix Animation glutIdleFunc(increaseAngle) glutTimerFunc Double Buffering Iron Maiden example BallAndTorus

What values to use for glFrustum? Uses glFrustum(-5.0,5.0,-5.0,5.0,5.0,100.) Picture translated to z=-25

-far ?? ? z right -near

-far ?? far = ?? near right far * right= ?? near ? z |z| * right= ? near right -near

-far ?? 25 * 5 = 25 5 ? z |z| * right= ? near right -near

The Trick - rotating about a general line MJBrotateOffCenter.cpp glRect(x1,y1,x2,y2) draws a rectangle, not at the origin. What if we want to rotate it about its center? The TRICK: move to the origin, rotate, move back.

Relative vs Absolute Placement Case 1: put cube 5 to the right, put sphere 10 above it.(relative) Case 2: put cube 5 to the right, put sphere 10 above the origin. (absolute) MJBrelativeVSabsolute.cpp

Relative: Prop 4.1 "If object 1 precedes object 2 in the code, the location of object 2 in the local coordinate system of object 1 is determined by the transformation statements between the two and nothing else." See relative code

glPushMatrix(), glPopMatrix glLoadIdentity(); glTranslatef(0.0, 0.0, -15.0); glPushMatrix(); glTranslatef(15.0,0.0,0.0); glutWireCube(5.0); glPopMatrix(); glTranslatef(0.0,10.0,0.0); glutWireSphere(4.0,10,10); I*M1=M1 M1 M1*M2=N2 M1 M1 M1*M3=N3

Animation The WRONG way: In the display function: for (a lot times) redraw the picture with a minor change Doesn't allow for interaction. May not even be redrawn

rotatingHelix1.cpp press space increase angle redraw (once) with the updated angle

rotatingHelix2.cpp press space glutIdleFunc(increaseAngle); or glutIdleFunc(NULL); registered Idle function: Keep doing that function as long as nothing else is happening. increaseAngle() says add to the angle and redraw (once).

glutIdleFunc(f); registers the function to use while idle. NULL for don't do anything. void f(void); Note functions can be "registered" outside of main, and the registered functions can change.

rotatingHelix3.cpp draw picture once get on line in the event queue for another turn to add to angle get on line in the event queue ... got to here

glutTimerFunc(period, timerFunction, value) put the timerFunction on the event queue period milliseconds from now. void timerFunction(int value); value, an input value that will be passed to the timerFunction value is often not needed so is set to anything.

using a timer Main starts the timer function glutTimerFunc(5, animate, 1); run the function animate in 5 millisecs. Have timer function call itself, ie, get in queue again. At the end of animate have the call glutTimerFunc(animationPeriod, animate, 1);

Go through all of rotatingHelix3.cpp to see how whole process works.

Double Buffering front buffer = viewable buffer back buffer = drawable buffer Two ring circus: spotlight on one ring : viewable in the dark, set up the next act in other ring : drawable

Double Buffering - how to In main, glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); instead of GLUT_SINGLE Can have one window double buffered and the other single. at end of display function use glutSwapBuffers(); instead of glFlush();

Iron maiden example maiden project Nate Robbins gets credit. (Check out, but don't copy, his tutorials.)

ballAndTorus.cpp run it.

the Torus glutWireTorus(2.0, 12.0, 20, 20); center is the origin.

the Sphere glutWireSphere(2.0, 10, 10); radius 2 center at the origin

ballAndTorus.cpp

move the sphere to the right, outside the torus glTranslatef(20.0, 0.0, 0.0); glutWireSphere(2.0, 10, 10);

rotate sphere about one spot on the torus (revolve about the torus) "latitudinal rotation" about the line through (12,0,0), parallel to the y axis in a circle of radius 8. on the xz plane. The TRICK glTranslatef(12.0, 0.0, 0.0); glRotatef(latAngle, 0.0, 1.0, 0.0); glTranslatef(-12.0, 0.0, 0.0);

move the sphere in big circle about the torus "longitudinal rotation" about the line through (0,0,1), parallel to the z axis in a circle of radius 20. on the xy plane. glRotatef(longAngle, 0.0, 0.0, 1.0);

spiral motion about the torus combine the two motions.