CG Microproject 3RD Sem
CG Microproject 3RD Sem
A Report On
“MICRO PROJECT”
“TWINKLING STAR"
MSBTE, PUNE
Page 1 of 23
Computer Engineering Project Topic Name
CERTIFICATE
This is to certify that:
Page 2 of 23
Computer Engineering Project Topic Name
TABLE OF CONTENTS
2. Action plan 5
3. Introduction 6
4. Project Objective 7
5. Algorithm 8–9
6. Flowchart 10
7. Program 11-15
8. Output 16-19
10. Conclusion 22
20. Reference 23
ABSTRACT
Page 3 of 23
Computer Engineering Project Topic Name
Star Creation: Implement algorithms to draw a star-like shape with multiple points.
This will serve as the central element of the animation.
Twinkling Effect: Develop a twinkle effect by varying the brightness of the star
points over time. This can be achieved by modifying the color and intensity of the
star points.
ACTION PLAN
Page 4 of 23
Computer Engineering Project Topic Name
INTRODUCTION
Page 5 of 23
Computer Engineering Project Topic Name
PROJECT OBJECTIVE
The primary goals of this mini-project are as follows:
Page 6 of 23
Computer Engineering Project Topic Name
3) User Interaction: Enable user interaction with the animation, allowing users to
adjust parameters such as animation speed, number of points in the star, or even
add additional elements to the scene.
ALGORITHM -
Page 7 of 23
Computer Engineering Project Topic Name
2) Define Star Shape: Decide on the number of points for your star shape. A
typical choice might be a five-pointed star (pentagram). You can choose to
create a star shape using basic geometric principles, such as triangles and lines,
or use predefined shapes if available in your graphics library.
4) Star Positioning: Determine the position of the star on the canvas. You may
want to place it in the center of the screen or at a random position.
Page 8 of 23
Computer Engineering Project Topic Name
10) Exit Handling: Implement a mechanism to gracefully exit the program when
the user decides to close the window or press a specific key.
11) Cleanup: Properly release any allocated resources (e.g., memory) and close
the graphics window when the program exits.
FLOW CHART -
Start
Page 9 of 23
Computer Engineering Project Topic Name
End
PROGRAM –
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
Page 10 of 23
Computer Engineering Project Topic Name
#include<dos.h>
int main() {
if (err != grOk) {
/* error occurred */
printf("Graphics Error: %s\n",
grapherrormsg(err));
return 0;
}
/*
* draw a star and fill with different
* colors to get twinkling effect
*/
for (i = 1; i <= 15; i++) {
Page 11 of 23
Computer Engineering Project Topic Name
if (i == DARKGRAY)
continue;
setcolor(i);
setfillstyle(SOLID_FILL, i);
setcolor(DARKGRAY);
setfillstyle(SOLID_FILL, DARKGRAY);
line(midx + 30, midy, midx + 140, midy);
line(midx + 30, midy, midx, midy + 30);
line(midx + 140, midy, midx, midy + 30);
floodfill(midx + 31, midy + 1, DARKGRAY);
Page 12 of 23
Computer Engineering Project Topic Name
setcolor(DARKGRAY);
setfillstyle(SOLID_FILL, DARKGRAY);
line(midx + 40, midy + 50, midx, midy + 30);
line(midx + 40, midy + 50, midx + 110, midy + 160);
line(midx + 110, midy + 160, midx, midy + 30);
floodfill(midx + 40, midy + 51, DARKGRAY);
setcolor(DARKGRAY);
setfillstyle(SOLID_FILL, DARKGRAY);
line(midx - 40, midy + 50, midx, midy + 30);
line(midx - 140, midy, midx - 40, midy + 50);
line(midx - 140, midy, midx, midy + 30);
floodfill(midx - 40, midy + 48, DARKGRAY);
setcolor(DARKGRAY);
setfillstyle(SOLID_FILL, DARKGRAY);
line(midx - 30, midy, midx, midy + 30);
line(midx, midy - 100, midx - 30, midy);
line(midx, midy - 100, midx, midy + 30);
floodfill(midx - 28, midy, DARKGRAY);
/* sleep for 2 seconds */
sleep(2);
}
getch();
Page 14 of 23
Computer Engineering Project Topic Name
Page 15 of 23
Computer Engineering Project Topic Name
OUTPUT:
Page 16 of 23
Computer Engineering Project Topic Name
Page 17 of 23
Computer Engineering Project Topic Name
Page 18 of 23
Computer Engineering Project Topic Name
Page 19 of 23
Computer Engineering Project Topic Name
IMPLEMENTATION OF
“TWINKLING STAR”
1.. Setup Graphics Environment:
Initialize the graphics library (e.g., using TurboC, SDL, or OpenGL).
Create a window or canvas for rendering.
Page 20 of 23
Computer Engineering Project Topic Name
Page 21 of 23
Computer Engineering Project Topic Name
CONCLUSION
Page 22 of 23
Computer Engineering Project Topic Name
REFERENCE
Website Name:
"Computer Graphics with Open GL" by Donald Hearn and M.
Pauline Baker: This is a classic textbook for learning computer
graphics with OpenGL.
"Beginning OpenGL Game Programming" by Dave Astle and
Kevin Hawkins: It's a good book for those who want to get into
game programming with OpenGL.
Page 23 of 23