17
Interactive Computer Graphics CS 418 – Spring 2015

Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Embed Size (px)

Citation preview

Page 1: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Interactive Computer Graphics

CS 418 – Spring 2015

Page 2: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Agenda for today

Communication Channels & Resources

Set up Programming Environment! We will be showing some code

snippets in class so bring your laptop if you want to follow along

Page 3: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Piazza

Post questions that might be beneficial to everyone

www.piazza.com

Don’t wait until the night before the MP/HW is due Send your questions and ask for help soon!

Page 4: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

TA Info

TAs: Zhicheng Yan.  Office Hour: Fri 4-5pm SC

3238A Email: zyan3 at illinois.edu

Mary Pietrowicz. Ofc. Hour: Wed 2:30-3:30 SC 0207 Email: [email protected]

Sushma Kini. Office Hour: Thurs 3-4pm SC 0207 Email: [email protected]

Page 5: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Resources

• Google, StackOverflow, Lighthouse 3D……• Tutorials– http://nehe.gamedev.net/– http://www.lighthouse3d.com/opengl/– http://www.xmission.com/~nate/opengl.html

• Books– OpenGL Programming Guide (OpenGL Red Book)

• Libraries:– DevIL (OpenIL): http://openil.sourceforge.net/– CXImage:

http://www.codeproject.com/KB/graphics/cximage.aspx

Page 6: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Student Graphics @ Illinois

UIUC Student Chapter of ACM SIGGRAPH http://www.acm.uiuc.edu/siggraph/ Short Films, Video Games, Graphics

Research

GameBuilders http://www.acm.uiuc.edu/gamebuilders/ Video Games

Page 7: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Compile on Windows

Microsoft Visual Studio (2008 and later)

OpenGL (already provided) GLUT:

http://www.opengl.org/resources/libraries/glut/ http://user.xmission.com/~nate/glut.html

Put files in the default search path OR Link through the project settings

Use the HelloWorld project on discussion page

Page 8: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Troubleshooting

• Check if you use the default stdfax.h precompiled header option in your project, and forget to include "stdafx.h“ or “stdlib.h” in your code.

• Check if the compiler is complaining about linking error. Try to add glut32.lib, glu32.lib, and opengl32.lib in your link dependency.

Page 9: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Compile on Linux

Get the developer packages OpenGL▪ Nvidia or Mesa version etc.

Glut▪ freeGlut

Ensure that install directories are in your compiler path

Compile with the appropriate flags (–lglut)

http://www.videotutorialsrock.com/opengl_tutorial/get_opengl_setup_linux/video.php

Page 10: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Compile on OSX

Use Xcode… http://lnx.cx/docs/opengl-in-xcode/

Page 11: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Q&A

Page 12: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Tips for success

• Start Early• Compile/Debug often• Use a debugger

(http://www.gremedy.com/)• Ask questions early• Use libgfx by Michael Garland:

http://mgarland.org/software/libgfx.html• Start Early• Start Early

Page 13: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

OpenGL Function Format

Page 14: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Drawing Polygons (Class example)

glBegin(GL_TRIANGLE_STRIP);glVertex3f(0,0,0);glVertex3f(.5,1,0);glVertex3f(1,0,0);glVertex3f(1.5,.8,0);glVertex3f(2,0,0);glVertex3f(3,1,0);

glEnd();

v1

v2

v3

v4

v5

v6

Page 15: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Meshes

Page 16: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Mesh Types

Explicit mesh description List of polygonal faces (w/ duplicates) “Polygon soup”

Indexed Mesh Description List of vertices List of polygons Space efficient

Page 17: Interactive Computer Graphics CS 418 – Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz Originally created by Mahsa Kamali

Mesh Formats

Obj (we use in this class) Contains definitions of 1 or more named

3D objects ASCII No compression

MTLA Simple Obj Viewer Can be used to

check how the given mesh looks like: MeshLab