SlideShare a Scribd company logo
1 of 37
Download to read offline
2D Viewing & simple
                     animation
                            Chen Jing-Fung (2006/11/30)
                             Assistant Research Fellow,
                                Digital Media Center,
                          National Taiwan Normal University



                                       Video Processing Lab
                                             臺灣師範大學數位媒體中心視訊處理研究室

                                           National Taiwan Normal University
Ch6 & 11: Computer Graphics with OpenGL 3th, Hearn Baker
2D view -> animation

• What is view?
• How to view?
  – Viewing region
  – Viewing transformation
  – Vision window vs. image
• What is animation?
  – How to construct?
  – Related to viewing region



                              Video Processing Lab   2
                                 臺灣師範大學數位媒體中心視訊處理研究室
View about output device

• Graphics package allows a user to
  specify the part of a picture
  – One device:
    • Display the part of a defined picture
  – Many devices
    • Which display device is to be placed by that
      part (where?)



                          Video Processing Lab       3
                             臺灣師範大學數位媒體中心視訊處理研究室
View region

• A view is selected by specifying a region
  – To select a region or several regions (an
    animated panning sequence across a scene)
  – Who view? User or camera…
  – Where? Specified areas of the device
    coordinates (Ex: xy plane)
  – Viewing transformations involve translation,
    rotation and scaling operations
     • Or deleting some parts about the limits of outside




                               Video Processing Lab         4
                                  臺灣師範大學數位媒體中心視訊處理研究室
Coordinate
                    representations
                           Viewing & Projection
                               Coordinates

                                  1       1
    Modeling          Transformation : 1                       Video Monitor
(local or master)   Coordinates & Viewing
   Coordinates
                                                                 Plotter
                      World           Normalized
                    (Cartesian)       Coordinates
                    Coordinates
                                                              Other Output

                                                                 Device
                                                               Coordinates
                                              Video Processing Lab             5
                                                 臺灣師範大學數位媒體中心視訊處理研究室
2D viewing-
 transformation pipeline
• Modeling-coordinate
  – User construct scene (or object) by world-coordinate
• Transformation
  – World coordinates <=> Viewing coordinates
  – Viewing coordinates to normalize
     • reshape(): glMatrixMode(GL_PROJECTION),
       glLoadIdentify(), gluOrtho2D()…
• Output device show
  – Map normalized coordinates to device coordinates
     • reshape(): viewport()




                               Video Processing Lab        6
                                  臺灣師範大學數位媒體中心視訊處理研究室
Two different Viewports
• Why do viewing transformation?
  – zoom in the green region (or zoom out)
     • Viewing-coordinate (reference frame) is from
       specifying the clipping window
                       Clipping window
                                          Normalization viewport




       World coordinates       Viewing coordinates


                               Video Processing Lab            7
                                  臺灣師範大學數位媒體中心視訊處理研究室
OpenGL viewport function

• glViewport (xvmin, yvmin, vpWidth, vpHeight);
   – Position: (xvmin,yvmin)
      • Low-left corner of the viewport                    vpHeight

   – Viewport size                                     vpWidth

      • Width=vpWidth, Height=vpHeight    (xvmin, yvmin)

• Not invoke the glViewport() function
   – Default: viewport size (position) = display
     window size (position)



                                Video Processing Lab              8
                                   臺灣師範大學數位媒體中心視訊處理研究室
Viewport: Split-screen
                                           Origin
• Split display window
  – Two viewport: Up & down                            600

• Object                                         300

  – Origin & rotate 90o            10.0
                             5.0
• Zoom in the object size
• Result


                          Video Processing Lab               9
                             臺灣師範大學數位媒體中心視訊處理研究室
Viewport Example
• Initial set
   – glMatrixMode (GL_PROJECTION);
   – gluOrtho2D (x1, y1, x2, y2); // Normalization (central or corner)
   – glMatrixMode (GL_MODELVIEW);

• Display
   – wcPt2D verts [2] //object         10.0
                                    5.0
   – glViewport (); //set viewport: lower-left point(0,0) size(300, 300)
   – rent (verts); //draw object

   – glViewport (); //set up viewport
   – glRotatef(angle, x, y, z); //rotate 900 about z axis
   – rent (verts);       //draw object

                    •Result: demo


                                      Video Processing Lab                 10
                                         臺灣師範大學數位媒體中心視訊處理研究室
Real case about split
         monitor
• This case is used four sub-monitors
  to obverse more player how to bite




       Practice the split window function …
                               Video Processing Lab   11
                                  臺灣師範大學數位媒體中心視訊處理研究室
Multiple display windows




                            Video Processing Lab   12
