Preview of 3-D Graphics Glenn G. Chappell

Slides:



Advertisements
Similar presentations
1 3D modelling with OpenGL Brian Farrimond Robina Hetherington.
Advertisements

OpenGL 3D and Animation for Simulating a Solar System
Based on slides created by Edward Angel
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Programming with OpenGL and GLUT
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
CAP4730: Computational Structures in Computer Graphics Introduction to OpenGL.
Mouse-Based Viewing & Navigation Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 3, 2003.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Polygon Lists & 3-D File Formats Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 18, 2002.
Lehigh University Introduction to Flash MX Sharmeen Mecklai.
CS 481 Preview, Some Lighting Details Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 19, 2003.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
1Computer Graphics Input and Interaction Lecture 8 John Shearer Culture Lab – space 2
Lecture 3 OpenGL.
Computer Graphics I, Fall 2010 Input and Interaction.
CS 450: COMPUTER GRAPHICS PORTRAIT OF AN OPENGL PROGRAM SPRING 2015 DR. MICHAEL J. REALE.
IT253: Computer Organization Lecture 3: Memory and Bit Operations Tonga Institute of Higher Education.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
Lecture 6: 3D graphics Concepts 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271 
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
VR UI, Notes on Projects, Intro. to Object Descriptions Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday,
Interactive Computer Graphics CS 418 MP1: Dancing I TA: Zhicheng Yan Sushma S Kini Mary Pietrowicz Slides Taken from: “An Interactive Introduction to OpenGL.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
Build-A-Button Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, October 8, 2003.
Program 2 due 02/01  Be sure to document your program  program level doc  your name  what the program does  each function  describe the arguments.
1 Input and Interaction. 2 Objectives Introduce the basic input devices ­Physical Devices ­Logical Devices ­Input Modes Event-driven input Introduce double.
More on GLUT Programming Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, September 15, 2003.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
University of New Mexico
Pop-Up Menus Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 26, 2003.
GLUT functions glutInit allows application to get command line arguments and initializes system gluInitDisplayMode requests properties for the window.
Introduction to Input/Interaction Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 19, 2003.
Selection Mode, Introduction to Widgets Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 6, 2003.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
CS 480/680 Computer Graphics Programming with Open GL Part 2: Complete Programs Dr. Frederick C Harris, Jr. Fall 2011.
School of Computer Science
Stenciling Effects Glenn G. Chappell
Introduction to the Mouse
Computer Graphics Lecture 33
CSC461 Lecture 8: Input Devices
Introduction to Events
The User Interface Lecture 2 Mon, Aug 27, 2007.
Advanced Menuing, Introduction to Picking
SmartArt Graphics Guided Lesson.
Rendering Pipeline, OpenGL/GLUT
Chapter Lessons Create shape-tweened animations Create a mask effect
Display Lists & Text Glenn G. Chappell
PRINT ME! PRINT JUST ME! 20 t (min) A 5 x (lt-min)
Introduction to OpenGL
More on Widgets, Misc. Topics
Isaac Gang University of Mary Hardin-Baylor
Viewing Tools V part 3.
Input and Interaction Ed Angel
University of New Mexico
Input and Interaction Ed Angel
Basic Input and Output CSE 120 Winter 2019
Programming with OpenGL Part 2: Complete Programs
Tonga Institute of Higher Education IT 141: Information Systems
Programming with OpenGL Part 2: Complete Programs
Tonga Institute of Higher Education IT 141: Information Systems
Input and Interaction Ed Angel Professor Emeritus of Computer Science,
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Presentation transcript:

Preview of 3-D Graphics Glenn G. Chappell CHAPPELLG@member.ams.org U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 17, 2003

Review: intro2d.cpp GLUT calls the keyboard function whenever an ASCII keypress happens. Use the GLUT “special” function for non-ASCII (like arrow keys). The ASCII value of the keypress is in key. Mouse position is in x, y. Your keyboard (or special) function will usually be one big switch. GLUT calls the idle function whenever nothing else needs doing. It is useful for making time-dependent changes to the scene. Think “animation”. 17 Sep 2003 CS 381

Review: Making a Changing Display [1/3] We looked at how to make the display change: Based on keyboard input. Using the keyboard (or special) function. Automatically. Using the idle function. These ideas will be covered in greater detail in chapter 3. Coming up on Friday. 17 Sep 2003 CS 381

Review: Making a Changing Display [2/3] To add keypress-based display changes to a GLUT program: A global variable is needed to hold the current state of whatever part of the display is to change. Declare the variable. Initialize this variable to an appropriate value somewhere. In its declaration? In the init function? In the display function: Use the value of this variable. Draw whatever should be drawn, according to the current value of the variable. Do not change the variable in the display function. In the keyboard function, when the appropriate key is pressed: Change the value of the variable. Call “glutPostRedisplay();”. Do not call the display function. 17 Sep 2003 CS 381

Review: Making a Changing Display [3/3] To add automatic display changes to a GLUT program: So it just like keyboard input, except: Modify the idle function instead of the keyboard function. Do not worry about the ASCII value of a key. Doing this kind of programming may require a new mindset: Remember to handle events in the proper callbacks. Display does display, keyboard handles ASCII keypresses, etc. Remember that your functions can be called in just about any order! Again, we’ll look at this in more detail in chapter 3. 17 Sep 2003 CS 381

3-D Preview: Introduction From a certain point of view, 3-D graphics is easy. Just use 3 coordinates instead of 2 in your glVertex* commands. In practice, it is much trickier. We will be studying 3-D CG in detail starting with chapter 4. For now, a preview. 17 Sep 2003 CS 381

3-D Preview: Three Issues in 3-D CG Viewing and Transformations How do we look at a scene from any point of view within the scene, looking in any direction? How do we do perspective projection? How do we rotate things about arbitrary axes in 3-D? Hidden-Surface Removal When one object is behind another, we don’t want to see the hidden one. Then there is transparency … Lighting 3-D CG is lousy without lighting. How do we do it? In addition, we want to do smooth animation. 17 Sep 2003 CS 381

3-D Preview: Quick & Dirty Solutions [1/4] Viewing & Transformations By default, you are looking in the –z direction. So the +z axis points toward you. More negative values are farther away. The rest will have to wait a little. See sample3d.cpp for a few hints. 17 Sep 2003 CS 381

3-D Preview: Quick & Dirty Solutions [2/4] Hidden-Surface Removal Add GLUT_DEPTH to your glutInitDisplayMode call. This allocates a depth buffer. Remember, the various constants are bitwise-or’ed together. Add GL_DEPTH_BUFFER_BIT to your glClear call. This clears the depth buffer. Again, bitwise-or. Put glEnable(GL_DEPTH_TEST) somewhere in your initialization. This enables hidden-surface removal. 17 Sep 2003 CS 381

3-D Preview: Quick & Dirty Solutions [3/4] Lighting This is tough to explain quickly. For now, either Ignore lighting, and make polygons lots of different colors, so you can tell them apart. Or, base your programs on sample3d.cpp (or something similar), and use the GLUT built-in shape functions. Like glutSolidTorus. 17 Sep 2003 CS 381

3-D Preview: Quick & Dirty Solutions [4/4] Smooth Animation Use double buffering. Change GLUT_SINGLE to GLUT_DOUBLE in your glutInitDisplayMode call. Change glFlush to glutSwapBuffers in your display callback. Now the user only sees completed frames. No flicker in animation. Faster sometimes, slower others. User cannot see the frame being built. Sometimes this is bad, as with some complex fractals. 17 Sep 2003 CS 381