Programming and Graphics
7.8 Three-dimensional interactive object drawing 249 mensions. The object itself is defined by a collection of independently gen ...
250 Introduction to C++ Programming and Graphics The main programobj3dis identical to programplot3d, except that the data defini ...
7.8 Three-dimensional interactive object drawing 251 Figure 7.8.1 Graphics display of codeobj3dshowing an object constructed of ...
Graphics Programming with GLUT, GLUI, and GTK+ 8 In Chapter 7, we discussed the fundamentals of graphics programming based on th ...
8.1 Glut 253 LIB = -I/usr/include/GL -I/usr/include/GL/freeglut -lX11 -lglut phoebe: phoebe.cc c++ -o phoebe phoebe.cc $(LIB) Th ...
254 Introduction to C++ Programming and Graphics glutCreateWindow("GLUT window"); glClearColor(0.8,0.5,0.2,1.0); glutDisplayFunc ...
8.1 Glut 255 (a)(b) (c)(d) (e)(f) Figure 8.1.1Glutproductions: (a) An empty window, (b) a teapot, (c) a triangle, (d)adisk,(e) a ...
256 Introduction to C++ Programming and Graphics In this case, the invoked functionblankclears the screen to the color set by th ...
8.1 Glut 257 GLUTRGBA Select an RGBA mode window; default if neither GLUTRGBA nor GLUTINDEX are specified. GLUTRGB Alias for GLU ...
258 Introduction to C++ Programming and Graphics Triangle The following alternative user-defined function produces the triangle ...
8.1 Glut 259 GLPOLYGON Draws a convexN-sided polygon defined by the vertices. GLLINES Nmust be even. Each pair of vertices defin ...
260 Introduction to C++ Programming and Graphics As an example, the following function draws the solid disk shown in Figure 8.1. ...
8.1 Glut 261 glRotatef(30, 0.0, 0.0, 1.0); // rotate by 30 deg about the z axis //--- Paint three faces: glColor3f(1.0, 0.0, 1.0 ...
262 Introduction to C++ Programming and Graphics Transformations The cube drawing code provides us with the opportunity to discu ...
8.1 Glut 263 glutSolidSphere (double radius, int slices, int stacks) glutWireSphere (double radius, int slices, int stacks) glut ...
264 Introduction to C++ Programming and Graphics glColor3f(0.0f,0.0f,0.0f); glTranslatef(0.1, 0.10, 0.18); glutSolidSphere(0.05, ...
8.1 Glut 265 The graphics display is shown in Figure 8.1.2(a). In this code, we have intro- duced theglRasterPos2ifunction to mo ...
266 Introduction to C++ Programming and Graphics int N=4; float Dtheta = 2*3.1415926/N; float centerx = 0.0, centery = 0.0; floa ...
8.1 Glut 267 Problems 8.1.1. ProgramGlutto open a blank window in a reddish color. 8.1.2. ProgramGlutto draw a red square on a y ...
268 Introduction to C++ Programming and Graphics 8.1.3. Write aGlutfunction that displays a four-sided pyramid. 8.1.4. Write a c ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf