Chapter 4 -- Color1 Color Open GL Chapter 4. Chapter 4 -- Color2 n The goal of almost all OpenGL applications is to draw color pictures in a window on.

Slides:



Advertisements
Similar presentations
Presented by: Stacy C. Lovell. How do we perceive color? Our eyes contain only 3 types of photosentitive cells tuned to three frequencies Red, Green,
Advertisements

OpenGL Course Notes Chapter 5: Lighting Jim Mims, Spring 2009.
OpenGL Course Notes Chapter 2: State Management and Drawing Geometric Objects Jim Mims, Spring 2009.
Computer Science 101 RGB Color System. Simplified Introduction to Color Vision Go to How We See: The First Steps of Human Vision or Color Vision for more.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Achromatic and Colored Light CS 288 9/17/1998 Vic.
Aalborg University Copenhagen
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
Sep 21, Fall 2005ITCS4010/ Computer Graphics Overview Color Displays Drawing Pipeline.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
Color.
1 Lecture 6 Attributes of graphical primitives Colors Colors in OpenGL Algorithms for scan-conversion.
UniS CS297 Graphics with Java and OpenGL Colour and Lighting.
Sep 21, Fall 2006IAT 4101 Computer Graphics Overview Color Displays Drawing Pipeline.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Image Representation.
1 Perception. 2 “The consciousness or awareness of objects or other data through the medium of the senses.”
Color in OpenGL (Chapter 4) Presented by: Stacy C. Lovell.
CMYK Cyan Cyan Magenta Magenta Yellow Yellow Black Black.
JOGL in MS Windows GDI – Graphics Device Interface (Windows-specific) OpenGL Lib JOGL Commands GDI Processor Graphics Hardware JOGL Lib.
Any questions about the current assignment? (I’ll do my best to help!)
ATTRIBUTES OF GRAPHICS PRIMITIVES CA 302 Computer Graphics and Visual Programming Aydın Öztürk
© 1999 Rochester Institute of Technology Color. Imaging Science Workshop for Teachers ©Chester F. Carlson Center for Imaging Science at RIT Color Images.
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
Tools for Raster Displays CVGLab Goals of the Chapter To describe pixmaps and useful operations on them. To develop tools for copying, scaling, and rotating.
I-1 Steps of Image Generation –Create a model of the objects –Create a model for the illumination of the objects –Create an image (render) the result I.
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
25.2 The human eye The eye is the sensory organ used for vision.
UNIT EIGHT: Waves Chapter 24 Waves and Sound Chapter 25 Light and Optics.
WHAT DO WE KNOW ABOUT LIGHT?. What is Light? Light is a wave that we can see. –Light can carry heat and warmth. –Light has color. –Light can be bright.
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
CSC Computing with Images
1 Chapter 2: Color Basics. 2 What is light?  EM wave, radiation  Visible light has a spectrum wavelength from 400 – 780 nm.  Light can be composed.
Light Can Act Like Waves or Particles In 1801 Thomas Young an English scientist did the Double slit experiment. In 1801 Thomas Young an English scientist.
Using Inventor with OpenGL Chapter objectives Create Inventor callback nodes that include calls to the OpenGL Library Explain how Inventor.
Introduction to OpenGL. OpenGL is a low-level graphics library specification. It makes available to the programmer  a small set of geometric primitives.
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
Now let’s focus on… The visible spectrum The visible spectrum –Light and pigment.
Three-Receptor Model Designing a system that can individually display thousands of colors is very difficult Instead, colors can be reproduced by mixing.
Introduction to Computer Graphics
Color and Color Models Angel 2.5 Angel: Interactive Computer Graphics5E © Addison-Wesley
1 Graphics CSCI 343, Fall 2015 Lecture 5 Color in WebGL.
NoufNaief.net 1 TA: Nouf Al-Harbi.
UniS CS297 Graphics with Java and OpenGL Blending.
LIGHT Chapter Twenty-Five: Light  25.1 Properties of Light  25.2 Color and Vision  25.3 Optics.
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Chapter 3 Color Objectives Identify the color systems and resolution Clarify category of colors.
The Framebuffer Hyun-Chul Cho. HyunChul Cho - KUCG -2 Buffer Goal of a graphics program Draw pictures on the screen Screen Rectangular array.
16.2 Color and Vision. Chapter 16 Objectives  Describe at least five properties of light.  Describe the meaning of the term “intensity.”  Use the speed.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
The Visible Spectrum And how we see it. What is Visible Light? The cones in the eye are only sensitive to a narrow range of EM frequencies. Visible Light.
Hue Do You Think Hue Are?. The Properties of Color There are three fundamental properties by which color is characterized: hue, value and chroma.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics Lecture 34. OpenGL Programming II Taqdees A. Siddiqi
Computer Graphics Overview
CSC Graphics Programming
Design Concepts: Module A: The Science of Color
25.2 The human eye The eye is the sensory organ used for vision.
What you should know about light!!
Programming with OpenGL Part 2: Complete Programs
Why does a blue shirt look blue?
White light is a combination of all of the colors of the rainbow.
Light Waves Day 1.
Color and Shading Lecture 9 Mon, Sep 26, 2005.
Multimedia System Image
Programming with OpenGL Part 2: Complete Programs
CS297 Graphics with Java and OpenGL
Presentation transcript:

