SlideShare a Scribd company logo
Lighting Basic
1. Default View in OpenGL
2. When Lighting is Enabled
3. When Light Source is Disabled
4.1 Different Types of Light
Specular
Diffuse
Ambient
4.2 Different Types of Light
● Specular: Sets the color for highlights
● Diffuse: is the color of the object when it is
illuminated
● Ambient: is the color of the mesh when it's not
illuminated
● Emissive: is the type of light which is being
emitted by an object
5. Color Used in Example
Original Material Ambient Diffuse
Specular Emissive
5.1 Example
Wireframe 1. Original Color 2. Original Color + Ambient
3. Original Color + Ambient
+ Diffuse
4. Original Color + Ambient
+ Diffuse + Specular
5. Original Color + Ambient
+ Diffuse + Specular +
Emissive
6. Using Light(s) on OpenGL
(a) Enable lighting
(b) Select light source(s)
(c) Set light position
(d) Set light color
(e) Set material color
(f) Set normal to the polygon
(g) Draw polygon
6(a) Enable Lighting
glEnable(GL_LIGHTING);
6(b) Select Light Source(s)
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
Light Sources: 0 - 7
6(c) Set Light Position
// Set the light position
GLfloat lightPosition[] = { 0.5, 1.0, 1.0, 0.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
6(d) Set Light Color
GLfloat colorWhite[] = { 1.00, 1.00, 1.00, 1.0 };
GLfloat colorDarkGray[] = { 0.10, 0.10, 0.10, 1.0 };
GLfloat colorLightGray[] = { 0.75, 0.75, 0.75, 1.0 };
glLightfv(GL_LIGHT0, GL_AMBIENT, colorDarkGray );
glLightfv(GL_LIGHT0, GL_DIFFUSE, colorLightGray);
glLightfv(GL_LIGHT0, GL_SPECULAR, colorWhite );
6(e) Set Material Color
GLfloat colorWhite[] = { 1.00, 1.00, 1.00, 1.0 };
glMaterialfv(GL_FRONT, GL_SPECULAR, colorWhite);
glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
glColor3f(0.40, 0.61, 0.94);
Shininess: 0 - 128
6(f) Set Normal to the Polygon
glBegin(GL_QUADS);
glNormal3f(0, 1, 0);
glVertex3f(0, 0, 0);
glVertex3f(3, 0, 0);
glVertex3f(3, 3, 0);
glVertex3f(0, 3, 0);
glEnd();
6(g) Draw Polygon
glBegin(GL_QUADS);
glNormal3f(0, 1, 0);
glVertex3f(0, 0, 0);
glVertex3f(3, 0, 0);
glVertex3f(3, 3, 0);
glVertex3f(0, 3, 0);
glEnd();
Another Example
No shininess Shininess: 50.0
</end>

More Related Content

What's hot

Intro to unreal with framework and vr
Intro to unreal with framework and vrIntro to unreal with framework and vr
Intro to unreal with framework and vr
Luis Cataldi
 
Game Design Document
Game Design DocumentGame Design Document
Game Design Document
Kika Syafii
 
개발자를 위한 도트디자인입문(2017. 03, 09.)
개발자를 위한 도트디자인입문(2017. 03, 09.)개발자를 위한 도트디자인입문(2017. 03, 09.)
개발자를 위한 도트디자인입문(2017. 03, 09.)
Yunjeong Kim
 
Basic exercises for photoshop
Basic exercises for photoshopBasic exercises for photoshop
Basic exercises for photoshop
Pauline Torion
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
Electronic Arts / DICE
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with UnityPetri Lankoski
 
Mieszko Zielinski (Epic Games), White Nights 2015
Mieszko Zielinski  (Epic Games), White Nights 2015 Mieszko Zielinski  (Epic Games), White Nights 2015
Mieszko Zielinski (Epic Games), White Nights 2015
White Nights Conference
 
OpenGL Texture Mapping
OpenGL Texture MappingOpenGL Texture Mapping
OpenGL Texture Mapping
Syed Zaid Irshad
 
LAFS Game Mechanics - The Core Mechanic
LAFS Game Mechanics - The Core MechanicLAFS Game Mechanics - The Core Mechanic
LAFS Game Mechanics - The Core Mechanic
David Mullich
 
Luis cataldi-ue4-vr-best-practices2
Luis cataldi-ue4-vr-best-practices2Luis cataldi-ue4-vr-best-practices2
Luis cataldi-ue4-vr-best-practices2
Luis Cataldi
 
Level design for games
Level design for gamesLevel design for games
Level design for games
Jayyes
 
Indie Game Development Intro
Indie Game Development IntroIndie Game Development Intro
Indie Game Development Intro
Juan Zamora, MSc. MBA
 
Digital Photography Fundamentals : Aperture, Shutter Speed and Perspective
Digital Photography Fundamentals :  Aperture, Shutter Speed and PerspectiveDigital Photography Fundamentals :  Aperture, Shutter Speed and Perspective
Digital Photography Fundamentals : Aperture, Shutter Speed and Perspective
alexandra copley
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
Mark Kilgard
 
Unity - Internals: memory and performance
Unity - Internals: memory and performanceUnity - Internals: memory and performance
Unity - Internals: memory and performance
Codemotion
 
언차티드4 테크아트 파트1 톤맵핑&색보정
언차티드4 테크아트 파트1 톤맵핑&색보정언차티드4 테크아트 파트1 톤맵핑&색보정
언차티드4 테크아트 파트1 톤맵핑&색보정
Dae Hyek KIM
 
What is OpenGL ?
What is OpenGL ?What is OpenGL ?
What is OpenGL ?
Mohammad Hosein Nemati
 
LAFS SVI Level 3 - Game Design and Analysis
LAFS SVI Level 3 - Game Design and AnalysisLAFS SVI Level 3 - Game Design and Analysis
LAFS SVI Level 3 - Game Design and Analysis
David Mullich
 
Introduction to Level Design
Introduction to Level DesignIntroduction to Level Design
Introduction to Level Design
Rico Lemba
 
Lighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow FallLighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow Fall
Guerrilla
 

What's hot (20)

Intro to unreal with framework and vr
Intro to unreal with framework and vrIntro to unreal with framework and vr
Intro to unreal with framework and vr
 
Game Design Document
Game Design DocumentGame Design Document
Game Design Document
 
개발자를 위한 도트디자인입문(2017. 03, 09.)
개발자를 위한 도트디자인입문(2017. 03, 09.)개발자를 위한 도트디자인입문(2017. 03, 09.)
개발자를 위한 도트디자인입문(2017. 03, 09.)
 
Basic exercises for photoshop
Basic exercises for photoshopBasic exercises for photoshop
Basic exercises for photoshop
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
 
Mieszko Zielinski (Epic Games), White Nights 2015
Mieszko Zielinski  (Epic Games), White Nights 2015 Mieszko Zielinski  (Epic Games), White Nights 2015
Mieszko Zielinski (Epic Games), White Nights 2015
 
OpenGL Texture Mapping
OpenGL Texture MappingOpenGL Texture Mapping
OpenGL Texture Mapping
 
LAFS Game Mechanics - The Core Mechanic
LAFS Game Mechanics - The Core MechanicLAFS Game Mechanics - The Core Mechanic
LAFS Game Mechanics - The Core Mechanic
 
Luis cataldi-ue4-vr-best-practices2
Luis cataldi-ue4-vr-best-practices2Luis cataldi-ue4-vr-best-practices2
Luis cataldi-ue4-vr-best-practices2
 
Level design for games
Level design for gamesLevel design for games
Level design for games
 
Indie Game Development Intro
Indie Game Development IntroIndie Game Development Intro
Indie Game Development Intro
 
Digital Photography Fundamentals : Aperture, Shutter Speed and Perspective
Digital Photography Fundamentals :  Aperture, Shutter Speed and PerspectiveDigital Photography Fundamentals :  Aperture, Shutter Speed and Perspective
Digital Photography Fundamentals : Aperture, Shutter Speed and Perspective
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
Unity - Internals: memory and performance
Unity - Internals: memory and performanceUnity - Internals: memory and performance
Unity - Internals: memory and performance
 
언차티드4 테크아트 파트1 톤맵핑&색보정
언차티드4 테크아트 파트1 톤맵핑&색보정언차티드4 테크아트 파트1 톤맵핑&색보정
언차티드4 테크아트 파트1 톤맵핑&색보정
 
What is OpenGL ?
What is OpenGL ?What is OpenGL ?
What is OpenGL ?
 
LAFS SVI Level 3 - Game Design and Analysis
LAFS SVI Level 3 - Game Design and AnalysisLAFS SVI Level 3 - Game Design and Analysis
LAFS SVI Level 3 - Game Design and Analysis
 
Introduction to Level Design
Introduction to Level DesignIntroduction to Level Design
Introduction to Level Design
 
Lighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow FallLighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow Fall
 

Viewers also liked

Week 2 understand lighting (semester 1)
Week 2 understand lighting (semester 1)Week 2 understand lighting (semester 1)
Week 2 understand lighting (semester 1)
Universiti Teknologi MARA
 
3.2 form 4 light
3.2 form 4 light3.2 form 4 light
3.2 form 4 light
chris lembalemba
 
CS 354 Lighting
CS 354 LightingCS 354 Lighting
CS 354 Lighting
Mark Kilgard
 
Shadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareShadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL Hardware
Mark Kilgard
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.Girish Ghate
 
Tone - an element of Art & Design
Tone - an element of Art & DesignTone - an element of Art & Design
Tone - an element of Art & Design
Neith Moore
 
OpenGL Basics
OpenGL BasicsOpenGL Basics
OpenGL Basics
Sandip Jadhav
 

Viewers also liked (8)

Week 2 understand lighting (semester 1)
Week 2 understand lighting (semester 1)Week 2 understand lighting (semester 1)
Week 2 understand lighting (semester 1)
 
3.2 form 4 light
3.2 form 4 light3.2 form 4 light
3.2 form 4 light
 
CS 354 Lighting
CS 354 LightingCS 354 Lighting
CS 354 Lighting
 
Shadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareShadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL Hardware
 
OpenGL Interaction
OpenGL InteractionOpenGL Interaction
OpenGL Interaction
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.
 
Tone - an element of Art & Design
Tone - an element of Art & DesignTone - an element of Art & Design
Tone - an element of Art & Design
 
OpenGL Basics
OpenGL BasicsOpenGL Basics
OpenGL Basics
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 

Opengl Lighting Basic

  • 2. 1. Default View in OpenGL
  • 3. 2. When Lighting is Enabled
  • 4. 3. When Light Source is Disabled
  • 5. 4.1 Different Types of Light Specular Diffuse Ambient
  • 6. 4.2 Different Types of Light ● Specular: Sets the color for highlights ● Diffuse: is the color of the object when it is illuminated ● Ambient: is the color of the mesh when it's not illuminated ● Emissive: is the type of light which is being emitted by an object
  • 7. 5. Color Used in Example Original Material Ambient Diffuse Specular Emissive
  • 8. 5.1 Example Wireframe 1. Original Color 2. Original Color + Ambient 3. Original Color + Ambient + Diffuse 4. Original Color + Ambient + Diffuse + Specular 5. Original Color + Ambient + Diffuse + Specular + Emissive
  • 9. 6. Using Light(s) on OpenGL (a) Enable lighting (b) Select light source(s) (c) Set light position (d) Set light color (e) Set material color (f) Set normal to the polygon (g) Draw polygon
  • 11. 6(b) Select Light Source(s) glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); Light Sources: 0 - 7
  • 12. 6(c) Set Light Position // Set the light position GLfloat lightPosition[] = { 0.5, 1.0, 1.0, 0.0 }; glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
  • 13. 6(d) Set Light Color GLfloat colorWhite[] = { 1.00, 1.00, 1.00, 1.0 }; GLfloat colorDarkGray[] = { 0.10, 0.10, 0.10, 1.0 }; GLfloat colorLightGray[] = { 0.75, 0.75, 0.75, 1.0 }; glLightfv(GL_LIGHT0, GL_AMBIENT, colorDarkGray ); glLightfv(GL_LIGHT0, GL_DIFFUSE, colorLightGray); glLightfv(GL_LIGHT0, GL_SPECULAR, colorWhite );
  • 14. 6(e) Set Material Color GLfloat colorWhite[] = { 1.00, 1.00, 1.00, 1.0 }; glMaterialfv(GL_FRONT, GL_SPECULAR, colorWhite); glMaterialf(GL_FRONT, GL_SHININESS, 50.0); glColor3f(0.40, 0.61, 0.94); Shininess: 0 - 128
  • 15. 6(f) Set Normal to the Polygon glBegin(GL_QUADS); glNormal3f(0, 1, 0); glVertex3f(0, 0, 0); glVertex3f(3, 0, 0); glVertex3f(3, 3, 0); glVertex3f(0, 3, 0); glEnd();
  • 16. 6(g) Draw Polygon glBegin(GL_QUADS); glNormal3f(0, 1, 0); glVertex3f(0, 0, 0); glVertex3f(3, 0, 0); glVertex3f(3, 3, 0); glVertex3f(0, 3, 0); glEnd();
  • 17. Another Example No shininess Shininess: 50.0