Mouse events, Advanced camera control George Georgiev Telerik Corporation www.telerik.com.

Slides:



Advertisements
Similar presentations
OpenGL Open a Win32 Console Application in Microsoft Visual C++.
Advertisements

OpenGL CMSC340 3D Character Design & Animation. What is OpenGL? A low-level graphics library specification designed for use with the C and C++ provides…
1 Computer Graphics Chapter 2 Input Devices. RM[2]-2 Input Devices Logical Input Devices  Categorized based on functional characteristics.  Each device.
CS 450: COMPUTER GRAPHICS GLUT INPUT FUNCTIONS SPRING 2015 DR. MICHAEL J. REALE.
AXIS Camera Recorder. Value Proposition  AXIS Camera Recorder Offers all core video recording and monitoring functionality at an attractive price level.
Korsan Yazılım Adaptive User Interface.  Team Members  Problem Definition  Market Research  Our Motivation & Solution  System Features  Demo Video.
OpenGL (I). What is OpenGL (OGL)? OGL is a 3D graphics & modeling library Can also use it to draw 2D objects.
CSC 461: Lecture 51 CSC461 Lecture 5: Simple OpenGL Program Objectives: Discuss a simple program Discuss a simple program Introduce the OpenGL program.
Painterly Rendering CMPS Assignment 2. OpenGL OpenGL is a cross-language, cross- platform specification defining and API for 2D and 3D graphics.
Device Independent Graphics and OpenGL
Computer Graphics (Fall 2005) COMS 4160, Lecture 10: OpenGL 1
31/1/2006Based on: Angel (4th Edition) & Akeine-Möller & Haines (2nd Edition)1 CSC345: Advanced Graphics & Virtual Environments Lecture 3: Introduction.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 GLUT Callback Functions.
CSC461 Lecture 9: GLUT Callbacks Objectives Introduce double buffering for smooth animations Programming event input with GLUT.
CS 480/680 Computer Graphics Programming with Open GL Part 8: Working with Callbacks Dr. Frederick C Harris, Jr. Fall 2011.
Using Graphics Libraries Lecture 3 Mon, Sep 1, 2003.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Graphics Programming and OpenGL.
Events and Coordinates Lecture 5 Fri, Sep 5, 2003.
1 Working with Callbacks Yuanfeng Zhou Shandong University.
WORKING WITH CALLBACKS Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Angel: Interactive.
Interaction with Graphics System
Prepared by Fareeha Lecturer DCS IIUI 1 Windows API.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
FLTK Help Session By Richard Yu Gu CS 638 -Graphics Fall, 1999.
Lecture 3 OpenGL.
Glut Coordinate System Used in keyboard and mouse callbacks x y w h [window]
1 Input and Interaction. 2 Input Devices Physical input devices Keyboard devices and pointing devices Logical input devices.
The mouse What is a mouse.
Write a Simple Program with OpenGL & GLUT. Books OpenGL Programming Guide (Red-book) OpenGL Reference Manual (Blue-book) OpenGL Super Bible
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
Managing Multiple Windows with OpenGL and GLUT
FLTK. Objectives Install and Use FLTK Widgets ◦Callbacks Handling event ◦System events ◦Mouse events ◦Keyboard events.
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.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Computer Graphics I, Fall 2010 Working with Callbacks.
Pop-Up Menus Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 26, 2003.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor.
“RINGS” PES Institute of Technology and Management Presented by Under the Guidance of Mr. ABHISHEK S A 4PM12CS002 Mr. ASHWIN K KASHYAP 4PM12CS015 Mr. DEVARAJ.
The WM_NCHITTEST Message  This is an internal message used by Windows for generating all the other mouse messages.  Though it almost never needs to be.
Virtual Pointing Device Using Stereo Camera The 6th International Conference on Applications and Principles of Information Science Jan , 2007, Kuala.
12/22/ :38 1 Comp 175C - Computer Graphics Dan Hebert Computer Graphics Comp 175 Chapter 3 Instructor: Dan Hebert.
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 6. Dynamic Documents With JavaScript.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Working with Callbacks.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
INTRODUCTION TO OPENGL
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
CS 480/680 Computer Graphics Programming with Open GL Part 2: Complete Programs Dr. Frederick C Harris, Jr. Fall 2011.
Basic Program with OpenGL and GLUT
Review GLUT Callback Functions
Working with Callbacks
Window reshaping, Keyboard interaction, Camera, Drawing objects
Introduction to the Mouse
The User Interface Lecture 2 Mon, Aug 27, 2007.
Advanced Menuing, Introduction to Picking
OpenGL Basics OpenGL’s primary function – Rendering
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Working with Callbacks
Simple Windows Applications
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Download : to follow along.
Windowing Push-Pull Systems
Programming with OpenGL Part 2: Complete Programs
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Tonga Institute of Higher Education
Lecture #5 Interactive Input Methods
Managing Multiple Windows with OpenGL and GLUT
Programming with OpenGL Part 2: Complete Programs
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/19.
Chapter 3 arrays of vertices vertex arrays display lists drawing text
Presentation transcript:

Mouse events, Advanced camera control George Georgiev Telerik Corporation

 GLUT Mouse Interaction  Mouse up/down events  Passive motion  Active motion  OpenGL Camera  Default transformation  “Manual” control  Custom camera class 2

Mouse event callbacks

4  GLUT provides mouse detection capabilities  Advantages  Multi-platform  Similar to other GLUT routines  Easy to code  Disadvantages  Doesn’t receive device information  No scroll information  Unstable ‘leave’ and ‘enter’ events

5  Detecting mouse buttons  Registering callback function  glutMouseFunc(void(*func)(int button, int state, int x, int y))  func – mouse button callback function  button – mouse button raising the event  state – type of event  x, y – cursor coordinates (from upper left corner)

6  Detecting mouse buttons (2)  Callback parameter values  button  GLUT_LEFT_BUTTON  GLUT_MIDDLE_BUTTON  GLUT_RIGHT_BUTTON  state  GLUT_DOWN  GLUT_UP

7  Detecting mouse buttons (2)  Callback parameter values  button  GLUT_LEFT_BUTTON  GLUT_MIDDLE_BUTTON  GLUT_RIGHT_BUTTON  state  GLUT_DOWN  GLUT_UP

8  Detecting movement  Types  Passive  Mouse moves  No buttons pressed  Active  Mouse moves  One or more buttons pressed

9  Passive motion  Registering callback function  glutPassiveMotionFunc(void(*func)(int x, int y))  func – mouse passive motion callback  x, y – cursor coordinates (from upper left corner)

10  Active motion  Registering callback function  glutMotionFunc(void(*func)(int x, int y))  func – mouse active motion callback  x, y – cursor coordinates (from upper left corner)

 GLUT Mouse leave and entry routines  Detect when cursor leaves and enters window  Registering callback  glutEntryFunc(void(*func)(int state))  Func – callback handling cursor leaving and entering window  State – enter or leave event  GLUT_ENTERED  GLUT_LEFT 11

 Cursor-related routines  glutWarpPointer (int x, int y)  Sends cursor to specified coordinates  glutSetCursor (int cursor)  Sets the cursor image (style) for the window  Values:  GLUT_CURSOR_NONE, GLUT_CURSOR_INFO, GLUT_CURSOR_DESTROY, etc…  Google for more (much, much more) 12

 Object-oriented mouse handling  Custom mouse class  Current cursor position  Last cursor position and/or drag-begin position  Current mouse button states  Last mouse button states  Cursor style  Anything else you can think of 13

Live Demo