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 PortalCOMP3145Color Opengl
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
    2 min read
    Topic 51 of 73
    Topic Study Note Illustration
    51

    Color in OpenGL: RGB and indexed color

    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. 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 view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    2mremaining
    417words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    HCI & Computer Graphics