CG Rocket Launching Final Report
CG Rocket Launching Final Report
CG Rocket Launching Final Report
Firstly, I thank the Management late Shri A. Krishnappa, Chairman SEA College of
Engineering and Technology for Providing Necessary infrastructure and creating good
environment.
I would like to express my sincere thanks to our respected Dr. B.LOGANAYAGI HOD
of Computer science and engineering department, for his assistance and guidance.
I am thankful for the support rendered by my Project guide and coordinator prof.
SASWATI for her valuable suggestions.
I am also obliged, to the faculty members of CSE Department who rendered their valuable
assistance for the Project.
And, I would like to express my heart full gratitude to my parents who have extended their
help throughout my Project.
And finally, I would like to express my heart full gratitude to my friends and all those who
have extended their help throughout my Project
BHUVANA.KV (1SP20CS012)
CONTENTS
1. INTRODUCTION
Computer Graphics 1
1.2 OpenGL Technology 2
3. Software Design
System Design 4
3.2 Detailed Design 5
4. Implementation
Functions Used 8
6. Snap Shots 13
7. Appendix 17
8. Bibliography 28
ROCKET LAUNCHING
Chapter 1
INTRODUCTION
Computer Graphics
OpenGL runs on every major operating system including Mac OS, OS/2,
UNIX, Windows 95/98, Windows 2000, Windows NT, Linux, OPENStep,
and BeOS; it also works with every major windowing system
graphics provides one of the most natural means of communicating with a
computer, since our highly developed 2D Or 3D pattern-recognition
abilities allow us to perceive and process pictorial data rapidly.
Computers have become a powerful medium for the rapid and economical
production of pictures.
There is virtually no area in which graphical displays cannot be used to
some advantage.
Graphics provide a so natural means of communicating with the computer
that they have become widespread.
Interactive graphics is the most important means of producing pictures
since the invention of photography and television .
We can make pictures of not only the real world objects but also of
abstract objects such as mathematical surfaces on 4D and of data that have
no inherent geometry.
A computer graphics system is a computer system with all the components
of the general purpose computer system. There are five major elements in
system: input devices, processor, memory, frame buffer, output devices.
OpenGL Technology
OpenGL is the premier environment for developing portable, interactive 2D and 3D
graphics applications. Since its introduction in 1992, OpenGL has become the industry's
most widely used and supported 2D and 3D graphics application programming interface
(API), bringing thousands of applications to a wide variety of computer platforms.
Chapter 2
Hardware Requirements
• Processor: Intel i3
• RAM: 4GB
• Hard Disk: 3.1GB
• Monitor: EGVGA compatible
• Keyboard: Standard 101 key keyboard
• Backup Media: Hard disk
• Mouse(PS/2)
Software Requirements
Chapter 3
SOFTWARE DESIGN
SYSTEM DESIGN
Existing System
Existing system for a graphics is the TC++ . This system will support only the 2D
graphics. 2D graphics package being designed should be easy to use and understand. It
should provide various option such as free hand drawing , line drawing , polygon drawing
, filled polygons, flood fill, translation , rotation , scaling , clipping etc. Even though these
properties were supported, it was difficult to render 2D graphics cannot be . Very difficult
to get a 3 Dimensional object. Even the effects like lighting , shading cannot be provided.
So we go for Microsoft Visual Studio software.
PROPOSED SYSTEM
DETAILED DESIGN
TRANSFORMATION FUNCTIONS
Matrices allow arbitrary linear transformations to be represented in a consistent format,
suitable for computation. This also allows transformations to be concatenated easily (by
multiplying their matrices).
Linear transformations are not the only ones that can be represented by matrices.
Using homogenous coordinates, both affine transformation and perspective
projection on Rn can be represented as linear transformations on RPn+1 (that is, n+1-
dimensional real projective space). For this reason, 4x4 transformation matrices are
widely used in 3D computer graphics.
For example, the function T(x) = 5x is a linear transformation. Applying the above
process (suppose that n = 2 in this case) reveals that
Examples in 2D graphics
Most common geometric transformations that keep the origin fixed are linear, including
rotation, scaling, shearing, reflection, and orthogonal projection; if an affine
transformation is not a pure translation it keeps some point fixed, and that point can be
chosen as origin to make the transformation linear. In two dimensions, linear
transformations can be represented using a 2×2 transformation matrix.
Rotation:
For rotation by an angle θ anticlockwise about the origin, the functional form is x'
= xcosθ − ysinθ and y' = xsinθ + ycosθ. Written in matrix form, this becomes:
Similarly, for a rotation clockwise about the origin, the functional form is x' = xcosθ
+ ysinθ and y' = − xsinθ + ycosθ and the matrix form is:
Scaling:
When , then the matrix is a squeeze mapping and preserves areas in the plane.
Shearing:
For shear mapping (visually similar to slanting), there are two possibilities. For a
shear parallel to the x axis has x' = x + ky and y' = y; the shear matrix, applied to column
vectors, is:
A shear parallel to the y axis has x' = x and y' = y + kx, which has matrix form:
Chapter 4
IMPLEMENTATION
Functions Used
This function is used to mention the color in which the pixel should appear. The number 3
specifies the number of arguments that the function would take. ‘f ’ gives the type that is
float. The arguments are in the order RGB(Red, Green, Blue). The color of the pixel can
be specified as the combination of these 3 primary colors.
This function is used to clear the color of the screen. The 4 values that are passed as
arguments for this function are (RED, GREEN, BLUE, ALPHA) where the red green and
blue components are taken to set the background color and alpha is a value that specifies
depth of the window. It is used for 3D images.
Void glutKeyboardFunc();
void glutKeyboardFunc(void (*func)(unsigned char
where func is the new keyboard callback function. glutKeyboardFunc sets the keyboard
callback for the current window. When a user types into the window, each key press
generating an ASCII character will generate a keyboard callback. The key callback
parameter is the generated ASCII character. The x and y callback parameters indicate the
mouse location in window relative coordinates when the key was pressed. When a new
window is created, no keyboard callback is initially registered, and ASCII key strokes in
the window are ignored. Passing NULL to glutKeyboardFunc disables the generation of
keyboard callbacks.
Void glFlush();
Different GL implementations buffer commands in several different locations, including
network buffers and the graphics accelerator itself. glFlush empties all of these buffers,
DEPT OF CSE(SEACET) 2022-2023 7
ROCKET LAUNCHING
causing all issued commands to be executed as quickly as they are accepted by the actual
rendering engine. Though this execution may not be completed in any particular time
period, it does complete in finite time.
where mode Specifies which matrix stack is the target for subsequent matrix operations.
Three values are accepted: GL_MODELVIEW, GL_PROJECTION, and
GL_TEXTURE. The initial value is GL_MODELVIEW.
glMatrixMode sets the current matrix mode. mode can assume one of three values:
where x,y
Specify the lower left corner of the viewport rectangle, in pixels. The initial value is (0,
0).
width,height
Specify the width and height of the viewport. When a GL context is first attached to a
surface (e.g. window),width and height are set to the dimensions of that surface.
GlViewport specifies the affine transformation of x and y from normalized device
coordinates to window coordinates. Let (xnd, ynd) be normalized device coordinates. Then
the window coordinates (xw, yw) are computed as follows:
xw = ( xnd + 1 ) width/2 + x
yw = ( ynd + 1 ) height/2 + y
Viewport width and height are silently clamped to a range that depends on the
implementation. To query this range, call glGetInteger with argument
GL_MAX_VIEWPORT_DIMS.
glutInit will initialize the GLUT library and negotiate a session with the window system.
During this process, glutInit may cause the termination of the GLUT program with an
error message to the user if GLUT cannot be properly initialized. Examples of this
situation include the failure to connect to the window system, the lack of window system
support for OpenGL, and invalid command line options.glutInit also processes command
line options, but the specific options parse are window system dependent.
glutReshapeFunc sets the reshape callback for the current window. The reshape callback
is triggered when a window is reshaped. A reshape callback is also triggered immediately
before a window's first display callback after a window is created or whenever an overlay
for the window is established. The width andheight parameters of the callback specify the
new window size in pixels. Before the callback, the current window is set to the window
that has been reshaped.
If a reshape callback is not registered for a window or NULL is passed
to glutReshapeFunc (to deregister a previously registered callback), the default reshape
callback is used. This default callback will simply
glOrtho ( )
Syntax: void glOrtho ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble
top, GLdouble near, GLdouble far);
The function defines an orthographic viewing volume with all parameters measured from
the centre of the projection plane.
void glutMainLoop(void);
glutMainLoop enters the GLUT event processing loop. This routine should be called at
most once in a GLUT program. Once called, this routine will never stop.
glutPostRedisplay()
glutPostRedisplay, glutPostWindowRedisplay — marks the current or specified window
as needing to be redisplayed.
Void display(void)
In this function first we should print the instructions that we would be displayed on
the pop-up window.
Void displayloop()
Here we are display starting stage ,intermediate & final stage of Rocket.
Void myinit()
Here we call all the function we defined previously in the program and this function
creates a output window.
Chapter 5
This game allows the gamer to overtake obstacles, and accomplish 5 levels of intense
racing. It tells the user what will happen if they collide with an obstacle i.e. setting an
example in real life. The levels automatically increment unless the vehicle has not
crashed.
UNIT TESTING
Here the individual components are tested to ensure that they operate correctly. Each
component is tested independently, without other system components.
MODULE TESTING
Module is a collection of dependent components such as procedures and functions. Since
the module encapsulates related components can be tested with our other system modules.
The testing process is concerned with finding errors which results from erroneous function
calls from the main function to various individual functions.
SYSTEM TESING
The Modules are integrated to make up the entire system. The testing process is concerned
with finding errors with the results from unanticipated interactions between module and
system components. It is also concerned with validating that the system meets its
functional and non-functional requirements..
Chapter 6
SNAP SHOTS
Chapter7
APPENDIX
#include<GL/glut.h>
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
const float DEG2RAD = 3.14159/180;
void display1();
void stars();
void stars1();
void static_rocket();
void rocket_to_cam pos();
void rocket_in_motion();
void mars(float radius);
float
i,j,count=0,count1=0,count3=0,flag=0,flag1=0,t=0,f=0,flag3=0;
void semicircle(float radius,float u,float v)
{
glVertex2f(u+cos(degInRad)*radius,v+(sin(degInRad))*radius);
}
glEnd();
}
void display1()
{
count1++;
if(count1==250)
flag=1;
if(flag==0)
static_rocket();
else if((count1==151)| (count1==152))
rocket_to_cam_pos();
else
rocket_in_motion();
}
void stars()
{
glColor3f(1.0,1.0,1.0);
glPointSize(0.37);
glBegin(GL_POINTS);
glVertex2i(10,20);
glVertex2i(20,100);
glVertex2i(30,10);
glVertex2i(15,150);
glVertex2i(17,80);
glVertex2i(200,200);
glVertex2i(55,33);
glVertex2i(400,300);
glVertex2i(330,110);
glVertex2i(125,63);
glVertex2i(63,125);
glVertex2i(20,10);
glVertex2i(110,330);
glVertex2i(440,430);
glVertex2i(32,65);
glVertex2i(110,440);
glVertex2i(210,230);
glVertex2i(390,490);
glVertex2i(12,90);
glVertex2i(400,322);
glVertex2i(420,366);
glVertex2i(455,400);
glVertex2i(20,20);
glVertex2i(111,120);
glVertex2i(401,200);
glVertex2i(230,30);
glVertex2i(220,20);
glVertex2i(122,378);
glVertex2i(133,340);
glVertex2i(345,420);
glVertex2i(130,360);
glVertex2i(333,120);
glVertex2i(250,22);
glVertex2i(242,11);
glVertex2i(280,332);
glVertex2i(233,40);
glVertex2i(210,418);
glVertex2i(256,12);
glVertex2i(288,232);
glVertex2i(247,36);
glVertex2i(229,342);
glVertex2i(257,47);
glVertex2i(290,63);
glVertex2i(232,72);
glVertex2i(243,143);
glVertex2i(100,200);
glVertex2i(90,250);
glVertex2i(80,225);
glVertex2i(50,333);
glVertex2i(60,350);
glVertex2i(243,143);
glVertex2i(243,143);
glEnd();
}
void stars1()
{
int l;
glColor3f(1.0,1.0,1.0);
glPointSize(0.3);
glBegin(GL_POINTS);
glVertex2i(50,20);
glVertex2i(70,100);
glVertex2i(80,10);
glVertex2i(65,150);
glVertex2i(67,80);
glVertex2i(105,33);
glVertex2i(450,300);
glVertex2i(380,110);
glVertex2i(175,63);
glVertex2i(113,125);
glVertex2i(70,10);
glVertex2i(160,330);
glVertex2i(490,430);
glVertex2i(82,65);
glVertex2i(160,440);
glVertex2i(440,490);
glVertex2i(62,90);
glVertex2i(450,322);
glVertex2i(420,366);
glVertex2i(455,400);
glVertex2i(60,20);
glVertex2i(111,120);
glVertex2i(451,200);
glVertex2i(280,30);
glVertex2i(220,20);
glVertex2i(132,378);
glVertex2i(173,340);
glVertex2i(325,420);
glVertex2i(180,360);
glVertex2i(383,120);
glVertex2i(200,22);
glVertex2i(342,11);
glVertex2i(330,332);
glVertex2i(283,40);
glVertex2i(210,418);
glVertex2i(256,12);
glVertex2i(288,232);
glVertex2i(247,36);
glVertex2i(229,342);
glVertex2i(257,47);
glVertex2i(290,63);
glVertex2i(232,72);
glVertex2i(243,143);
glVertex2i(100,200);
glVertex2i(90,250);
glVertex2i(80,225);
glVertex2i(50,333);
glVertex2i(60,350);
glVertex2i(243,143);
glVertex2i(243,143);
glEnd();
for(l=0;l<=10000;l++)
;
}
void static_rocket()
{
count1++;
if(count1==150)
flag=1;
if(flag==0)
{
glClearColor(0.196078 ,0.6 ,0.8,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(0.4,0.25,0.1);
glBegin(GL_POLYGON);
glVertex2f(0.0,0.0);
glVertex2f(0.0,250.0);
glVertex2f(270.0,250.0);
glVertex2f(500.0,50.0);
glVertex2f(500.0,0.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(280.0,250.0);
glVertex2f(500.0,250.0);
glVertex2f(500.0,60.0);
glEnd();
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(260.0,250.0);
glVertex2f(290.0,250.0);
glVertex2f(500.0,70.0);
glVertex2f(500.0,40.0);
glEnd();
glColor3f(0.0,0.0,0.0);
glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);
glVertex2f(250.0,250.0);
glVertex2f(300.0,250.0);
glVertex2f(300.0,350.0);
glVertex2f(250.0,350.0);
glEnd();
glColor3f(0.7,0.7,0.7);
glBegin(GL_POLYGON);
glVertex2f(255,267.5);
glVertex2f(275.0,267.5);
glVertex2f(275.0,277.5);
glVertex2f(255.0,277.5);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(255,285.0);
glVertex2f(275.0,285);
glVertex2f(275.0,295);
glVertex2f(255.0,295);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(255,302.5);
glVertex2f(275.0,302.5);
glVertex2f(275.0,312.5);
glVertex2f(255.0,312.5);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(255,320.0);
glVertex2f(275.0,320.0);
glVertex2f(275.0,330.0);
glVertex2f(255.0,330.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(285,267.5);
glVertex2f(295.0,267.5);
glVertex2f(295.0,277.5);
glVertex2f(285.0,277.5);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(285,285.0);
glVertex2f(295.0,285);
glVertex2f(295.0,295);
glVertex2f(285.0,295);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(285,302.5);
glVertex2f(295.0,302.5);
glVertex2f(295.0,312.5);
glVertex2f(285.0,312.5);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(285,320.0);
glVertex2f(295.0,320.0);
glVertex2f(295.0,330.0);
glVertex2f(285.0,330.0);
glEnd();
glColor3f(0.647059 ,0.164706 ,0.164706);
glBegin(GL_POLYGON);
glVertex2f(26,250);
glVertex2f(52,250);
glVertex2f(39,290);
glEnd();
semicircle(20.0,50,300);
glColor3f(0.0,0.0 ,0.0);
glBegin(GL_LINES);
glVertex2f(37,313);
glVertex2f(62,310);
glVertex2f(63,287);
glVertex2f(62,310);
glEnd();
glColor3f(1.0,1.0,1.0);
glEnd();
glPointSize(2.0);
glColor3f(1.0,1.0 ,1.0);
glBegin(GL_POINTS);
glVertex2f(497,56);
glVertex2f(488,65);
glVertex2f(479,74);
glVertex2f(470,83);
glVertex2f(460,92);
glVertex2f(450,101);
glVertex2f(439,110);
glVertex2f(428,119);
glVertex2f(418,128);
glVertex2f(408,137);
glVertex2f(398,146);
glVertex2f(388,155);
glVertex2f(378,164);
glVertex2f(366,173);
glVertex2f(356,182);
glVertex2f(346,191);
glVertex2f(336,200);
glVertex2f(324,209);
glVertex2f(314,218);
glVertex2f(304,227);
glVertex2f(294,234);
glVertex2f(284,243);
glVertex2f(278,248);
glEnd();
glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0);
glVertex2f(262.5,20.0);
glVertex2f(262.5,120.0);
glVertex2f(237.5,120.0);
glEnd();
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(237.5,120.0);
glVertex2f(262.5,120.0);
glVertex2f(250,170.0);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(237.5,120.0);
glVertex2f(217.5,95.0);
glVertex2f(237.5,95.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0);
glVertex2f(217.5,20.0);
glVertex2f(237.5,70.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,20.0);
glVertex2f(282.5,20.0);
glVertex2f(262.5,70.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,120.0);
glVertex2f(262.5,95.0);
glVertex2f(282.5,95.0);
glEnd();
glColor3f(0.556863 ,0.137255 ,0.419608);
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0);
glVertex2f(244.5,20.0);
glVertex2f(241,0.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(246.5,20.0);
glVertex2f(253.5,20.0);
glVertex2f(249.5,0.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,20.0);
glVertex2f(255.5,20.0);
glVertex2f(258.5,0.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(182.5,85.0);
glVertex2f(182.5,0.0);
glVertex2f(187.5,0.0);
glVertex2f(187.5,80.0);
glVertex2f(237.5,80.0);
glVertex2f(237.5,85.0);
glVertex2f(182.5,85.0);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(312.5,85.0);
glVertex2f(312.5,0.0);
glVertex2f(307.5,0.0);
glVertex2f(307.5,80.0);
glVertex2f(262.5,80.0);
glVertex2f(262.5,85.0);
glVertex2f(312.5,85.0);
glEnd();
for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}
void rocket_to_cam_pos()
{
count++;
count3++;
for(i=0;i<=200;i++)
{
glColor3f(0.8,0.498039 ,0.196078);
glBegin(GL_POLYGON);//core
glVertex2f(237.5,20.0+i);
glVertex2f(262.5,20.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(237.5,120.0+i);
glEnd();
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(237.5,120.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(250,170.0+i);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(237.5,120.0+i);
glVertex2f(217.5,95.0+i);
glVertex2f(237.5,95.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0+i);
glVertex2f(217.5,20.0+i);
glVertex2f(237.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,20.0+i);
glVertex2f(282.5,20.0+i);
glVertex2f(262.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,120.0+i);
glVertex2f(262.5,95.0+i);
glVertex2f(282.5,95.0+i);
glEnd();
glColor3f(0.556863 ,0.137255 ,0.419608);
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0+i);
glVertex2f(244.5,20.0+i);
glVertex2f(241,0.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(246.5,20.0+i);
glVertex2f(253.5,20.0+i);
glVertex2f(249.5,0.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,20.0+i);
glVertex2f(255.5,20.0+i);
glVertex2f(258.5,0.0+i);
glEnd();
for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}
}
void rocket_in_motion()
{
count++;
for(i=195;i<=200;i++)
{
if(count>=5)
{
glClearColor(0.0 ,0.0 ,0.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
if(flag1==0)
{
stars();
flag1=1;
}
else
{
stars1();
flag1=0;
}
}
els
e
{
glEnd();
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);
glVertex2f(237.5,120.0+i);
glVertex2f(262.5,120.0+i);
glVertex2f(250,170.0+i);
glEnd();
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(237.5,120.0+i);
glVertex2f(217.5,95.0+i);
glVertex2f(237.5,95.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0+i);
glVertex2f(217.5,20.0+i);
glVertex2f(237.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,20.0+i);
glVertex2f(282.5,20.0+i);
glVertex2f(262.5,70.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,120.0+i);
glVertex2f(262.5,95.0+i);
glVertex2f(282.5,95.0+i);
glEnd();
glColor3f(0.556863 ,0.137255 ,0.419608);
glBegin(GL_POLYGON);
glVertex2f(237.5,20.0+i);
glVertex2f(244.5,20.0+i);
glVertex2f(241,0.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(246.5,20.0+i);
glVertex2f(253.5,20.0+i);
glVertex2f(249.5,0.0+i);
glEnd();
glBegin(GL_POLYGON);
glVertex2f(262.5,20.0+i);
glVertex2f(255.5,20.0+i);
glVertex2f(258.5,0.0+i);
glEnd();
for(j=0;j<=1000000;j++)
;
glutSwapBuffers();
glutPostRedisplay();
glFlush();
}
}
glBegin(GL_POLYGON);
{
float degInRad = i*DEG2RAD;
glVertex2f(300+f+cos(degInRad)*radius,500-t+(sin(degInRad))
*radius);
}
glEnd();
t=t+0.1;
f=f+0.1;
}
void myinit()
{
glClearColor(0.196078 ,0.6 ,0.8,1.0);
glPointSize(1.0);
gluOrtho2D(0.0,499.0,0.0,499.0);
}
void createGLUTMenus() {
glutAddMenuEntry("LAUNCH",1);
glutAddMenuEntry("EXIT",2);
glutAttachMenu(GLUT_RIGHT_BUTTON);
}
glutIdleFunc(display1);
glutDisplayFunc(display1);
myinit();
glutMainLoop();
return 0;
}
Chapter 8
BIBLIOGRAPHY
Book References:
Interactive Computer Graphics A top –down approach with OpenGL –
Edward Angel, 5th Edition, Addition-Wesley 2008.
Computer Graphics Using OpenGL - F.S.Hill.Jr. 2nd Edition, Pearson
Education, 2001.
Web References:
www.opengl.org
www.sourcecode.com