Texturing in OpenGL Lab #7. Creating Textures glEnable ( GL_TEXTURE_2D ); GLuint myTex; glGenTextures ( 1, (GLuint*) &myTex ); glBindTexture ( GL_TEXTURE_2D,

Slides:



Advertisements
Similar presentations
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
Advertisements

1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
1 Understanding of OpenGL TA: Dong Hyun Jeong Instructor : Dr. Kalpathi Subramanian Texture Mapping.
TEXTURE MAPPING JEFF CHASTINE 1. TEXTURE MAPPING Applying an image (or a texture ) to geometry 2D images (rectangular) 3D images (volumetric – such as.
OpenGL Texture Mapping
Terrain Rendering. New Concepts Loading geometry from file Camera animation Advanced lighting and materials Texture mapping Display lists.
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Texture Mapping OpenGl and Implementation Details CS
Rendering with Texture Maps CMPS 160 Assignment 5.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
LAB #1: Computer Graphics Framework IGX is a set of programs which allow you to write graphics programs in C/C++ from plain text files. Benefits: 1. You.
1 Lecture 12 Texture Mapping uploading of the texture to the video memory the application of the texture onto geometry.
Computer Graphics (Fall 2004) COMS 4160, Lecture 11: OpenGL 2
OpenGL Texture Mapping April 16, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Basic Stragegy Three steps to applying a texture.
OpenGL. Textures  Bind Textures similar to binding VBO’s  Create a texture for each object  Generate the texture similar how you generate a VBO buffer.
OpenGL 3.0 Texture Arrays Presentation: Olivia Terrell, Dec. 4, 2008.
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
2IV60 Computer Graphics set 10: Texture mapping Jack van Wijk TU/e.
2002 by Jim X. Chen: 1 Texture Lab At each rendered pixel, selected texels are used either to substitute for or to scale.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Lecture 8: Texture Mapping 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Texture Mapping. Introduction What is Texture Mapping? Types of Texture Mapping –1D, 2D and 3D SDL and OpenGL.
Texturing A picture is worth a thousand words. Texturing Texturing is the art of doing this with any picture to any model.  (This is Opus the Penguin.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
An Interactive Introduction to OpenGL Programming Ed Angel
CS 4363/6353 TEXTURE MAPPING PART II. WHAT WE KNOW We can open image files for reading We can load them into texture buffers We can link that texture.
ECSE-4750 Computer Graphics Fall 2004 Prof. Michael Wozny TA. Abhishek Gattani TA. Stephen
CS380 LAB IV OpenGL Jonghyeob Lee Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
Lecture 27: Texture Mapping Li Zhang Spring 2008
Texture Mapping. 2 Motivation A typical modern graphics card can handle 10s of millions of polygons a second. How many individual blades of grass are.
OpenGL Texture Mapping. 2 Objectives Introduce the OpenGL texture functions and options.
CG1 Labs Wei Li. Back Face Culling // enable back-face culling glEnable( GL_CULL_FACE ); // orientation of front-facing polygons glFrontFace( GL_CCW );
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
Texture Mapping in OpenGL. Texture Mapping Imaging we are “pasting” a picture onto a model  Which part of the picture will be pasted onto which part.
Texture Mapping Drawing Pictures on Polygons. Texture Mapping.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
TEXTURES & OTHER GOODIES Computer Graphics. glTexCoord2f(...); + =
Computer Science Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World.
2 COEN Computer Graphics I Evening’s Goals n Discuss displaying and reading image primitives n Describe texture mapping n Discuss OpenGL modes and.
Computer Graphics Bing-Yu Chen National Taiwan University.
CH8 Frame Buffer Object 1. Introduction Name OpenGL :Frame Buffer Object DirectX:Render Target Usage Render to Texture 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
TEXTURE CSE 410. Add Texture to Polygon glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,texid); // here texid corresponds a bitmap image. glNormal3f(1.0,0.0,0.0);
OpenGL Programming Guide : Texture Mapping Yoo jin wook Korea Univ. Computer Graphics Lab.
OpenGL Graphics Textures. Quiz You didn't see that coming!
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor.
1 Graphics CSCI 343, Fall 2015 Lecture 25 Texture Mapping.
RENDERING TEXTURE 1/30/2016 A.ARUNA/ASSISTANT PROFESSOR/IT/SNSC E 1.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
Mouse Input. For Further Reading Learning WebGL, Lesson 11: 2.
Computer Graphics I, Fall 2010 Building Models.
Wilf Comp Ambient Occlusion + Order Independent Transparency POST CONCLUSIONS.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Madhulika (18010), Assistant Professor, LPU.
Texture Mapping We can improve the realism of graphics models by mapping a texture pattern (image) onto the modeled object surface. We refer to this technique.
Texture Mapping Part II
Advanced Graphics Algorithms Ying Zhu Georgia State University
OpenGL Texture Mapping
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Assignment 3 Particle System
Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass, wall paper. Use.
OpenGL Texture Mapping
Programming Textures Lecture 15 Fri, Sep 28, 2007.
CS 480/680 (Fall 2018) Part 2: Texture Loading
Textures in WebGL.
Presentation transcript:

Texturing in OpenGL Lab #7

Creating Textures glEnable ( GL_TEXTURE_2D ); GLuint myTex; glGenTextures ( 1, (GLuint*) &myTex ); glBindTexture ( GL_TEXTURE_2D, myTex ); glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 ); int xres = 256; int yres = 256; char* data; glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, xres, yres, 0, GL_RGB, GL_UNSIGNED_BYTE, data );

In IGX, these steps are already done for you: ImageXimg; void setup () { img.Load ( “abc.jpg” );// does glGenTexture img.Update (0);// does glTexImage2D int id = img.getGLID ();// Give the OpenGL id }

Binding and Using Textures glEnable ( GL_TEXTURE_2D ); glBindTexture ( GL_TEXTURE_2D, id ); Texture Coordinates Similar to glColor and glNormal3f, goes before glVertex. Sets the UV texture coordinate for the next vertex. glTexCoord2f ( u,v );glVertex3f ( 1, 0, 0 ); glTexCoord2f ( u,v );glVertex3f ( 0, 1, 0 );

Lab #7 You are given a rendered cube like this. An image which contains 6 sides is already loaded: abc.jpg

Modify the code to bind the texture and apply UV coordinates so that the cube is properly textured to look like a Toy block. Lab #7 Notice that the side letters are B, C, D, E in order, upright. The bottom is F.

Advanced: * Create and animate a texture without using the ImageX class. You need to: 1) Create an array of bytes to hold the data 2) Call glGenTexture and glTexImage2D to load the data 3) Change the texture over time. This could be done by painting it using the mouse, or modifying by a function over time. 4) If you animate the texture, you must call glTexImage2D in the draw3D portion (not setup). This makes sure the image is continuously updated on the GPU. 5) Call glBindTexture and glTexCoords to render the texture on object.