http://www.microsoft.com/      臺灣師範大學數位媒體中心視訊處理研究室
Glut display window
• Multiple display windows can be created for an
  application
   – Create One window must be assigned one ID
      • windowID = glutCreateWindow (“name”)
   – Delete a display window
      • glutDestroyWindow (windowID)
   – Current display window (not change current window)
      • glutSetWindow (windowID)
   – Query the window
      • currentWindowID = glutGetWindow () //if value=0 => no
        window




                                   Video Processing Lab         13
                                      臺灣師範大學數位媒體中心視訊處理研究室
Managing Multiple GLUT
    display windows
• Window icon: glutIconifyWindow ()
   – Convert the windowcurrent to an icon
      • small picture or symbol
   – Use to represent the window
   – Icon name is as same as the window.
      • Change icon’s name
           glutSetIconTitle(“new name”)
      • Change window’s name
           glutSetWindowTitle(“new name”)



                                  Video Processing Lab   14
                                     臺灣師範大學數位媒體中心視訊處理研究室
Windows operators
• Change display windows order
  – The window is to be in front of all other
    windows
       glutSetWindow (windowID)
       glutPopWindow ()
  – Push the window to the back
       glutSetWindow (windowID)
       glutPushWindow()
  – Take off the current window
       glutHideWindow()
  – Return a “hidden” display window
       glutShowWindow()


                           Video Processing Lab   15
                              臺灣師範大學數位媒體中心視訊處理研究室
One window & Multi-
         windows
• Describe what is to be displayed in the current
  display window
   – glutDisplayFunc (pictureDescrip)
      • pictureDescrip: usually contains the OpenGL primitives and
        attributes
      • After glutPopWindow()
• glutPostRedisplay ()
   – Indicate the contents of the current display window
     should be renewed
   – The routine is also used when additional object is to be
     shown



                                   Video Processing Lab              16
                                      臺灣師範大學數位媒體中心視訊處理研究室
Executing the application
        program
• When program setup is OK and
  display have been created and
  initialized
  – glutMainLoop()
    • GLUT processing loop: Continually checks
      for new “event”
       – Interactive input: mouse or a graphics tablet




                             Video Processing Lab        17
                                臺灣師範大學數位媒體中心視訊處理研究室
Resizing a GLUT display
         window
• Resize window
   – Any size: glutReshapeWindow (dwNewWidth,
     dwNewHeight)
      • New position at the upper-left display window
      • Relative to the upper-left corner of the screen
      • Exact size depends on the window-management system
   – Full screen: glutFullScreen() //usually use
• Resize function
   – glutReshapeFunc (winReshapeFcn)
      • GLUT routine is activated which can be defined by user
      • The “callback function” for “reshape event”
          – Change the parameters for the viewport




                                    Video Processing Lab         18
                                       臺灣師範大學數位媒體中心視訊處理研究室
Scale image
• This image extract from “Solar empire -
  heavens above” have be produced by
  Discovery Communications , 1997
                                        image B

   image A   Enlarge image A




             smaller image B


                               Video Processing Lab   19
                                  臺灣師範大學數位媒體中心視訊處理研究室
OpenGL scale image function
       • Scale an image to any size
         int gluScaleImage (format, Imagein info, Imageout
         info)
            – Format (Specifies the format of the pixel data)
                 • Color information: GL_COLOR_INDEX, GL_RED,
                   GL_GREEN, GL_BLUE…
            – Image info: width* & height*, type*, data*
                 • widthin, heightin & widthout, heightout
                      – widthin and heightin of the scaled source image
                      – widthout and heightout of the destination image.
                 • typein & typeout (Specifies the data type for datain &
                   dataout)
                      – Data type: GL_UNSIGNED_BYTE, GL_BYTE, GL_INT,
                        GL_FLOAT…
                 • datain & dataout
                      – Datain: source image, dataout: diestination image



                                                  Video Processing Lab      20
http://www.mevis.de/opengl/gluScaleImage.html        臺灣師範大學數位媒體中心視訊處理研究室
Animation vs. Image

                                                       zoetrope

mutoscope




                                                                                  70mm
8mm           16mm                    35mm




 Film Art: An Introduction (Paperback)by David Bordwell, Kristin Thompson "Motion pictures
 are so much a part of our lives that it's hard to imagine a world without them..."
                                             Video Processing Lab                   21
                                           臺灣師範大學數位媒體中心視訊處理研究室
What is animation?

• Animation
  – A sequence of images
  – Those images have
    relation




                      Video Processing Lab   22
                           臺灣師範大學數位媒體中心視訊處理研究室
