Oops Micro 0.5 Project Name
Oops Micro 0.5 Project Name
MICRO-PROJECT REPORT
NAME OF DEPARTMENT:- COMPUTER ENGENEERING
ACADEMIC YEAR:- 2024-2025
SEMESTER:-THIRD
COURSE NAME:-OBJECT ORIENED PROGRAMIMG (C++)
COURSE CODE:-313304
MICRO-PROGECT TITLE:- DESIGN DIGITAL CLOCK
PREPARD BY:-
ACKNOWLEDGEMENT
We wish to express our profound gratitude to our guide
Prof.S.J.HADBE who guided us endlessly in framing and completion of
Micro-Project. He / She guided us on all the main points in that Micro
Project. We are indebted to his / her constant encouragement, cooperation
and help. It was his / her enthusiastic support that helped us in overcoming
of various obstacles in the Micro-Project.
We are also thankful to our Principal, HOD, Faculty
Members and classmates for extending their support and motivation in the
completion of this Micro-Project.
Micro-Project Proposal
1. SEARCHING
INFORMATION
ABOUT TOPIC
FINDING
2. INFORMATION
DISCUS WITH
3. SUBJECT TEACHER
4. MAKING PROPOSAL
5. MAKING REPORT
● Brief Description:
In this era of computing, computer graphics has become one of the most
powerful and interesting fact of computing. It all started with display of data
on hardcopy and CRT screen. Now computer graphics is about creation,
retrieval, manipulation of models and images. Graphics today is used in
many different areas. Graphics provides one of the most natural means of
communicating within a computer, since our highly developed 2D and 3D
pattern-recognition abilities allow us to perceive and process pictorial data
rapidly and effectively. Interactive computer graphics is the most important
means of producing pictures since the invention of photography and
television. It has the added advantage that, with the computer, we can
make pictures not only of concrete real world objects but also of abstract,
synthetic objects, such as mathematical surfaces and of data that have no
inherent geometry, such as survey results.
OpenGL CONCEPT
INTERFACE
OpenGL is an application program interface (API) offering various functions
to implement primitives, models and images. This offers functions to create
and manipulate render lighting, coloring, viewing the models. OpenGL
offers different coordinate system and frames. OpenGL offers translation,
rotation and scaling of objects. Functions in the main GL library have
names that begins with gl and are stored in a library usually referred to as
GL. The second is the OpenGL Utility Library(GLU). The library uses only
GL functions but contains code for creating common objects and simplifying
viewing. All functions in GLU can be created from the core GL library but
application programmers prefer not to write the code repeatedly. The GLU
library is available in all OpenGL implementations; functions in the GLU
library begin with the letter glu. Rather than using a different library for each
system we use a readily available library called OpenGL Utility
Toolkit(GLUT),which provides the minimum functionality that should be
expected in any modern windowing system. OVERVIEW
Pipeline Architectures
OPENGL PIPELINE ARCHITECTURE
Program Structure :
Clock Layout
I’ve used this function to print the clock layout i.e. clock dial and
the markings on the clock. If we observe clearly, the clock has
hours marking each separated by 30 degrees and each hour is
divided into 5 markings each making an angle of 6 degrees. So,
iterating the markings for every 30 degrees gives hours and
iterating markings with 6 degrees give minutes markings on the
clock. The clock would look like this after executing this function.
Image Theory
secHand
It is clear from the name that this gonna do something with the
seconds hand. This function is going to get the present second
from the system clock and incline the line according to a
particular angle. Eg: if the present seconds is 5 then the angle of
the seconds hand with respect to the vertical must be 30
degrees, i.e. 5*6=30.
minHand
This function fulfills the task of moving the minutes hand based
on the system clock. The minutes hand must be inclined 6
degrees for every minute passing. Eg: if the elapsed minutes
are 30 then the minutes hand angle must be making 180
degrees with the vertical.
hrHand
Clocks use oscillators to keep the gears in motion. These oscillators have
changed from flowing water to pendulums to quartz crystals, but they all seek to
achieve the same purpose: perpetual motion. The oscillating mechanisms are
powered by a variety of sources, but the two most prevalent power sources are
direct electrical currents or batteries. The electricity or battery power fuels the
controller mechanism, which supplies crucial support to the oscillator. The
controller, in turn, fuels the wheel chain of the analog clock. The wheel chain is
responsible for notching and turning the indicator hands of the clock. So, with each
second that passes, the wheel chain synchronizes the minutes and hours
accordingly. It is a relatively simple process, culminating in the familiar big hand
and little hand indicating the hour and minute. All analog clocks uses gears in
intricate fashion to enhance efficiency but the basic mechanism remains same
(even for vertical designs).
Program Graphics
Most of the objects in the program, such as buttons, grids or cells, are drawn using
OpenGL primitives.
Most of the control buttons used through the program were made as textures in an
image editor and exported as .raw files. The class “Textures” (in Textures.h &
Textures.cpp) handles the loading of these images intomemory and drawing them
on the screen using OpenGL’s texture related function.
Text is drawn after the back buffer is flushed to the front buffer, by hijacking the
window handle wia Win32 and writing text onto the window via the
Win32ThrowText() function defined in Util.h
IMPLEMENTATION SOURCE CODE
#include
<gl/glut.h> #include
<gl/gl.h> #include
<math.h> #include
<time.h> #include
<sys/timeb.h>
30.0f,
minStart
= 0.9f, minEnd
= 1.0f,
= 1.0f;
float angleHour
= 0,
angleMin= 0, angleSec
= 0;
void
RenderScene(void){
int i;
glClear(GL_COLOR_BUFFER_BIT)
; glColor3f(1.0f, 0.0f,
0.0f); glLineWidth(2.0f);
glEnable(GL_LINE_SMOOT
H
);
glEnable(GL_POINT_SMO
OT H);
glEnable(GL_POLYGON_S
MO OTH);
glBegin(GL_LINES);
for(i=0; i<60; i++){ if(i%5)
{ // normal minute
if(i%5 == 1)
glColor3f(1.0f, 1.0f, 1.0f); newLine(minStart,
minEnd, i*angle1min);
}else{ glColor3f(1.0f, 0.0f,
0.0f); newLine(stepStart,
stepEnd, i*angle1min);
}
} glEnd();
glLineWidth(3.0f
);
glBegin(GL_LINES
);
newLine(0.0f, 0.5f, -
angleHour+M_PI/2); newLine(0.0f, 0.8f,
-angleMin+M_PI/2); glEnd();
glLineWidth(1.0f);
glColor3f(0.0f, 0.0f, 1.0f); glBegin(GL_LINES);
newLine(0.0f, 0.8f, -
angleSec+M_PI/2); glEnd();
glutSwapBuffers();
}
void SetupRC(void){
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
///////////////////////////////////////////////////////////
// Called by GLUT library when the window has chanaged size
void ChangeSize(GLsizei w, GLsizei h){ GLfloat
aspectRatio;
// Prevent a divide by zero if(h
== 0)
h = 1;
glMatrixMode(GL_MOD
E LVIEW);
glLoadIdentity();
}
angleSec = (float)(t->tm_sec+
(float)tb.millitm/1000.0f)/30.0f * M_PI; angleMin = (float)(t-
>tm_min)/30.0f * M_PI + angleSec/60.0f; angleHour = (float)
(t->tm_hour > 12 ? t-
>tm_hour-12 : t-
>tm_hour)/6.0f * M_PI+
angleMin/12.0f;
glutPostRedisplay();
glutTimerFunc(33,TimerFunction, 1); }
///////////////////////////////////////////////////////////
// Main program entry point int
main(int argc, char* argv[]){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE |
GLUT_RGBA); glutCreateWindow("glClock
by bobo");
glutDisplayFunc(RenderScene); glutReshapeFunc(ChangeSize);
glutTimerFunc(33, TimerFunction, 1);
SetupRC(); glutMainLoop()
return 0;
}
OUTPUT OF THEPROGRAM
CONCLUSIONS
Attempts to represent time in a digital format have been around for ages, with the
first patented design of the ‘Plato’ digital clock of 1903 being introduced at the St.
Louis World Fair in 1904. But analogue soldiers on regardless.Digital displays
have enjoyed periods of popularity but people always seem to move back
eventually to analogue dials in the long term.Personally, I place the eternal
popularity to be based on the instant recognisability of the position of the hands.
with the briefest of glances it is possible to observe the time and a number of other
aspects that digits alone do not instantly convey, I always seemed to have to
analyse them to get the picture - a dial is of course exactly that - the picture.
Teacher Evaluation Sheet
Name of Student………………………………………………………………………………………
of Program…………………………………………………….….....….………...….………...
Semester……………………………………………………………….…....….………...….………..
Course Title…………………………………………………………….…...….………...….………..
Code………………………………………………………………………...….………...….………...
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
………………………………………………………………………………………………………………
Note:
Every course teacher is expected to assign marks for group evolution in first 3 columns & individual
evaluation in 4th columns for each group of students as per rubrics
*****************