Download presentation
Presentation is loading. Please wait.
Published byBarnaby Tyler Modified over 9 years ago
1
19/4/2015 15:32 Graphics II Syllabus Selection and Picking Session 1
2
29/4/2015 15:32 Course Website: www.cs.uml.edu/~hmasterm/graphics2.html
3
39/4/2015 15:32 Parametric Surfaces
4
49/4/2015 15:32 Shadowing Techniques
5
59/4/2015 15:32 Rendered with Gouraud Shading
6
69/4/2015 15:32 Rendered with Ray Tracing
7
79/4/2015 15:32 Rendered with Radiosity
8
89/4/2015 15:32 Environment Mapping
9
99/4/2015 15:32 Realistic Materials Image: R. Rost: OpenGL Shading Language, Addison Wesley
10
109/4/2015 15:32 Diffraction and Chromatic Aberration Image: R. Rost: OpenGL Shading Language, Addison Wesley
11
119/4/2015 15:32 Noise Textures Image: R. Rost: OpenGL Shading Language, Addison Wesley
12
129/4/2015 15:32 Volume Rendering
13
139/4/2015 15:32 Volume Rendering: Medical Application
14
149/4/2015 15:32 Image Based Rendering View Morph Demo:
15
159/4/2015 15:32 Simple Legged Animation Ankle Rotation Script
16
169/4/2015 15:32 Simple Legged Animation Resulting Animation
17
179/4/2015 15:32 Nonlinear Global Deformation An Example Undeformed Taper Twist Bend
18
189/4/2015 15:32 Factor Curves: An Example: the Animated Spoon
19
199/4/2015 15:32 PICKING Direct Manipulation Demo
20
209/4/2015 15:32 Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function Calls or Protocol Data
21
219/4/2015 15:32 Interaction with Graphics System Change Image React to Change Graphics SystemUser Input Device Display
22
229/4/2015 15:32 Logical Input Devices 0 String -Provides ASCII strings to user program -Usually implemented as physical keyboard 0 Locator -Inputs position in defined coordinate system -Absolute vs. relative -Direct vs. indirect 0 Choice -Choice among a discrete number of options -Implemented by menus or control button widget 0 Valuator (or Dial) -Provides analog input to user program -Bounded vs. unbounded -Often implemented as slidebar widget
23
239/4/2015 15:32 Logical Input Devices, contd. 0 Pick -Returns identifier of an object to user program -Can be implemented by locator and choice 0 Stroke -Returns an array of locations -Can be implemented by locator and choice
24
249/4/2015 15:32 Event Mode Input Event Queue Program Await Event Trigger Process Measure Process Trigger Event: Device & Measure Events
25
259/4/2015 15:32 OpenGL Geometric Pipline Modelview Transformation Vertex Coordinates x, y, z, w Object Coordinates Eye Coordinates Clip Coordinates Device Coordinates Window Coordinates x,y Projection Transformation Perspective Division Viewport Transformation Modelview Matrix Projection Matrix Part of OpenGL State Viewport Transformation
26
269/4/2015 15:32 Object Picking by Ray Tracing p1 COP p2 Window Coordinates Object 1 Object 2
27
279/4/2015 15:32 Picking is supported by Selection in OpenGL z x y Yellow Cube 1 zmin zmax Yellow Cube Name Stack Select Buffer # Names on Stack
28
289/4/2015 15:32 OpenGL Rendering Mode glRenderMode() GL_RENDER GL_SELECT 1 zmin zmax Yellow Cube glRenderMode(GL_RENDER) returns the number of hits while in SELECT mode
29
299/4/2015 15:32 Selection in OpenGL: The Basic Steps Specify the array to be used for the returned hit records using: glSelectBuffer() Enter the selection mode using: glRenderMode(GL_SELECT); Initialize the name stack using: glInitNames(); 0 Define the viewing volume you want to use for selection. This does not have to be the same as used for viewing. 0 Alternately issue primitive drawing commands and commands to manipulate the name stack so that each primitive of interest has a name assigned. Exit selection mode using: glRenderMode(GL_RENDER); and process the returned selection data in the select buffer.
30
309/4/2015 15:32 Initializing a Select Buffer Void glSelectBuffer(Glsizei size, Gluint *buffer ); You must call glSelectBuffer() before entering select mode. 0 1 2 size-1 32-bit unsigned integers
31
319/4/2015 15:32 Manipulating the Name Stack glInitNames(void); Clears the name stack so that it’s empty glPushName(Gluint name); Pushes name onto name stack glPopName(void); Pops one name off the top of the name stack glLoadName(Gluint name); Replaces the value on top of the name stack Note: returns error if stack is empty. Therefore push at least one name on stack using glPushName() first.
32
329/4/2015 15:32 Interpreting the Hit Record: Contents of the Selection Buffer num_hits zmin zmax name glRenderMode() returns the number of hits that can be used to index into Selection Buffer num_hits is an unsigned integer corresponding to the number of hits before name stack is manipulated zmin and zmax store the maximum and minimum z-buffer value values for each hit. Z ranges in [0.0, 1.0] which is normalized as a 32 bit unsigned integer in range [0, 2 32 -1] name is an unsigned integer
33
339/4/2015 15:32 Selection: Code Example 120 goto 120
34
349/4/2015 15:32 Picking in OpenGL Perspective View Volume Canonical View Volume Projection Transform Pick Matrix Transform Screen Coordinates
35
359/4/2015 15:32 Generating a Pick Matrix Void gluPickMatrix(GLdouble x, Gldouble y, Gldouble width, Gldouble height, Gl int viewport[4]); x cursor x location in window coordinates y cursor y location in window coordinates width width of the picking region in screen coordinates height height of the picking region in screen coordinates viewport current viewport boundaries in pixel screen coordinates Typical usage: glMatrixMode (GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPickMatrix(...); gluPerspective( or glOrtho, glFrustrum, etc) /* draw the scene for picking */... glPopMatrix();
36
369/4/2015 15:32 Picking: Code Example 120 goto 120
37
379/4/2015 15:32 Backup Slide: OpenGL: Pick Matrix Transformation z x y
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.