IGNOU MCA Solved Practical Question Paper and Programme of Computer
Graphics for Help
Previous year solved question paper according to practical
exam computer graphics MCSL-54 that programs run on C++ platforms Visual Studio
6.0 and opengl utility library & toolkit files and it’s work on window xp only follow
the step by step. If you facing any problem in programming exam contact us
Step1. Install visual
studio 6.0 in computer.
Step2. Copy opengl
utility library files and paste.
1.
Header files {gl.h, glu.h, glut.h } copy all
files and paste in C:\program file\ms
visual studio\ vc98\include \gl
2.
Static files{glu32.lib, glut32.lib, opengl32.lib}copy
all file and paste C:\programe file\ms
visual studio\vc98\lib
3.
Dynamic files {glu32.dll, glut32.dll,
opengl32.dll} All files copy
and paste C:\window \system32
Now star programing
Open vc++àNew
à projectàwin32 console
applicationà
give name of project à
OK
è
Select on empty project radio button
è
OKàproject
name bar à
setting
è
Click on link tab àpaste
lib file names into second textbox using
space between to names
Now ready to start programming …
Just try to student practices some programs copy & paste. I hope these
programs are very help full for these programs
#include<windows.h>
#include<gl/gl.h>
#include<gl/glu.h>
#include<gl/glut.h>
void myInit(void)
{
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.0f,0.0f,0.0f);
glPointSize(4.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,800.0,0.0,600.0);
}
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glVertex2i(100,100);
glVertex2i(200,200);
glVertex2i(100,200);
glVertex2i(200,100);
glEnd();
glFlush();
}
void main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutInitWindowPosition(100,100);
glutCreateWindow("OpenGl
Window");
myInit();
glutDisplayFunc(myDisplay);
glutMainLoop();
}
Que2
#include<windows.h>
#include<gl/gl.h>
#include<gl/glu.h>
#include<gl/glut.h>
void myInit(void)
{
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.0f,0.0f,0.0f);
glPointSize(4.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,800.0,0.0,600.0);
}
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(0.0f,0.0f,1.0f);
glVertex2i(100,100);
glVertex2i(200,100);
glVertex2i(200,200);
glVertex2i(100,200);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(1.0f,0.0f,0.0f);
glVertex2i(100,200);
glVertex2i(150,300);
glVertex2i(200,200);
glEnd();
glFlush();
}
void main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutInitWindowPosition(100,100);
glutCreateWindow("OpenGl
Window");
myInit();
glutDisplayFunc(myDisplay);
glutMainLoop();
}
Que-3)
#include<windows.h>
#include<gl/gl.h>
#include<gl/glu.h>
#include<gl/glut.h>
#include<math.h>
#include<stdio.h>
void nkjInit()
{
glClearColor(1.0,1.0,1.0,0.0);
//Black background Color
glColor3f(0.0,0.0,0.0);//Drawing
Color yellow
glPointSize(2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,800,0.0,600.0);
}
void nkjBresenhamCircleGeneration3f(float x1, float y1,
float radious)
{
float
dcsnPrmtr=5/4-radious;//decision Parameter
int
k=0;
float
x=x1, y=y1;
x1=0;
y1=radious;
while(x1<y1)
{
if(dcsnPrmtr<0)
{
dcsnPrmtr
+= 2 * x1 + 2 + 1;
x1++;
}
else
//if(dcsnPrmtr
{
dcsnPrmtr
+= 2 * x1 + 2 - 2 * y1 - 2 + 1;
x1++;
y1--;
}
//generate
symmetry points
glVertex2i((int)(x+x1),(int)(y+y1));
glVertex2i((int)(x-x1),(int)(y+y1));
glVertex2i((int)(x+x1),(int)(y-y1));
glVertex2i((int)(x-x1),(int)(y-y1));
glVertex2i((int)(x+y1),(int)(y+x1));
glVertex2i((int)(x-y1),(int)(y+x1));
glVertex2i((int)(x+y1),(int)(y-x1));
glVertex2i((int)(x-y1),(int)(y-x1));
}
}
void dda(float x1, float y1, float x2,float y2)
{
float
m=(y2-y1)/(x2-x1);
if
(m<1)
{
while(x1<=x2)
{
glVertex2i((int)(x1),(int)(y1));
x1++;
y1=y1+m;
}
}
else if (m>1)
{
while(y1<=y2)
{
glVertex2i((int)(x1),(int)(y1));
x1=x1+(1/m);
y1++;
}
}
else
{
while(y1<=y2)
{
glVertex2i((int)(x1),(int)(y1));
x1++;
y1++;
}
}
}
void nkjDisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
nkjBresenhamCircleGeneration3f(400.0,300.0,150.0);
glEnd();
glBegin(GL_POINTS);
dda(60,30,160,100);
glEnd();
glFlush();
}
void main(int argc, char **argv)
{
glutInit(&argc,
argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutCreateWindow("Session2,
Exer4(nkj)");
glutDisplayFunc(nkjDisplay);
nkjInit();
glutMainLoop();
}
#include<windows.h>
#include<gl/gl.h>
#include<gl/glu.h>
#include<gl/glut.h>
#include<math.h>
#include<stdio.h>
void
nkjSwap(float *,float *);
void
nkjInit()
{
glClearColor(1.0,1.0,1.0,0.0); //Black
background Color
glColor3f(0.0,0.0,0.0);//Drawing Color
yellow
glPointSize(2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,800,0.0,600.0);
}
void
nkjBresenhamCircleGeneration3f(float x1, float y1, float radious)
{
float dcsnPrmtr=5/4-radious;//decision
Parameter
int k=0;
float x=x1, y=y1;
x1=0;
y1=radious;
while(x1<y1)
{
if(dcsnPrmtr<0)
{
dcsnPrmtr += 2 * x1 + 2 + 1;
x1++;
}
else //if(dcsnPrmtr
{
dcsnPrmtr += 2 * x1 + 2 - 2 * y1
- 2 + 1;
x1++;
y1--;
}
//generate symmetry points
glVertex2i((int)(x+x1),(int)(y+y1));
glVertex2i((int)(x-x1),(int)(y+y1));
glVertex2i((int)(x+x1),(int)(y-y1));
glVertex2i((int)(x-x1),(int)(y-y1));
glVertex2i((int)(x+y1),(int)(y+x1));
glVertex2i((int)(x-y1),(int)(y+x1));
glVertex2i((int)(x+y1),(int)(y-x1));
glVertex2i((int)(x-y1),(int)(y-x1));
}
}
void
nkjDisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
nkjBresenhamCircleGeneration3f(400.0,300.0,150.0);
glEnd();
glFlush();
}
void
main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutCreateWindow("Session2,
Exer4(nkj)");
glutDisplayFunc(nkjDisplay);
nkjInit();
glutMainLoop();
}
#include<windows.h>
#include<gl/gl.h>
#include<gl/glu.h>
#include<gl/glut.h>
#include<math.h>
#include<stdio.h>
void
nkjSwap(float *,float *);
void
nkjInit()
{
glClearColor(1.0,1.0,1.0,0.0); //Black
background Color
glColor3f(0.0,0.0,0.0);//Drawing Color
yellow
glPointSize(2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,800,0.0,600.0);
}
void
nkjBresenhamCircleGeneration3f(float x1, float y1, float radious)
{
float dcsnPrmtr=5/4-radious;//decision
Parameter
int k=0;
float x=x1, y=y1;
x1=0;
y1=radious;
while(x1<y1)
{
if(dcsnPrmtr<0)
{
dcsnPrmtr += 2 * x1 + 2 + 1;
x1++;
}
else //if(dcsnPrmtr
{
dcsnPrmtr += 2 * x1 + 2 - 2 * y1
- 2 + 1;
x1++;
y1--;
}
//generate symmetry points
glVertex2i((int)(x+x1),(int)(y+y1));
glVertex2i((int)(x-x1),(int)(y+y1));
glVertex2i((int)(x+x1),(int)(y-y1));
glVertex2i((int)(x-x1),(int)(y-y1));
glVertex2i((int)(x+y1),(int)(y+x1));
glVertex2i((int)(x-y1),(int)(y+x1));
glVertex2i((int)(x+y1),(int)(y-x1));
glVertex2i((int)(x-y1),(int)(y-x1));
}
}
void
nkjDisplay()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
nkjBresenhamCircleGeneration3f(400.0,300.0,150.0);
glEnd();
glFlush();
}
void
main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(800,600);
glutCreateWindow("Session2,
Exer4(nkj)");
glutDisplayFunc(nkjDisplay);
nkjInit();
glutMainLoop();
}
No comments:
Post a Comment
dont tuch