Chapter 4 -- Color1 Color Open GL Chapter 4

Chapter 4 -- Color2 n The goal of almost all OpenGL applications is to draw color pictures in a window on the screen. u Thus in a sense, the point of all the calculations performed by OpenGL commands is to determine the final color of every pixel that is to be drawn in the window. n This chapter explains the commands for specifying colors and how OpenGL interprets them.

Chapter 4 -- Color3 Color Perception n Practically light is composed of photons - each traveling along its own path, and each vibrating at its own frequency (or wavelength, or energy) u wavelengths ranging from about 390 nm (violet) and 720 nm (red) cover the colors of the visible spectrum.

Chapter 4 -- Color4 u The human eye perceives color when certain cells in the retina (called cone cells) become excited after being struck by photons. F The three different kinds of cone cells respond best to three different wavelengths of light: One type responds to red, one to blue, and the other to green. u Since each color is recorded by the eye as the levels of excitation of the cone caused by the incoming photons, the eye can perceive colors that aren’t in the spectrum (magenta, turquoises, …)

Chapter 4 -- Color5 Computer Color n On a color computer screen, the hardware causes each pixel on the screen to emit different amounts of red, green, and blue light. (RGB values) n They are often packed together, sometimes with a fourth value, called blending, or A) u See Chapter 6 for a discussion on alpha values.

Chapter 4 -- Color6 n The color information for each pixel can be stored in one of two major ways: u RGBA mode (each of the four values are stored at each pixel) or in u color-index mode (a single number is stored at each pixel and it is an index into a table called a color map) F Since color maps are controlled by the window system, there are no OpenGL commands to do this. F All examples in this book use GLUT routines to initialize this (see Appendix D for more info)

Chapter 4 -- Color7 u Sample Code: F glColor3f(1.0, 0.0, 0.0); F glBegin(GL_POINTS); F glVertex3fv(points_array); F glEnd( ); u The R, G, and B values can range from 0.0 (none) to 1.0 (full intensity) F for example (0.0, 0.0, 1.0) represents the brightest possible blue.

Chapter 4 -- Color8 RGBA versus Color-Index Mode n In either color-index or RGBA mode, a certain amount of color data is stored at each pixel u This amount is determined by the number of bitplanes u If there are 8 color bitplanes, there are 8 color bits per pixel, and hence 2 8 = 256 different values or colors that can be stored at that pixel.

Chapter 4 -- Color9 n RGBA Display Mode u In RGBA mode, the hardware sets aside a certain number of bitplanes for each of the R, G, B, and A components (it usually is, but is not necessarily the same number per part) F values are typically stored as integers -- not floats F and the float values are scaled to the number of available bits for storage and retrieval  glGetInetegerv( ) with GL_RED_BITS, … will let you find out how many bits are available.

Chapter 4 -- Color10 n Color-Index Display Mode u With color-index mode, OpenGL uses a color map (or lookup table), F which is similar to using a palette to mix paints to prepare for a paint-by-umber scene u A computer stores the color index in the bitplanes for each pixel. Then those bitplane values reference the color map, and the screen is painted with the corresponding red, green, and blue values from the color map. F The number of colors is limited by the size of the color map (which is limited by the number of bit planes)

Chapter 4 -- Color11 n Choosing between RGBA and Color-Index Mode u You should base your decision to use RGBA or color-index mode on what hardware is available and on what your application requires. u In general, use RGBA mode whenever possible. It works with texture mapping, and works better with lighting, shading, fog, antialiasing, and blending.

Chapter 4 -- Color12 Specifying a Color and a Shading Model n Specifying a Color in RGBA Mode  In RGBA mode, use the glColor*( ) command to select the current color F There are two major variants (3 or 4 parameters) F Each can have 8 different data types F and each can take them directly or in a vector.

Chapter 4 -- Color13 n Specifying a Color in Color-Index Mode  In color-index mode, use the glIndex*( ) command to select a single color index as the current color index.  glIndex( ) also has a bunch of options in data types.  glClearColor( ) and glClearIndex( ) set the clearing colors. F OpenGL does not have any routines to load values into the color-lookup table. F Window systems typically already have such operations.  GLUT has the routine glutSetColor( ) to call the window specific commands

Chapter 4 -- Color14 n Specifying a Shading Model u A line or filled polygon primitive can be drawn with a single color (flat shading) or with many different colors (smooth shading or Gouraund shading). u void glShadeModel(Glenum mode); F Sets the default shading model.  the parameter can be either GL_SMOOTH (the default) or GL_FLAT.