Motion sequences

• Two basic method to design
  – Real-time animation
  – Frame by frame animation
• Displayed on a video monitor in “real-time
  playback”
  – Simple animation displays->real-time
  – Complex animation
     • Special hardware and software system (MPEG
       standard..)



                             Video Processing Lab   23
                                臺灣師範大學數位媒體中心視訊處理研究室
Raster method for
    computer animation
• What is problem?
  – Construct one frame (in animation) could
    take most of refresh cycle time
    • Objects generated take the frame refresh
      time
    • Object is gone (next frame), that frame
      should be recreate
       – Unregulated motion, fractured frame…
  – Simply = regular motion


                           Video Processing Lab   24
                              臺灣師範大學數位媒體中心視訊處理研究室
How to design a simple
        animation
• Think?



• Strategy...




                Video Processing Lab   25
                   臺灣師範大學數位媒體中心視訊處理研究室
Efficiently process image
        sequences
• Strategy in CG
  – Design the object which
    can move between frame-
    by-frame
     • Problem is how to change
       buffers

  – Find frame rate

  – What time to start


                              Video Processing Lab   26
                                  臺灣師範大學數位媒體中心視訊處理研究室
Double buffering
• Real-time animation with a raster
  system is to use two refresh buffers
  – Create a frame in a buffer
  – When the screen is showed from that
    buffer
    • Construct the next frame in the other
      buffer
        Back Buffer   each time could   Front Buffer
                      be changed
         Frame II                        Frame I


                              Video Processing Lab     27
                                 臺灣師範大學數位媒體中心視訊處理研究室
Frame rate

• How fast to switch two refresh
  buffers
  – Regular motion
    • 1/60 (sec): 60 frames per one second
    • 1/30 (sec) ~ MPEG I/II
    • 1/25 (sec) or 1/20 (sec) …
  – Unregulated motion
    • 1/60 jump to 2/60 or 3/60



                         Video Processing Lab   28
                            臺灣師範大學數位媒體中心視訊處理研究室
Monitor refresh rate




                         Refresh time:
                         50-85-Hz rate
                         demo



            Video Processing Lab         29
               臺灣師範大學數位媒體中心視訊處理研究室
Periodic motion

 • A typical example of an periodic-
   motion display is the wagon wheel in
   American Western movie
Frame 0,   Frame 1,   Frame 2,      Frame 3,        Frame 4,
0 sec      1/24 sec   2/24 sec      3/24 sec        4/24 sec




                             Video Processing Lab              30
                                 臺灣師範大學數位媒體中心視訊處理研究室
OpenGL double buffer

• Main function
  – glutInitDisplayMode (GLUT_DOUBLE |
    GLUT_RGB);
• Display function
  – glutSwapBuffers()
       Back Buffer   each time could   Front Buffer
                     be changed
        Frame II                         Frame I



                              Video Processing Lab    31
                                 臺灣師範大學數位媒體中心視訊處理研究室
The sampling rate in
     Periodic motion
• For a continuous rotation, we could
  reset parameter values one every
  cycle (3600)
• We want to rotate a object
  – Each time rotation angle = 30
    • 120 motion steps could be produced
  – Increment = 40
    • Generates 90 position
        What rate do you choose
        (higher or lower)?
                             Video Processing Lab   32
                                  臺灣師範大學數位媒體中心視訊處理研究室
OpenGL buffer change
        function
• When there are no event to process, the
  convenient to design
  – glutIdleFunc (idle)
     • Idle: describe the objects how to move (it’s
       trajectory)
• Mouse callback
  – mouse (button, action, x, y)
     • if(button == GLUT_LEFT_BUTTON && state ==
       GLUT_DOWN) glutIdleFunc (idle);




                               Video Processing Lab   33
                                  臺灣師範大學數位媒體中心視訊處理研究室
Object’s trajectory
• void idle ()
  – rotTheta += 2.0; //rotation angle △= 2.0
  – if (rotTheta > 360.0) rotTheta -= 360.0;
  – glutPostRedisplay ();
                             1. Object setup
                             2. Buffer change




                       Video Processing Lab     34
                          臺灣師範大學數位媒體中心視訊處理研究室
Homework
• Object has different frame rate in split
  screen
  – Step 1: choose your object (one)
     • Small image or polygon …
  – Step 2: split screen
     • 2, 3, 4….(choose one)
  – Step 3: put object which has different frame
    rate on those split screen
  – Reward: put the icon up the window



                               Video Processing Lab   35
                                  臺灣師範大學數位媒體中心視訊處理研究室
• Next class will introduce 3D views




                     Video Processing Lab   36
                        臺灣師範大學數位媒體中心視訊處理研究室
