SlideShare a Scribd company logo
1 of 22
1
Computer Graphics
Chapter 2
Input Devices
RM [2]-2
Input Devices
 Logical Input Devices
Categorized based on functional
characteristics.
Each device transmits a particular kind of
data.
The different types of data are called input
primitives.
 Physical Input Devices
Categorized based on the physical machine.
RM [2]-3
Logical Input Devices
 Locator Devices
Input Primitive: Coordinate position (x,y)
Examples: Mouse, Keyboard (Cursor-
Position Keys), Tablet(Digitizer), Trackballs,
Lightpens.
Applications: Interactive drawing and editing,
Graph digitizing.
RM [2]-4
Digitizer
RM [2]-5
Joystick and Trackball
RM [2]-6
Logical Input Devices
 String Devices
Input Primitive: A string of characters
Example: Keyboard
Applications: Text input
RM [2]-7
Logical Input Devices
 Valuator
Input primitive: Scalar values (typically
between 0 and 1).
Examples: Control Dials, Sensing devices,
Joysticks
Applications: Input of graphics parameters,
Graphics representation of analog values,
Process simulation, Games.
RM [2]-8
Logical Input Devices
 Choice
Input primitive: A selection from a list of
options.
Examples: Mouse, Keyboard (Function
Keys), Touch Panel etc
Applications: Interactive menu selection,
Program control.
RM [2]-9
Logical Input Devices
 Pick
Input primitive: Selection of a part of the
screen.
Examples: Mouse, Cursor Keys, Tablet.
Applications: Interactive editing and
positioning.
RM [2]-10
Physical Input Devices
 Keyboard (input functions: String, Choice,
Locator).
 Mouse (input functions: Locator, Pick,
Choice).
 Joystick (input functions: Locator, Valuator).
 Knob (Valuator).
 Tablet (Locator, Pick).
RM [2]-11
3D Interaction Devices (Recent
additions)
These devices are used in advanced rendering methods and virtual reality
systems for providing information about three dimensional positions and
motion.Few examples are
1. DATA GLOVES
2. SPACE BALLS
3. IMAGING SENSORS
These devices are used in advanced rendering
methods and virtual reality systems for providing
information about three dimensional positions and
motion.Few examples are
1. DATA GLOVES
2 SPACE BALLS
RM [2]-12
Space Ball, Data Glove
RM [2]-13
Event Driven Programming
Event
Call-back
Functions
• Mouse clicked.
• Mouse dragged.
• A key is pressed.
• The window is resized.
• The window is moved.
• Register.
• Define.
Event Queue
RM [2]-14
Mouse Interaction
 Mouse Event
Event that occurs when the mouse button is
pressed or released.
 Mouse Motion Event
Event that occurs when the mouse is moved
while one of the buttons is pressed.
RM [2]-15
Mouse Event
 Contains the following information:
Button: The mouse button that is pressed –
left, middle, right.
State: The state of the button – up, down.
Position: The position of the mouse when
the event occurs (x, y).
RM [2]-16
Mouse Event (OpenGL)
Registering with Mouse Event: glutMouseFunc(myMouse);
Call-back function:
void myMouse(int button, int state, int x, int y)
Values for button: GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON
GLUT_RIGHT_BUTTON
Values for state: GLUT_UP, GLUT_DOWN
x, y: Screen coordinates of mouse position (origin at top-left corner).
RM [2]-17
Mouse Motion Event
 Contains the following information:
Position: The current position of the mouse
as the mouse is being dragged holding one
of the buttons pressed. The events are
continuously generated as the mouse button
is pressed and dragged.
RM [2]-18
Mouse Motion Event (OpenGL)
Registering with Mouse Motion Event:
glutMotionFunc(myMovedMouse);
Call-back function: void myMovedMouse(int x, int y)
x, y: Screen coordinates of mouse position (origin at top-left corner).
RM [2]-19
Keyboard Event
 Contains the following information:
key: The ASCII value of the key pressed.
Position: The current position of the mouse
when the key is pressed.
RM [2]-20
Keyboard Event (OpenGL)
Registering with Keyboard Event:
glutKeyboardFunc(myKeyboard);
Call-back function:
void myKeyboard(unsigned int key, int x, int y)
Values of key: ASCII value for normal keys
GLUT_KEY_LEFT, GLUT_KEY_RIGHT..(Arrow keys)
x, y: Screen coordinates of mouse position (origin at top-left corner).
RM [2]-21
Window Events
 The Window Redraw Event occurs
whenever the window needs to be redrawn.
This happens when the window is first
opened and when the window is exposed by
moving another window off of it.
 The Window Reshape Event is generated
when the window is resized with the mouse.
RM [2]-22
Window Events (OpenGL)
Registering with Window Redraw Event:
glutDisplayFunc(myDisplay);
Registering with Window Reshape Event:
glutReshapeFunc(myReshape);

More Related Content

What's hot

Input and output devices
Input and output devicesInput and output devices
Input and output devicesALOK GUPTA
 
Welcome to the presentation of input & output
Welcome to the presentation of input &  outputWelcome to the presentation of input &  output
Welcome to the presentation of input & outputajaya024
 
