ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    HCI & Computer Graphics
    COMP3145
    Progress0 / 73 topics
    Topics
    1. The Human: Input-output channels2. Human memory3. Thinking, Reasoning, Problem solving4. Emotions and Individual differences5. Psychology and design of interacting systems6. The Computer: Text entry devices7. Positioning, Pointing, and drawing devices8. Display devices9. Devices for virtual reality and 3D interaction10. Physical controls, Sensors and special devices11. Paper printing and scanning12. Memory, Processing and networks13. The Interaction: Models of interaction14. Frameworks and HCI15. Ergonomics16. Interaction styles17. Elements of the WIMP interfaces18. Interactivity and Context of interaction19. Usability Paradigm and Principles: Introduction20. Paradigms for interaction21. Interaction Design Basics: What is design22. Process of design and User focus23. Navigation design24. Screen design and layout25. Iteration and prototyping26. HCI in Software Process: Software life cycle27. Usability engineering28. Iterative design and prototyping29. Design rationale30. Design rules and Guidelines31. Golden rules and heuristics32. HCI patterns33. Evaluation techniques and methods34. Task analysis35. Universal design36. User support systems37. Computer Supported Cooperative Work38. Groupware systems39. Implementation of synchronous groupware40. Ubiquitous computing41. History of Computer Graphics42. Graphics architectures and software43. Imaging and vision: Pinhole camera, Human vision, Synthetic camera44. Modeling vs. rendering45. OpenGL Architecture46. Displaying simple two-dimensional geometric objects47. Positioning systems and windowed environment48. Color perception and models49. RGB, CMY, HLS color models50. Color transformations51. Color in OpenGL: RGB and indexed color52. Input: Network environment and client-server computing53. Input measures: event, sample and request input54. Using callbacks and picking55. Affine transformations: translation, rotation, scaling, shear56. Homogeneous coordinates and concatenation57. Current transformation and matrix stacks58. Three Dimensional Graphics: Classical viewing59. Specifying views in 3D60. Affine transformation in 3D61. Projective transformations62. Ray tracing63. Shading: Illumination and surface modeling64. Phong shading model65. Polygon shading66. Rasterization: Line drawing via Bresenham's algorithm67. Clipping and polygonal fill68. BitBlt operations69. Hidden surface removal (z buffer)70. Discrete Techniques: Buffers71. Reading and writing bitmaps and pixel maps72. Texture mapping73. Compositing
    COMP3145›Using callbacks and picking
    HCI & Computer GraphicsTopic 54 of 73

    Using callbacks and picking

    3 minread
    425words
    Beginnerlevel

    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 load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time3 min
      Word count425
      Code examples0
      DifficultyBeginner