Reference books
• Computer Graphics with OpenGL 3th,
  Hearn Baker
• Interactive Computer Graphics: A Top-
  Down Approach using OpenGL, 3/e,
  Addison Wesley
• Film Art: An Introduction (Paperback)by
  David Bordwell, Kristin Thompson



                       Video Processing Lab   37
                          臺灣師範大學數位媒體中心視訊處理研究室

More Related Content

Similar to CG OpneGL 2D viewing & simple animation-course 6

CG OpenGL 3D viewing-course 7
CG OpenGL 3D viewing-course 7CG OpenGL 3D viewing-course 7
CG OpenGL 3D viewing-course 7fungfung Chen
 
CG OpenGL 3D object representations-course 8
CG OpenGL 3D object representations-course 8CG OpenGL 3D object representations-course 8
CG OpenGL 3D object representations-course 8fungfung Chen
 
CG simple openGL point & line-course 2
CG simple openGL point & line-course 2CG simple openGL point & line-course 2
CG simple openGL point & line-course 2fungfung Chen
 
MVisio: A Computer Graphics Platform for Virtual Reality, Science and Education
MVisio: A Computer Graphics Platform for Virtual Reality, Science and EducationMVisio: A Computer Graphics Platform for Virtual Reality, Science and Education
MVisio: A Computer Graphics Platform for Virtual Reality, Science and EducationAchille Peternier
 
CG OpenGL line & area-course 3
CG OpenGL line & area-course 3CG OpenGL line & area-course 3
CG OpenGL line & area-course 3fungfung Chen
 
The not so short
The not so shortThe not so short
The not so shortAXM
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGLGary Yeh
 
JDK Tools For Performance Diagnostics
JDK Tools For Performance DiagnosticsJDK Tools For Performance Diagnostics
JDK Tools For Performance DiagnosticsBaruch Sadogursky
 
Cairo Graphics Kit
Cairo Graphics KitCairo Graphics Kit
Cairo Graphics KitESUG
 
Future Technology Center Project
Future Technology Center ProjectFuture Technology Center Project
Future Technology Center ProjectMohamed Adam
 
Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)IJERA Editor
 
1-MIV-tutorial-part-1.pdf
1-MIV-tutorial-part-1.pdf1-MIV-tutorial-part-1.pdf
1-MIV-tutorial-part-1.pdfJunZhao68
 
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ESGFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ESPrabindh Sundareson
 
Introduction into JavaFX
Introduction into JavaFXIntroduction into JavaFX
Introduction into JavaFXEugene Bogaart
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012Wingston
 

Similar to CG OpneGL 2D viewing & simple animation-course 6 (20)

CG OpenGL 3D viewing-course 7
CG OpenGL 3D viewing-course 7CG OpenGL 3D viewing-course 7
CG OpenGL 3D viewing-course 7
 
CG OpenGL 3D object representations-course 8
CG OpenGL 3D object representations-course 8CG OpenGL 3D object representations-course 8
CG OpenGL 3D object representations-course 8
 
CG simple openGL point & line-course 2
CG simple openGL point & line-course 2CG simple openGL point & line-course 2
CG simple openGL point & line-course 2
 
MVisio: A Computer Graphics Platform for Virtual Reality, Science and Education
MVisio: A Computer Graphics Platform for Virtual Reality, Science and EducationMVisio: A Computer Graphics Platform for Virtual Reality, Science and Education
MVisio: A Computer Graphics Platform for Virtual Reality, Science and Education
 
CG OpenGL line & area-course 3
CG OpenGL line & area-course 3CG OpenGL line & area-course 3
CG OpenGL line & area-course 3
 
Opengl (1)
Opengl (1)Opengl (1)
Opengl (1)
 
NMSL_2017summer
NMSL_2017summerNMSL_2017summer
NMSL_2017summer
 
The not so short
The not so shortThe not so short
The not so short
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGL
 
JDK Tools For Performance Diagnostics
JDK Tools For Performance DiagnosticsJDK Tools For Performance Diagnostics
JDK Tools For Performance Diagnostics
 
Cairo Graphics Kit
Cairo Graphics KitCairo Graphics Kit
Cairo Graphics Kit
 
Advanced Effects Oscon 2007
Advanced Effects   Oscon 2007Advanced Effects   Oscon 2007
Advanced Effects Oscon 2007
 