Input and output devices
Input and output devicesInput and output devices
Input and output devicesDanyal Ahmad
 

What's hot (6)

Input Output
Input OutputInput Output
Input Output
 
Input and output devices
Input and output devicesInput and output devices
Input and output devices
 
Act4 Humility
Act4 HumilityAct4 Humility
Act4 Humility
 
Welcome to the presentation of input & output
Welcome to the presentation of input &  outputWelcome to the presentation of input &  output
Welcome to the presentation of input & output
 
Input and output devices
Input and output devicesInput and output devices
Input and output devices
 
Cit 1101 lec 004
Cit 1101 lec 004Cit 1101 lec 004
Cit 1101 lec 004
 

Viewers also liked

Input devices in computer graphics
Input devices in computer graphicsInput devices in computer graphics
Input devices in computer graphicsAnu Garg
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output PrimitivesPrathimaBaliga
 
Computer Graphics Introduction
Computer Graphics IntroductionComputer Graphics Introduction
Computer Graphics IntroductionGhaffar Khan
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 

Viewers also liked (7)

Input devices in computer graphics
Input devices in computer graphicsInput devices in computer graphics
Input devices in computer graphics
 
Input Devices
Input Devices Input Devices
Input Devices
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Input devices
Input devicesInput devices
Input devices
 
Computer Graphics Introduction
Computer Graphics IntroductionComputer Graphics Introduction
Computer Graphics Introduction
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 

Similar to grahics

Computer Parts
Computer PartsComputer Parts
Computer PartsSimar Jeet
 
Assignment on Input and output devices
Assignment on Input and output devicesAssignment on Input and output devices
Assignment on Input and output devicesMahmudur Rahman Shojib
 
Input output devices
Input output devicesInput output devices
Input output devicesVijay Kumar
 
Introduction of Computers & C++ Programming
Introduction of Computers & C++ Programming Introduction of Computers & C++ Programming
Introduction of Computers & C++ Programming Mujeeb UR Rahman
 
Input and output devices.pdf
Input and output devices.pdfInput and output devices.pdf
Input and output devices.pdfAyeshaIftikhar67
 
Chapter 03 game input
Chapter 03 game inputChapter 03 game input
Chapter 03 game inputboybuon205
 
Presentation(Input,output,stoarage)
Presentation(Input,output,stoarage)Presentation(Input,output,stoarage)
Presentation(Input,output,stoarage)Maribel subteniente
 
Input devices
Input devicesInput devices
Input devicesFRK NIAZI
 
Hint 1 2D array of type Button, all buttons hidden except for one.pdf
Hint 1 2D array of type Button, all buttons hidden except for one.pdfHint 1 2D array of type Button, all buttons hidden except for one.pdf
Hint 1 2D array of type Button, all buttons hidden except for one.pdfFootageetoffe16
 
Various input devices showing their features
Various input devices showing their featuresVarious input devices showing their features
Various input devices showing their featuresLavan1997
 
Computer fundamental 2 Some information about computer. its input device and ...
Computer fundamental 2 Some information about computer. its input device and ...Computer fundamental 2 Some information about computer. its input device and ...
Computer fundamental 2 Some information about computer. its input device and ...HamaQarani
 

Similar to grahics (20)

Input devices.ppt
Input devices.pptInput devices.ppt
Input devices.ppt
 
I/O Devices
I/O DevicesI/O Devices
I/O Devices
 
Computer Parts
Computer PartsComputer Parts
Computer Parts
 
Assignment on Input and output devices
Assignment on Input and output devicesAssignment on Input and output devices
Assignment on Input and output devices
 
Input output devices
Input output devicesInput output devices
Input output devices
 
ITC_lec_4.ppt
ITC_lec_4.pptITC_lec_4.ppt
ITC_lec_4.ppt
 
Input device pp.pptx
Input device pp.pptxInput device pp.pptx
Input device pp.pptx
 
Introduction of Computers & C++ Programming
Introduction of Computers & C++ Programming Introduction of Computers & C++ Programming
Introduction of Computers & C++ Programming
 
Input and output devices.pdf
Input and output devices.pdfInput and output devices.pdf
Input and output devices.pdf
 
Input devices
Input devicesInput devices
Input devices
 
Chapter 03 game input
Chapter 03 game inputChapter 03 game input
Chapter 03 game input
 
Input devices
Input devicesInput devices
Input devices
 
Presentation(Input,output,stoarage)
Presentation(Input,output,stoarage)Presentation(Input,output,stoarage)
Presentation(Input,output,stoarage)
 
Input devices
Input devicesInput devices
Input devices
 
Hint 1 2D array of type Button, all buttons hidden except for one.pdf
Hint 1 2D array of type Button, all buttons hidden except for one.pdfHint 1 2D array of type Button, all buttons hidden except for one.pdf
Hint 1 2D array of type Button, all buttons hidden except for one.pdf
 
Input Devices
Input DevicesInput Devices
Input Devices
 
Various input devices showing their features
Various input devices showing their featuresVarious input devices showing their features
Various input devices showing their features
 
