ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3145Callbacks Picking
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3145

    HCI & Computer Graphics

    Progress0 / 73 done
    Topics73
    1Input-output channels2Human memory3Thinking, Reasoning, Problem solving4Emotions and Individual differences5Psychology and design of interacting systems
    6Text entry devices7Positioning, Pointing, and drawing devices8Display devices9Devices for virtual reality and 3D interaction10Physical controls, Sensors and special devices11Paper printing and scanning12Memory, Processing and networks
    13Models of interaction14Frameworks and HCI15Ergonomics16Interaction styles17Elements of the WIMP interfaces18Interactivity and Context of interaction
    19Introduction20Paradigms for interaction
    21What is design22Process of design and User focus23Navigation design24Screen design and layout25Iteration and prototyping
    26Software life cycle27Usability engineering28Iterative design and prototyping29Design rationale30Design rules and Guidelines31Golden rules and heuristics32HCI patterns33Evaluation techniques and methods34Task analysis35Universal design36User support systems37Computer Supported Cooperative Work38Groupware systems39Implementation of synchronous groupware40Ubiquitous computing41History of Computer Graphics42Graphics architectures and software
    43Pinhole camera, Human vision, Synthetic camera44Modeling vs. rendering45OpenGL Architecture46Displaying simple two-dimensional geometric objects47Positioning systems and windowed environment48Color perception and models49RGB, CMY, HLS color models50Color transformations
    51RGB and indexed color
    52Network environment and client-server computing
    53event, sample and request input54Using callbacks and picking
    55translation, rotation, scaling, shear56Homogeneous coordinates and concatenation57Current transformation and matrix stacks
    58Classical viewing59Specifying views in 3D60Affine transformation in 3D61Projective transformations62Ray tracing
    63Illumination and surface modeling64Phong shading model65Polygon shading
    66Line drawing via Bresenham's algorithm67Clipping and polygonal fill68BitBlt operations69Hidden surface removal (z buffer)
    70Buffers71Reading and writing bitmaps and pixel maps72Texture mapping73Compositing
    3 min read
    Topic 54 of 73
    Topic Study Note Illustration
    54

    Using callbacks and picking

    Definition: A callback is a function or routine that is passed as an argument to another function , to be invoked automatically in response to an event...

    1. Callbacks

    Definition: A callback is a function or routine that is passed as an argument to another function, to be invoked automatically in response to an event.

    Purpose in HCI/Graphics:

    • Enable event-driven programming
    • Handle user input such as mouse clicks, keyboard presses, or window resizing

    How it works:

    1. The programmer defines a callback function (e.g., onMouseClick).
    2. The function is registered with the system or graphics library (like OpenGL/GLUT).
    3. When the specific event occurs, the system automatically calls the callback.

    Example in OpenGL/GLUT (C):

    void onMouseClick(int button, int state, int x, int y) {
        if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
            printf("Mouse clicked at (%d, %d)\n", x, y);
        }
    }
    
    int main(int argc, char** argv) {
        glutInit(&argc, argv);
        glutCreateWindow("Callback Example");
        glutMouseFunc(onMouseClick); // Register callback
        glutMainLoop();
    }
    

    Advantages:

    • Makes programs responsive and interactive
    • Separates event handling logic from main program flow

    2. Picking

    Definition: Picking is the process of selecting graphical objects (points, lines, polygons) using an input device like a mouse, stylus, or touch.

    Purpose:

    • Allows users to interact directly with objects on the screen
    • Essential for object manipulation, selection, and editing in 2D/3D graphics

    How Picking Works:

    1. User clicks or points at the screen.
    2. System converts the 2D screen coordinates to the 3D world coordinates.
    3. Objects under the pointer are detected (via bounding boxes or ray intersection).
    4. The selected object is highlighted, moved, or otherwise manipulated.

    Picking Methods:

    • Color-based Picking:

      • Render each object in a unique color to an off-screen buffer.
      • Detect which color is under the cursor → identify the object.
    • Geometry-based Picking:

      • Perform mathematical tests (ray-object intersection) in 3D space.
    • OpenGL Selection Mode (Deprecated but still relevant conceptually):

      • OpenGL can switch to selection mode, render objects, and detect hits using name stacks.

    Example Scenario:

    • In a 3D modeling application, clicking on a cube selects it for rotation or scaling.

    3. Relationship Between Callbacks and Picking

    • Picking often relies on callbacks.

    • For example:

      1. Register a mouse callback (onMouseClick).
      2. When the mouse is clicked, the callback triggers a picking routine.
      3. The system determines which object was selected and performs the desired action.

    Workflow Diagram (Conceptual):

    User clicks → Mouse callback invoked → Picking routine checks objects → Object selected → Action performed
    

    4. Key Takeaways

    • Callbacks allow programs to respond to user input events asynchronously.
    • Picking enables direct interaction with graphical objects.
    • Together, they form the basis of interactive 2D/3D graphics applications, CAD systems, and HCI interfaces.
    ← Previous topic 53
    Input measures: event, sample and request input
    Next topic 55 →
    Affine transformations: translation, rotation, scaling, shear

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    3mremaining
    425words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    HCI & Computer Graphics