Future Technology Center Project
Future Technology Center ProjectFuture Technology Center Project
Future Technology Center Project
 
Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)Image Detection and Count Using Open Computer Vision (Opencv)
Image Detection and Count Using Open Computer Vision (Opencv)
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
1-MIV-tutorial-part-1.pdf
1-MIV-tutorial-part-1.pdf1-MIV-tutorial-part-1.pdf
1-MIV-tutorial-part-1.pdf
 
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ESGFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
 
Introduction into JavaFX
Introduction into JavaFXIntroduction into JavaFX
Introduction into JavaFX
 
OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012OpenCV @ Droidcon 2012
OpenCV @ Droidcon 2012
 
Seminar - JBoss Migration
Seminar - JBoss MigrationSeminar - JBoss Migration
Seminar - JBoss Migration
 

More from fungfung Chen

Smart TV content converged service & social media
Smart TV content converged service & social mediaSmart TV content converged service & social media
Smart TV content converged service & social mediafungfung Chen
 
Tips for fulfilling patent application
Tips for fulfilling patent applicationTips for fulfilling patent application
Tips for fulfilling patent applicationfungfung Chen
 
Defending your Rights
Defending your RightsDefending your Rights
Defending your Rightsfungfung Chen
 
Polishing search skills
Polishing search skillsPolishing search skills
Polishing search skillsfungfung Chen
 
Inquiry Based Approach - Patent Search
Inquiry Based Approach - Patent SearchInquiry Based Approach - Patent Search
Inquiry Based Approach - Patent Searchfungfung Chen
 
Overseas protection & patent search
Overseas protection & patent searchOverseas protection & patent search
Overseas protection & patent searchfungfung Chen
 
Patentability classification search
Patentability classification searchPatentability classification search
Patentability classification searchfungfung Chen
 
Novelty to Nonobviousness
Novelty to NonobviousnessNovelty to Nonobviousness
Novelty to Nonobviousnessfungfung Chen
 
Patentability requirement on novelty
Patentability requirement on noveltyPatentability requirement on novelty
Patentability requirement on noveltyfungfung Chen
 
2012 Smart TV - Evolution & Approaches
2012 Smart TV - Evolution & Approaches2012 Smart TV - Evolution & Approaches
2012 Smart TV - Evolution & Approachesfungfung Chen
 
Patentability Requirements
Patentability RequirementsPatentability Requirements
Patentability Requirementsfungfung Chen
 
Working model to patentability
Working model to patentabilityWorking model to patentability
Working model to patentabilityfungfung Chen
 
Evaluate your invention
Evaluate your inventionEvaluate your invention
Evaluate your inventionfungfung Chen
 
how to invention & practice it
how to invention & practice ithow to invention & practice it
how to invention & practice itfungfung Chen
 
Digital converge - DTV service design
Digital converge - DTV service designDigital converge - DTV service design
Digital converge - DTV service designfungfung Chen
 
Hybrid digital broadcasting methods
Hybrid digital broadcasting methodsHybrid digital broadcasting methods
Hybrid digital broadcasting methodsfungfung Chen
 
Summary the challenges of Social TV
Summary the challenges of  Social TVSummary the challenges of  Social TV
Summary the challenges of Social TVfungfung Chen
 
CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10fungfung Chen
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9fungfung Chen
 

More from fungfung Chen (20)

Tech biz patent
Tech biz patent Tech biz patent
Tech biz patent
 
Smart TV content converged service & social media
Smart TV content converged service & social mediaSmart TV content converged service & social media
Smart TV content converged service & social media
 
Tips for fulfilling patent application
Tips for fulfilling patent applicationTips for fulfilling patent application
Tips for fulfilling patent application
 
Defending your Rights
Defending your RightsDefending your Rights
Defending your Rights
 
Polishing search skills
Polishing search skillsPolishing search skills
Polishing search skills
 
Inquiry Based Approach - Patent Search
Inquiry Based Approach - Patent SearchInquiry Based Approach - Patent Search
Inquiry Based Approach - Patent Search
 
Overseas protection & patent search
Overseas protection & patent searchOverseas protection & patent search
Overseas protection & patent search
 
Patentability classification search
Patentability classification searchPatentability classification search
Patentability classification search
 
Novelty to Nonobviousness
Novelty to NonobviousnessNovelty to Nonobviousness
Novelty to Nonobviousness
 
Patentability requirement on novelty
Patentability requirement on noveltyPatentability requirement on novelty
Patentability requirement on novelty
 
2012 Smart TV - Evolution & Approaches
2012 Smart TV - Evolution & Approaches2012 Smart TV - Evolution & Approaches
2012 Smart TV - Evolution & Approaches
 
Patentability Requirements
Patentability RequirementsPatentability Requirements
Patentability Requirements
 
Working model to patentability
Working model to patentabilityWorking model to patentability
Working model to patentability
 
