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…..
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