Input devices
Input  devicesInput  devices
Input devices
 
Input devices
Input devicesInput devices
Input devices
 
Computer fundamental 2 Some information about computer. its input device and ...
Computer fundamental 2 Some information about computer. its input device and ...Computer fundamental 2 Some information about computer. its input device and ...
Computer fundamental 2 Some information about computer. its input device and ...
 

Recently uploaded

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 

Recently uploaded (20)

SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

grahics

  • 2. RM [2]-2 Input Devices  Logical Input Devices Categorized based on functional characteristics. Each device transmits a particular kind of data. The different types of data are called input primitives.  Physical Input Devices Categorized based on the physical machine.
  • 3. RM [2]-3 Logical Input Devices  Locator Devices Input Primitive: Coordinate position (x,y) Examples: Mouse, Keyboard (Cursor- Position Keys), Tablet(Digitizer), Trackballs, Lightpens. Applications: Interactive drawing and editing, Graph digitizing.
  • 6. RM [2]-6 Logical Input Devices  String Devices Input Primitive: A string of characters Example: Keyboard Applications: Text input
  • 7. RM [2]-7 Logical Input Devices  Valuator Input primitive: Scalar values (typically between 0 and 1). Examples: Control Dials, Sensing devices, Joysticks Applications: Input of graphics parameters, Graphics representation of analog values, Process simulation, Games.
  • 8. RM [2]-8 Logical Input Devices  Choice Input primitive: A selection from a list of options. Examples: Mouse, Keyboard (Function Keys), Touch Panel etc Applications: Interactive menu selection, Program control.
  • 9. RM [2]-9 Logical Input Devices  Pick Input primitive: Selection of a part of the screen. Examples: Mouse, Cursor Keys, Tablet. Applications: Interactive editing and positioning.
  • 10. RM [2]-10 Physical Input Devices  Keyboard (input functions: String, Choice, Locator).  Mouse (input functions: Locator, Pick, Choice).  Joystick (input functions: Locator, Valuator).  Knob (Valuator).  Tablet (Locator, Pick).
  • 11. RM [2]-11 3D Interaction Devices (Recent additions) These devices are used in advanced rendering methods and virtual reality systems for providing information about three dimensional positions and motion.Few examples are 1. DATA GLOVES 2. SPACE BALLS 3. IMAGING SENSORS These devices are used in advanced rendering methods and virtual reality systems for providing information about three dimensional positions and motion.Few examples are 1. DATA GLOVES 2 SPACE BALLS
  • 12. RM [2]-12 Space Ball, Data Glove
  • 13. RM [2]-13 Event Driven Programming Event Call-back Functions • Mouse clicked. • Mouse dragged. • A key is pressed. • The window is resized. • The window is moved. • Register. • Define. Event Queue
  • 14. RM [2]-14 Mouse Interaction  Mouse Event Event that occurs when the mouse button is pressed or released.  Mouse Motion Event Event that occurs when the mouse is moved while one of the buttons is pressed.
  • 15. RM [2]-15 Mouse Event  Contains the following information: Button: The mouse button that is pressed – left, middle, right. State: The state of the button – up, down. Position: The position of the mouse when the event occurs (x, y).
  • 16. RM [2]-16 Mouse Event (OpenGL) Registering with Mouse Event: glutMouseFunc(myMouse); Call-back function: void myMouse(int button, int state, int x, int y) Values for button: GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON GLUT_RIGHT_BUTTON Values for state: GLUT_UP, GLUT_DOWN x, y: Screen coordinates of mouse position (origin at top-left corner).
  • 17. RM [2]-17 Mouse Motion Event  Contains the following information: Position: The current position of the mouse as the mouse is being dragged holding one of the buttons pressed. The events are continuously generated as the mouse button is pressed and dragged.
  • 18. RM [2]-18 Mouse Motion Event (OpenGL) Registering with Mouse Motion Event: glutMotionFunc(myMovedMouse); Call-back function: void myMovedMouse(int x, int y) x, y: Screen coordinates of mouse position (origin at top-left corner).
  • 19. RM [2]-19 Keyboard Event  Contains the following information: key: The ASCII value of the key pressed. Position: The current position of the mouse when the key is pressed.
  • 20. RM [2]-20 Keyboard Event (OpenGL) Registering with Keyboard Event: glutKeyboardFunc(myKeyboard); Call-back function: void myKeyboard(unsigned int key, int x, int y) Values of key: ASCII value for normal keys GLUT_KEY_LEFT, GLUT_KEY_RIGHT..(Arrow keys) x, y: Screen coordinates of mouse position (origin at top-left corner).
  • 21. RM [2]-21 Window Events  The Window Redraw Event occurs whenever the window needs to be redrawn. This happens when the window is first opened and when the window is exposed by moving another window off of it.  The Window Reshape Event is generated when the window is resized with the mouse.
  • 22. RM [2]-22 Window Events (OpenGL) Registering with Window Redraw Event: glutDisplayFunc(myDisplay); Registering with Window Reshape Event: glutReshapeFunc(myReshape);