SlideShare a Scribd company logo
1 of 12
Display List Texture Mapping CS3241 Lab 8
Objective Display List Understanding the benefit & limitation Setup Display List Texturing Understanding basic texture mapping Specify a texture image  Generated by program, e.g. checkerboard Loaded from file Using texture object Supply texture co-ordinate
Display List vs Immediate Mode Faster  As geometries are cached See the difference (sample program loading dino) Once setup, cannot be changed
Display List Generating empty display list (init) baseId = glGenLists(range); Setup the list (init) glNewList(id, GL_COMPILE);  		// your draw code  glEndList();  Using the list (display) glCallList(id);
Task 1 Task 1.1 Use display list to draw a teapot Task 1.2 Use display list to draw 4 wheels attaching the teapot So we have the body and wheels. What’s next? Animation Loading Mesh Texturing Material…..
Texture Enabling /Disabling Texture Mapping glEnable/glDisable(GL_TEXTURE_1D); glEnable/glDisable(GL_TEXTURE_2D);
Texture Object Better texture management Generate texture name (init) GLuinttexObj;           // global glGenTextures(1, &texObj);// init() Bind texture Object to texture data (init) glBindTexture(GL_TEXTURE_2D, texObj); glTexParameter*(); 	// setup parameter 		glTexImage2D(…..);	// alloc space & copy texture map Using texture Object (display) glBindTexture(GL_TEXTURE_2D, texObj); glutSolidTeapot(1); TextureName (Gluint) Parameter Texture Data Texture Object
Texture Parameters Repeating / Clamping Direction – s/t Repeating Clamping
Texture Parameters Filtering
Texture Coordinate To supply texture coordinate to a vertex Add glTexCoord2f(s, t); before specifying the vertex E.g. glBegin(GL_QUADS);  glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); ….. glEnd(); 5,5 5,0 0,0 0,5
Task 2 Task 2.1 Load a texture from program generated source / file Apply to Teapot Task 2.2 Supply texture co-ordinate to a plane  Apply the texture in 2.1 to the plane
Example Modeling a car Separating different part of the mesh For animating the front wheel can move according to key in:P All the wheels will rotate according to its speed For having different texture/material Try to extend it by putting better mesh :P

More Related Content

What's hot

What's hot (20)

130717666736980000
130717666736980000130717666736980000
130717666736980000
 
