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›Color in OpenGL: RGB and indexed color
    HCI & Computer GraphicsTopic 51 of 73

    Color in OpenGL: RGB and indexed color

    2 minread
    417words
    Beginnerlevel

    1. Color in OpenGL

    In OpenGL, colors are used to define the appearance of points, lines, polygons, and other primitives. OpenGL supports multiple ways to specify colors, primarily:

    1. RGB color mode (direct color specification)
    2. Indexed color mode (color via a lookup table)

    2. RGB Color Mode

    Definition: The RGB mode specifies color directly using red, green, and blue components. This is also called true color.

    Components:

    • Red (R), Green (G), Blue (B)

    • Each component can be represented as:

      • Floating-point: 0.0 – 1.0
      • Integer: 0 – 255

    How to Set Color in OpenGL:

    // Using floating-point values
    glColor3f(1.0, 0.0, 0.0);  // Red
    glColor3f(0.0, 1.0, 0.0);  // Green
    glColor3f(0.0, 0.0, 1.0);  // Blue
    
    // Using integer values
    glColor3ub(255, 0, 0);  // Red
    

    Advantages:

    • Supports millions of colors (true color)
    • No restriction on color palette

    Applications:

    • Realistic rendering of images, 3D graphics, and games

    3. Indexed Color Mode

    Definition: In indexed color mode, colors are not specified directly. Instead, each pixel stores an index to a color map (palette). The color map contains the actual RGB values.

    How it Works:

    1. OpenGL maintains a color map (lookup table).
    2. Each pixel contains an index (e.g., 0–255 for 8-bit mode).
    3. OpenGL looks up the RGB value corresponding to that index and renders the pixel.

    Advantages:

    • Saves memory because each pixel stores only an index
    • Useful in limited-color devices or older graphics hardware

    Disadvantages:

    • Limited number of colors (palette size)
    • Changing a color requires modifying the color map

    Example in OpenGL:

    GLubyte colormap[256][3]; // 256 colors
    colormap[0][0] = 255; // Red
    colormap[0][1] = 0;
    colormap[0][2] = 0;
    
    // Pixel index 0 will render as red
    

    4. Comparison: RGB vs Indexed Color

    Feature RGB Mode Indexed Color Mode
    Color specification Direct (R, G, B) Indirect (index to palette)
    Number of colors Millions (True color) Limited (depends on palette size)
    Memory usage More Less (stores only index)
    Flexibility High Low (palette-dependent)
    Use case Modern graphics, realistic rendering Legacy systems, limited hardware

    5. Key Takeaways

    • RGB mode is standard for modern OpenGL applications due to high color fidelity.
    • Indexed color mode was historically important for memory-limited systems and is rarely used today.
    • OpenGL allows switching between modes, but RGB mode is preferred for 3D rendering, textures, and lighting.
    Previous topic 50
    Color transformations
    Next topic 52
    Input: Network environment and client-server computing

    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 time2 min
      Word count417
      Code examples0
      DifficultyBeginner