Académique Documents
Professionnel Documents
Culture Documents
Lab 1:
1)
2)
3)
4)
5)
6)
Create a simple house with windows and door open. Write the reshape function so that the house
is not distorted when the display window is resized.
Create a chessboard.
Create a gingerbread man using iterated function system. Use the equations q.x = M(1 + 2L) p.y + |p.x LM| and q.y = p.x.
Create a scene of fish swimming.
Create a scene of flying kite.
Create a scene of rotating wheel.
Lab 2:
7)
8)
9)
10)
Lab 3:
11)
12)
13)
Write a program to handle mouse events. Plot points in random colors by pressing the mouse left
button. The display window must be cleared when you press the mouse right button. Also write
the reshape callback function which changes the clipping rectangle when window is resized.
Write a program to handle mouse events. Draw rectangles using 2 points, at top left and bottom
right on mouse left-button clicks. On right click, clear window. Use reshape callback to avoid
distortion on window resize.
Write a program to handle mouse events Create a polyline using mouse left-button clicks. The
polyline must be redisplayed on window resize.
Lab 4:
14)
15)
16)
17)
18)
Write a program to simulate free hand drawing using a fat brush. The brush size must be
randomly variable in the range 3-10. The drawing should be multicolored.
Write a program to create a font for the letter C of user input thickness.
Write a program to create a font for the letter D of user input thickness
Write a program to create a font for the letter O of user input thickness
Write a program to create a font for the letter S of user input thickness
Lab 5:
19)
Write a program to display a hierarchical menu as below using popup menu. When an option is
selected, display the option on output window.
View _______ normal
| _print
20)
|_web
Edit_________cut
|_ copy
|_paste
Write a program to draw a square. Use popup menu with options to quit or resize the square. The
resize option has submenu with increase size and decrease size as options. The increase size must
double the size of the square and the decrease size option must reduce the size by 2. (half size) .
Min size is 1.
Lab 6:
21)
22)
23)
24)
Write a program to rotate a square using both single and double buffering.
Write a program to demonstrate picking using selection mode.
Write a program to perform rotation of a cube using color interpolation.
Write a program to perform rotation of a cube using vertex arrays.
Lab 7:
25)
26)
27)
28)
Lab 8:
29)
30)
31)
Write a program to implement the Cohen Sutherland line clipping algorithm in 2D. Make
provision to specify the input line, window for clipping and view port for displaying the clipped
image.
Program to draw a color cube and allow the user to move the camera suitably to experiment with
perspective viewing. Use OpenGL functions.
Program to fill any given polygon using scan-line area filling algorithm. (Use appropriate data
structures.)
Windows versions:
7 Enterprise
Vista x64 Enterprise Edition SP2 (Build 6002)
Vista Enterprise Edition SP2 (Build 6002)
XP Professional Edition SP3 5.1 (Build 2600)
Visual Studio
2010 version 10.0.420219.1 SP1Rel
.NET Framework version 4.0.30319 SP1 Rel
2008 version 9.0.21022.8.RTM
.NET Framework version 3.5 SP1
Installation/verification:
OpenGL comes with the OS and Visual Studio 2010/2008 installations, to verify:
o runtime libraries:
C:\Windows\System32\{opengl,glu}32.dll
on 64-bit Windows:
C:\Windows\SysWOW64\{opengl,glu}32.dll
o
header files:
C:\Program Files\Microsoft
SDKs\Windows\v7.0A\Include\GL\{GL,GLU}.h
["Program Files (x86)" for 64-bit Windows; VS2008:
v6.0A]
linker library:
C:\Program Files\Microsoft
SDKs\Windows\v7.0A\Lib\OpenGL32.Lib
["Program Files (x86)" for 64-bit Windows; VS2008:
v6.0A]
Windows does not include GLUT standard. Thus, getting your OpenGL programs to compile
and run if it is not already installed is slightly more difficult. However by following the
following steps, you should be able to figure out how to make it work:
1. Download GLUT from http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip
2. Unzip the file.
3. Put the file "glut32.dll" into the system path.
o This can be in the same directory as your executable file.
o On Windows XP or earlier, this can be in "C:\WINDOWS\system32"
o Or you can create a directory like "C:\DLLs", put the file in this directory and
change your system path to include this new directory.
Do this by opening Control Panel -> System, clicking on "Advanced
System Settings", followed by "Environment Variables", and editing the
"Path" variable.
4. Put the file "glut.h" into the standard Visual C++ include directoy
o (For Visual Studio 2010, this should be:
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\gl")
o (For Visual Studio 2008, this should be:
o
o
5. Put the file "glut32.lib" into the standard Visual C++ library directory
o (For Visual Studio 2010, this should be:
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib")
o (For Visual Studio 2008, this should be:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib")
o (For Visual Studio 2005, this should be:
"C:\Program Files\Microsoft Visual Studio.NET\Vc7\PlatformSDK\lib")
o There should be lots of .lib files here, including "opengl32.lib" and "glu32.lib".
6. Make sure your Visual C++ project links in the GLUT/gl/glu libraries (see also this
page). This is located in:
o Menu: "Project -> (your-project-name) Properties"
o Tab: "Configuration Properties -> Linker -> Input"
o Under "Additional Dependancies", add "glut32.lib glu32.lib opengl32.lib"
7. #include < GL/glut.h > in your program.
o Note: This needs to come after you #include < stdio.h > and < stdlib.h >.
o Note: This needs to come before you #include < GL/gl.h >.
o Also note that glut.h includes gl.h for you (so you need not explicitly #include <
GL/gl.h >).
8. You should not include windows.h or any other Windows-specific header files.
9. If you get compilation errors because of multiple conflicting definitions of "exit()", then
"stdio.h" and "glut.h" have been #include'd in the wrong order. You may fix this by:
o Reordering your #include files (see step #7). This is the "right" way.
o Add "#define GLUT_DISABLE_ATEXIT_HACK" to glut.h on the line
immediately after the first "#if defined(_WIN32)".
10. If you happen to have a 64-bit version of Windows and Visual Studio, make sure you
compile a 32-bit executable.
Tell Visual Studio where your code resides (or will reside).
Tell Visual Studio which code files to compile.
Tell Visual Studio what libraries you need.
Tell Visual Studio where to find those libraries.
These instructions work for Visual Studio 2008, though they are mostly similar for other versions:
[1] http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/#win
[2] http://homepage.cs.uiowa.edu/~cwyman/classes/common/howto/winGLUT.html
[3] http://homepage.cs.uiowa.edu/~cwyman/classes/common/howto/compileVS.html