Assignment 3b Q&A.

Slides:



Advertisements
Similar presentations
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
Advertisements

1 Understanding of OpenGL TA: Dong Hyun Jeong Instructor : Dr. Kalpathi Subramanian Texture Mapping.
OpenGL Texture Mapping
Texture Mapping OpenGl and Implementation Details CS
GLSL Applications: 2 of 2 Patrick Cozzi University of Pennsylvania CIS Spring 2011.
CSC345: Advanced Graphics & Virtual Environments
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
ADDITIONAL TIPS Multi-texture Slides. Here is a link Workflow: /**************In texture parameter set up******/ call glActiveTextureARB(/*pick texture.
1 Lecture 12 Texture Mapping uploading of the texture to the video memory the application of the texture onto geometry.
OpenGL Texture Mapping April 16, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Basic Stragegy Three steps to applying a texture.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
CSE (Notre Dame) Computer Graphics Lecture 16 A Simple Draw Image Example More Texture Mapping Simple OpenGL Image Library (SOIL) Transparency &
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
Computer Graphics Texture Mapping Eriq Muhammad Adams
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
Lecture 8: Texture Mapping 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 718,  ex 2271
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Texture Mapping. Introduction What is Texture Mapping? Types of Texture Mapping –1D, 2D and 3D SDL and OpenGL.
Texture Mapping. Example Mappings Mapping Techniques Consider the problem of rendering a sphere in the examples The geometry is very simple - a sphere.
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.
Texture Mapping Course: Computer Graphics Presented by Fan Chen
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
COMPUTER GRAPHICS Hochiminh city University of Technology Faculty of Computer Science and Engineering CHAPTER 8: Texture Mapping.
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
And Some Extra Information From
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.
Texture Mapping Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
Texture Mapping Software College, Shandong University Instructor: Zhou Yuanfeng
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.
TEXTURES & OTHER GOODIES Computer Graphics. glTexCoord2f(...); + =
Computer Science Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World.
CG Summary: OpenGL Shading andTextures Angel, Chapters 5, 7; “Red Book” slides from AW, red book, etc. CSCI 6360/4360.
October 9, 2002Serguei A. Mokhov, 1 COMP471 – Computer Graphics OpenGL: Texture Mapping.
Texture Mapping. 2 3 Loading Textures void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border,
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.
1 Graphics CSCI 343, Fall 2015 Lecture 25 Texture Mapping.
Texture Mapping and NURBS Week 7 David Breen Department of Computer Science Drexel University Based on material from Ed Angel, University of New Mexico.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
第三课. Overview of this Section Concept of Texture Mapping ( 纹理映射 ) 2D Texture 3D Texture Environment Mapping Bump Mapping Others OpenGL Implementation.
1 Chapter 7 Texture Mapping. 2 The Limits of Geometric Modeling Although graphics cards can render over 10 million polygons per second, that number is.
Texture Mapping CEng 477 Introduction to Computer Graphics.
Madhulika (18010), Assistant Professor, LPU.
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
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.
OpenGL Texture Mapping
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
texturing a parametric surface
Advanced Graphics Algorithms Ying Zhu Georgia State University
Advanced Graphics Algorithms Ying Zhu Georgia State University
OpenGL Texture Mapping
Computer Graphics, Lee Byung-Gook, Dongseo Univ.
Lecture 21: Texture mapping Li Zhang Spring 2010
3D Game Programming Texture Mapping
Computer Graphics Practical Lesson 6
OpenGL Texture Mapping
OpenGL Texture Mapping
Programming Textures Lecture 15 Fri, Sep 28, 2007.
3D Game Programming Texture Mapping
Texture Mapping Jung Lee.
OpenGL Texture Mapping
Presentation transcript:

Assignment 3b Q&A

Three steps to applying a texture specify the texture read image assign to texture enable texturing assign texture coordinates to vertices specify texture parameters wrapping, filtering

Download stb_image.h OpenGL does not have build-in functions to read images Download stb_image.h from https://github.com/nothings/stb

Add stb_image.h to your Project Copy stb_image.h to your project folder Right click Header Files under solution explorer Add -> Existing Item-> select stb_image.h

Use stb_image.h to read image Include header file #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" Read the texture image image_data = stbi_load("checker.jpg", &x, &y, &n, force_channels); Checker.jpg : texture file x: width of the image y: height of the image force_channels: number of channels of the images

specify texture parameters static GLuint texName; glEnable(GL_TEXTURE_2D); glGenTextures(1, &texName); glBindTexture(GL_TEXTURE_2D, texName); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_LINEAR); // select modulate to mix texture with color for shading glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, image_data );

Typical Code glBegin(GL_POLYGON); glColor3f(r0, g0, b0); //if no shading used glNormal3f(u0, v0, w0); // if shading used glTexCoord2f(s0, t0); glVertex3f(x0, y0, z0); glColor3f(r1, g1, b1); glNormal3f(u1, v1, w1); glTexCoord2f(s1, t1); glVertex3f(x1, y1, z1); . glEnd();