Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rendering with Texture Maps CMPS 160 Assignment 5.

Similar presentations


Presentation on theme: "Rendering with Texture Maps CMPS 160 Assignment 5."— Presentation transcript:

1 Rendering with Texture Maps CMPS 160 Assignment 5

2 Whats new in Meshshop this week? More meshes (meshshop/example_data) New image library (lib/glpng) Texturing display plugin (you write it) Coordinate mapping filter plugin (you write it) A sample texture (a sock!)

3 Texture Mapping in OpenGL Texture maps specify a color pattern that that should be used to modulate surface reflectance at each pixel. Textures are loaded and bound to GL once at startup (ideally). Texture coordinates tell GL which texels (texture pixels) to consider when drawing a polygon.

4 Loading and Binding A Texture glGenTextures finds unused texture ID to give to you glBindTexture sets texture type (1D/2D/3D/4D) glTexParameter sets filtering modes (minification/magnification) pngLoad loads png from filesystem and builds mipmaps glEnable(GL_TEXTURE_2D) turns on texturing

5 Specifying Texture Coordinates Usually called u,v (as opposed to x,y,z) glTexCoord specifies texture coordinates for the next item drawn (same way glColor does) u,v should have usefull information in them (based on the vertex position you are texturing) so….

6 Projecting Texture Coordinates onto the mesh Spherical Projection Planar Projection Cylindrical Projection Transformations of above projctions (Slightly) Random projection? You need some function… (u,v) = f(x,y,z)

7 Assignment Create a display plugin to draw the mesh using a texture selected from the menu and using the texture coordinates stored in the mesh. Create a filter plugin to assign “vertex_texture_coordinates” values for each vertex of the mesh using several different projections.

8 Demo …

9


Download ppt "Rendering with Texture Maps CMPS 160 Assignment 5."

Similar presentations


Ads by Google