Objective C Primer (with ref to C#)
Objective C  Primer (with ref to C#)Objective C  Primer (with ref to C#)
Objective C Primer (with ref to C#)
 
Taming the browser with the YUI Dom Component
Taming the browser with the YUI Dom ComponentTaming the browser with the YUI Dom Component
Taming the browser with the YUI Dom Component
 
Object Oriented Programming Assignment 3
Object Oriented Programming Assignment 3Object Oriented Programming Assignment 3
Object Oriented Programming Assignment 3
 
Javascript - Array - Creating Array
Javascript - Array - Creating ArrayJavascript - Array - Creating Array
Javascript - Array - Creating Array
 
Object Oriented Programming Assignment 2
Object Oriented Programming Assignment 2Object Oriented Programming Assignment 2
Object Oriented Programming Assignment 2
 
Animasi di andengine
Animasi di andengineAnimasi di andengine
Animasi di andengine
 
Object Oriented Programming Assignment 4
Object Oriented Programming Assignment 4Object Oriented Programming Assignment 4
Object Oriented Programming Assignment 4
 
Heap Sort in Design and Analysis of algorithms
Heap Sort in Design and Analysis of algorithmsHeap Sort in Design and Analysis of algorithms
Heap Sort in Design and Analysis of algorithms
 
What Haskell taught us when we were not looking! - Eric Torreborre - Codemoti...
What Haskell taught us when we were not looking! - Eric Torreborre - Codemoti...What Haskell taught us when we were not looking! - Eric Torreborre - Codemoti...
What Haskell taught us when we were not looking! - Eric Torreborre - Codemoti...
 
The Weather of the Century Part 3: Visualization
The Weather of the Century Part 3: VisualizationThe Weather of the Century Part 3: Visualization
The Weather of the Century Part 3: Visualization
 
Intro to ggplot2 - Sheffield R Users Group, Feb 2015
Intro to ggplot2 - Sheffield R Users Group, Feb 2015Intro to ggplot2 - Sheffield R Users Group, Feb 2015
Intro to ggplot2 - Sheffield R Users Group, Feb 2015
 
Javascript - Array - Writing
Javascript - Array - WritingJavascript - Array - Writing
Javascript - Array - Writing
 
The Weather of the Century
The Weather of the CenturyThe Weather of the Century
The Weather of the Century
 
Pandas Cheat Sheet
Pandas Cheat SheetPandas Cheat Sheet
Pandas Cheat Sheet
 
Pandas pythonfordatascience
Pandas pythonfordatasciencePandas pythonfordatascience
Pandas pythonfordatascience
 
Weather scraper for your data warehouse
Weather scraper for your data warehouseWeather scraper for your data warehouse
Weather scraper for your data warehouse
 
Weather of the Century: Visualization
Weather of the Century: VisualizationWeather of the Century: Visualization
Weather of the Century: Visualization
 
Do something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as databaseDo something in 5 minutes with gas 1-use spreadsheet as database
Do something in 5 minutes with gas 1-use spreadsheet as database
 
Application of Google Earth Engine in Open NAPs
Application of Google Earth Engine in Open NAPsApplication of Google Earth Engine in Open NAPs
Application of Google Earth Engine in Open NAPs
 

Similar to Cs3241 Lab 8

Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
karymadelaneyrenne19
 
Publishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorialPublishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorial
Sebastian Correa Gimenez
 

Similar to Cs3241 Lab 8 (20)

Opensource gis development - part 3
Opensource gis development - part 3Opensource gis development - part 3
Opensource gis development - part 3
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
 
The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184The Ring programming language version 1.5.3 book - Part 58 of 184
The Ring programming language version 1.5.3 book - Part 58 of 184
 
The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184The Ring programming language version 1.5.3 book - Part 48 of 184
The Ring programming language version 1.5.3 book - Part 48 of 184
 
Xgboost
XgboostXgboost
Xgboost
 
OpenGL Texture Mapping
OpenGL Texture MappingOpenGL Texture Mapping
OpenGL Texture Mapping
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184The Ring programming language version 1.5.3 book - Part 10 of 184
The Ring programming language version 1.5.3 book - Part 10 of 184
 
Collections
CollectionsCollections
Collections
 
Data Exploration in R.pptx
Data Exploration in R.pptxData Exploration in R.pptx
Data Exploration in R.pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
C++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptxC++ STL (quickest way to learn, even for absolute beginners).pptx
C++ STL (quickest way to learn, even for absolute beginners).pptx
 
Compose camp 2.pptx
Compose camp 2.pptxCompose camp 2.pptx
Compose camp 2.pptx
 
Data Mining Lab Manual.docx
Data Mining Lab Manual.docxData Mining Lab Manual.docx
Data Mining Lab Manual.docx
 
The Ring programming language version 1.5.4 book - Part 10 of 185
The Ring programming language version 1.5.4 book - Part 10 of 185The Ring programming language version 1.5.4 book - Part 10 of 185
The Ring programming language version 1.5.4 book - Part 10 of 185
 
1 introduction computer graphics
1 introduction computer graphics1 introduction computer graphics
1 introduction computer graphics
 
Learn Java 3D
Learn Java 3D Learn Java 3D
Learn Java 3D
 
The Ring programming language version 1.3 book - Part 38 of 88
The Ring programming language version 1.3 book - Part 38 of 88The Ring programming language version 1.3 book - Part 38 of 88
The Ring programming language version 1.3 book - Part 38 of 88
 
Publishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorialPublishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorial
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Cs3241 Lab 8

  • 1. Display List Texture Mapping CS3241 Lab 8
  • 2. Objective Display List Understanding the benefit & limitation Setup Display List Texturing Understanding basic texture mapping Specify a texture image Generated by program, e.g. checkerboard Loaded from file Using texture object Supply texture co-ordinate
  • 3. Display List vs Immediate Mode Faster As geometries are cached See the difference (sample program loading dino) Once setup, cannot be changed
  • 4. Display List Generating empty display list (init) baseId = glGenLists(range); Setup the list (init) glNewList(id, GL_COMPILE); // your draw code glEndList(); Using the list (display) glCallList(id);
  • 5. Task 1 Task 1.1 Use display list to draw a teapot Task 1.2 Use display list to draw 4 wheels attaching the teapot So we have the body and wheels. What’s next? Animation Loading Mesh Texturing Material…..
  • 6. Texture Enabling /Disabling Texture Mapping glEnable/glDisable(GL_TEXTURE_1D); glEnable/glDisable(GL_TEXTURE_2D);
  • 7. Texture Object Better texture management Generate texture name (init) GLuinttexObj; // global glGenTextures(1, &texObj);// init() Bind texture Object to texture data (init) glBindTexture(GL_TEXTURE_2D, texObj); glTexParameter*(); // setup parameter glTexImage2D(…..); // alloc space & copy texture map Using texture Object (display) glBindTexture(GL_TEXTURE_2D, texObj); glutSolidTeapot(1); TextureName (Gluint) Parameter Texture Data Texture Object
  • 8. Texture Parameters Repeating / Clamping Direction – s/t Repeating Clamping
  • 10. Texture Coordinate To supply texture coordinate to a vertex Add glTexCoord2f(s, t); before specifying the vertex E.g. glBegin(GL_QUADS); glTexCoord2f(0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); ….. glEnd(); 5,5 5,0 0,0 0,5
  • 11. Task 2 Task 2.1 Load a texture from program generated source / file Apply to Teapot Task 2.2 Supply texture co-ordinate to a plane Apply the texture in 2.1 to the plane
  • 12. Example Modeling a car Separating different part of the mesh For animating the front wheel can move according to key in:P All the wheels will rotate according to its speed For having different texture/material Try to extend it by putting better mesh :P