Evaluate your invention
Evaluate your inventionEvaluate your invention
Evaluate your invention
 
how to invention & practice it
how to invention & practice ithow to invention & practice it
how to invention & practice it
 
Digital converge - DTV service design
Digital converge - DTV service designDigital converge - DTV service design
Digital converge - DTV service design
 
Hybrid digital broadcasting methods
Hybrid digital broadcasting methodsHybrid digital broadcasting methods
Hybrid digital broadcasting methods
 
Summary the challenges of Social TV
Summary the challenges of  Social TVSummary the challenges of  Social TV
Summary the challenges of Social TV
 
CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9
 

Recently uploaded

VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...SUHANI PANDEY
 
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call GirlsCBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girlsmodelanjalisharma4
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funneljen_giacalone
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...Pooja Nehwal
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfParomita Roy
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Delhi Call girls
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Delhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...Pooja Nehwal
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130Suhani Kapoor
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation decktbatkhuu1
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...babafaisel
 
The Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aestheticThe Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aestheticTiaFebriani
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
 
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call GirlsCBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funnel
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Basapura ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Hy...
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Delhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Paharganj 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
Kala jadu for love marriage | Real amil baba | Famous amil baba | kala jadu n...
 
The Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aestheticThe Art of Batik, template ppt aesthetic
The Art of Batik, template ppt aesthetic
 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
 

CG OpneGL 2D viewing & simple animation-course 6

  • 1. 2D Viewing & simple animation Chen Jing-Fung (2006/11/30) Assistant Research Fellow, Digital Media Center, National Taiwan Normal University Video Processing Lab 臺灣師範大學數位媒體中心視訊處理研究室 National Taiwan Normal University Ch6 & 11: Computer Graphics with OpenGL 3th, Hearn Baker
  • 2. 2D view -> animation • What is view? • How to view? – Viewing region – Viewing transformation – Vision window vs. image • What is animation? – How to construct? – Related to viewing region Video Processing Lab 2 臺灣師範大學數位媒體中心視訊處理研究室
  • 3. View about output device • Graphics package allows a user to specify the part of a picture – One device: • Display the part of a defined picture – Many devices • Which display device is to be placed by that part (where?) Video Processing Lab 3 臺灣師範大學數位媒體中心視訊處理研究室
  • 4. View region • A view is selected by specifying a region – To select a region or several regions (an animated panning sequence across a scene) – Who view? User or camera… – Where? Specified areas of the device coordinates (Ex: xy plane) – Viewing transformations involve translation, rotation and scaling operations • Or deleting some parts about the limits of outside Video Processing Lab 4 臺灣師範大學數位媒體中心視訊處理研究室
  • 5. Coordinate representations Viewing & Projection Coordinates 1 1 Modeling Transformation : 1 Video Monitor (local or master) Coordinates & Viewing Coordinates Plotter World Normalized (Cartesian) Coordinates Coordinates Other Output Device Coordinates Video Processing Lab 5 臺灣師範大學數位媒體中心視訊處理研究室
  • 6. 2D viewing- transformation pipeline • Modeling-coordinate – User construct scene (or object) by world-coordinate • Transformation – World coordinates <=> Viewing coordinates – Viewing coordinates to normalize • reshape(): glMatrixMode(GL_PROJECTION), glLoadIdentify(), gluOrtho2D()… • Output device show – Map normalized coordinates to device coordinates • reshape(): viewport() Video Processing Lab 6 臺灣師範大學數位媒體中心視訊處理研究室
  • 7. Two different Viewports • Why do viewing transformation? – zoom in the green region (or zoom out) • Viewing-coordinate (reference frame) is from specifying the clipping window Clipping window Normalization viewport World coordinates Viewing coordinates Video Processing Lab 7 臺灣師範大學數位媒體中心視訊處理研究室
  • 8. OpenGL viewport function • glViewport (xvmin, yvmin, vpWidth, vpHeight); – Position: (xvmin,yvmin) • Low-left corner of the viewport vpHeight – Viewport size vpWidth • Width=vpWidth, Height=vpHeight (xvmin, yvmin) • Not invoke the glViewport() function – Default: viewport size (position) = display window size (position) Video Processing Lab 8 臺灣師範大學數位媒體中心視訊處理研究室
  • 9. Viewport: Split-screen Origin • Split display window – Two viewport: Up & down 600 • Object 300 – Origin & rotate 90o 10.0 5.0 • Zoom in the object size • Result Video Processing Lab 9 臺灣師範大學數位媒體中心視訊處理研究室
  • 10. Viewport Example • Initial set – glMatrixMode (GL_PROJECTION); – gluOrtho2D (x1, y1, x2, y2); // Normalization (central or corner) – glMatrixMode (GL_MODELVIEW); • Display – wcPt2D verts [2] //object 10.0 5.0 – glViewport (); //set viewport: lower-left point(0,0) size(300, 300) – rent (verts); //draw object – glViewport (); //set up viewport – glRotatef(angle, x, y, z); //rotate 900 about z axis – rent (verts); //draw object •Result: demo Video Processing Lab 10 臺灣師範大學數位媒體中心視訊處理研究室
  • 11. Real case about split monitor • This case is used four sub-monitors to obverse more player how to bite Practice the split window function … Video Processing Lab 11 臺灣師範大學數位媒體中心視訊處理研究室
  • 12. Multiple display windows Video Processing Lab 12 http://www.microsoft.com/ 臺灣師範大學數位媒體中心視訊處理研究室
  • 13. Glut display window • Multiple display windows can be created for an application – Create One window must be assigned one ID • windowID = glutCreateWindow (“name”) – Delete a display window • glutDestroyWindow (windowID) – Current display window (not change current window) • glutSetWindow (windowID) – Query the window • currentWindowID = glutGetWindow () //if value=0 => no window Video Processing Lab 13 臺灣師範大學數位媒體中心視訊處理研究室
  • 14. Managing Multiple GLUT display windows • Window icon: glutIconifyWindow () – Convert the windowcurrent to an icon • small picture or symbol – Use to represent the window – Icon name is as same as the window. • Change icon’s name glutSetIconTitle(“new name”) • Change window’s name glutSetWindowTitle(“new name”) Video Processing Lab 14 臺灣師範大學數位媒體中心視訊處理研究室
  • 15. Windows operators • Change display windows order – The window is to be in front of all other windows glutSetWindow (windowID) glutPopWindow () – Push the window to the back glutSetWindow (windowID) glutPushWindow() – Take off the current window glutHideWindow() – Return a “hidden” display window glutShowWindow() Video Processing Lab 15 臺灣師範大學數位媒體中心視訊處理研究室
  • 16. One window & Multi- windows • Describe what is to be displayed in the current display window – glutDisplayFunc (pictureDescrip) • pictureDescrip: usually contains the OpenGL primitives and attributes • After glutPopWindow() • glutPostRedisplay () – Indicate the contents of the current display window should be renewed – The routine is also used when additional object is to be shown Video Processing Lab 16 臺灣師範大學數位媒體中心視訊處理研究室
  • 17. Executing the application program • When program setup is OK and display have been created and initialized – glutMainLoop() • GLUT processing loop: Continually checks for new “event” – Interactive input: mouse or a graphics tablet Video Processing Lab 17 臺灣師範大學數位媒體中心視訊處理研究室
  • 18. Resizing a GLUT display window • Resize window – Any size: glutReshapeWindow (dwNewWidth, dwNewHeight) • New position at the upper-left display window • Relative to the upper-left corner of the screen • Exact size depends on the window-management system – Full screen: glutFullScreen() //usually use • Resize function – glutReshapeFunc (winReshapeFcn) • GLUT routine is activated which can be defined by user • The “callback function” for “reshape event” – Change the parameters for the viewport Video Processing Lab 18 臺灣師範大學數位媒體中心視訊處理研究室
  • 19. Scale image • This image extract from “Solar empire - heavens above” have be produced by Discovery Communications , 1997 image B image A Enlarge image A smaller image B Video Processing Lab 19 臺灣師範大學數位媒體中心視訊處理研究室
  • 20. OpenGL scale image function • Scale an image to any size int gluScaleImage (format, Imagein info, Imageout info) – Format (Specifies the format of the pixel data) • Color information: GL_COLOR_INDEX, GL_RED, GL_GREEN, GL_BLUE… – Image info: width* & height*, type*, data* • widthin, heightin & widthout, heightout – widthin and heightin of the scaled source image – widthout and heightout of the destination image. • typein & typeout (Specifies the data type for datain & dataout) – Data type: GL_UNSIGNED_BYTE, GL_BYTE, GL_INT, GL_FLOAT… • datain & dataout – Datain: source image, dataout: diestination image Video Processing Lab 20 http://www.mevis.de/opengl/gluScaleImage.html 臺灣師範大學數位媒體中心視訊處理研究室
  • 21. Animation vs. Image zoetrope mutoscope 70mm 8mm 16mm 35mm Film Art: An Introduction (Paperback)by David Bordwell, Kristin Thompson "Motion pictures are so much a part of our lives that it's hard to imagine a world without them..." Video Processing Lab 21 臺灣師範大學數位媒體中心視訊處理研究室
  • 22. What is animation? • Animation – A sequence of images – Those images have relation Video Processing Lab 22 臺灣師範大學數位媒體中心視訊處理研究室
  • 23. Motion sequences • Two basic method to design – Real-time animation – Frame by frame animation • Displayed on a video monitor in “real-time playback” – Simple animation displays->real-time – Complex animation • Special hardware and software system (MPEG standard..) Video Processing Lab 23 臺灣師範大學數位媒體中心視訊處理研究室
  • 24. Raster method for computer animation • What is problem? – Construct one frame (in animation) could take most of refresh cycle time • Objects generated take the frame refresh time • Object is gone (next frame), that frame should be recreate – Unregulated motion, fractured frame… – Simply = regular motion Video Processing Lab 24 臺灣師範大學數位媒體中心視訊處理研究室
  • 25. How to design a simple animation • Think? • Strategy... Video Processing Lab 25 臺灣師範大學數位媒體中心視訊處理研究室
  • 26. Efficiently process image sequences • Strategy in CG – Design the object which can move between frame- by-frame • Problem is how to change buffers – Find frame rate – What time to start Video Processing Lab 26 臺灣師範大學數位媒體中心視訊處理研究室
  • 27. Double buffering • Real-time animation with a raster system is to use two refresh buffers – Create a frame in a buffer – When the screen is showed from that buffer • Construct the next frame in the other buffer Back Buffer each time could Front Buffer be changed Frame II Frame I Video Processing Lab 27 臺灣師範大學數位媒體中心視訊處理研究室
  • 28. Frame rate • How fast to switch two refresh buffers – Regular motion • 1/60 (sec): 60 frames per one second • 1/30 (sec) ~ MPEG I/II • 1/25 (sec) or 1/20 (sec) … – Unregulated motion • 1/60 jump to 2/60 or 3/60 Video Processing Lab 28 臺灣師範大學數位媒體中心視訊處理研究室
  • 29. Monitor refresh rate Refresh time: 50-85-Hz rate demo Video Processing Lab 29 臺灣師範大學數位媒體中心視訊處理研究室
  • 30. Periodic motion • A typical example of an periodic- motion display is the wagon wheel in American Western movie Frame 0, Frame 1, Frame 2, Frame 3, Frame 4, 0 sec 1/24 sec 2/24 sec 3/24 sec 4/24 sec Video Processing Lab 30 臺灣師範大學數位媒體中心視訊處理研究室
  • 31. OpenGL double buffer • Main function – glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); • Display function – glutSwapBuffers() Back Buffer each time could Front Buffer be changed Frame II Frame I Video Processing Lab 31 臺灣師範大學數位媒體中心視訊處理研究室
  • 32. The sampling rate in Periodic motion • For a continuous rotation, we could reset parameter values one every cycle (3600) • We want to rotate a object – Each time rotation angle = 30 • 120 motion steps could be produced – Increment = 40 • Generates 90 position What rate do you choose (higher or lower)? Video Processing Lab 32 臺灣師範大學數位媒體中心視訊處理研究室
  • 33. OpenGL buffer change function • When there are no event to process, the convenient to design – glutIdleFunc (idle) • Idle: describe the objects how to move (it’s trajectory) • Mouse callback – mouse (button, action, x, y) • if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) glutIdleFunc (idle); Video Processing Lab 33 臺灣師範大學數位媒體中心視訊處理研究室
  • 34. Object’s trajectory • void idle () – rotTheta += 2.0; //rotation angle △= 2.0 – if (rotTheta > 360.0) rotTheta -= 360.0; – glutPostRedisplay (); 1. Object setup 2. Buffer change Video Processing Lab 34 臺灣師範大學數位媒體中心視訊處理研究室
  • 35. Homework • Object has different frame rate in split screen – Step 1: choose your object (one) • Small image or polygon … – Step 2: split screen • 2, 3, 4….(choose one) – Step 3: put object which has different frame rate on those split screen – Reward: put the icon up the window Video Processing Lab 35 臺灣師範大學數位媒體中心視訊處理研究室
  • 36. • Next class will introduce 3D views Video Processing Lab 36 臺灣師範大學數位媒體中心視訊處理研究室
  • 37. Reference books • Computer Graphics with OpenGL 3th, Hearn Baker • Interactive Computer Graphics: A Top- Down Approach using OpenGL, 3/e, Addison Wesley • Film Art: An Introduction (Paperback)by David Bordwell, Kristin Thompson Video Processing Lab 37 臺灣師範大學數位媒體中心視訊處理研究室