3D TAJ MAHAL OPENGL Source Code

/*--------------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<---------*/
/*
Press 'd' or 'D' for Details. Again press 'd' or 'D' for Details about Taj Mahal.
'r' or 'R' to Rotate.
's' or 'S' to Stop rotation.
'q' or 'Q' to Exit.
*/
#include<stdlib.h>
#include<GL/glut.h>
#include<string.h>
int i,dt=0,left=0,stop=0,detail=0;
float move_unit = 0.02f,posX,posY,posZ,angle,x,y;
GLfloat emitLight[] = {0.9, 0.9, 0.9, 0.01};
void *font = GLUT_BITMAP_TIMES_ROMAN_24;
void output(float x,float y, char *string)
{
int len, i;
glRasterPos2f(x, y);
len = (int) strlen(string);
for (i = 0; i < len; i++)
{
glutBitmapCharacter(font, string[i]);
}
}
void menu(int id)
{
if(id==5)
exit(0);
}
void details()
{
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,1.2);
glVertex3f(-30.0,30.0,-10.0);
glColor3f(0.0,0.0,0.0);
glVertex3f(30.0,30.0,-10.0);
glColor3f(0.0,0.0,0.2);
glVertex3f(30.0,-30.0,-10.0);
glColor3f(0.0,0.0,0.0);
glVertex3f(-30.0,-30.0,-10.0);
glEnd();
for(int sx=0;sx<=63;sx++)
{
glColor3f(0.0+rand()%12,1.0+rand()%12,1.0+rand()%12);
output(-24.0+sx*0.75,22.0,"__");
output(-24.0+sx*0.75,21.75,"__");
glColor3f(0.0+rand()%12,1.0+rand()%12,1.0+rand()%12);
output(-24.0+sx*0.75,-4.0,"__");
output(-24.0+sx*0.75,-3.75,"__");
glColor3f(0.0+rand()%12,1.0+rand()%12,1.0+rand()%12);
output(-20.0,-15.0+sx*0.6,"||");
glColor3f(0.0+rand()%12,1.0+rand()%12,1.0+rand()%12);
output(20.0,-15.0+sx*0.6,"||");
}
glColor3f(0.0+rand()%2,2.0+rand()%12,0.0+rand()%5);
output(-5.0,20.0,"3D TAJ MAHAL");
glColor3f(10.0,12.0,12.0);
output(-4.0,18.0,"Submitted by");
glColor3f(10.0,10.0,.0);
output(-6.5,15.0,"ABRAR M [1SV10CS001]");
glColor3f(10.0,12.0,12.0);
output(-6.0,12.0,"Under the guidance of ");
glColor3f(0.0,12.0,12.0);
output(-16.0,8.0,"Mr.Renukaradhya P C");
glColor3f(0.0,12.0,12.0);
output(-16.0,6.0,"B.E.,M.Tech.,MISTE. ");
glColor3f(0.0,12.0,12.0);
output(6.0,8.0,"Mr.Suthan R.");
glColor3f(0.0,12.0,12.0);
output(6.0,6.0,"B.E.,M.Tech.,MISTE.");
glColor3f(0.0,12.0,12.0);
output(-16.0,4.0,"Sr. Lecturer ,Dept. of C.S.E ");
glColor3f(0.0,12.0,12.0);
output(6.0,4.0,"Sr. Lecturer ,Dept. of C.S.E ");
glColor3f(0.0,12.0,12.0);
output(-16.0,2.0,"SIET,Tumkur");
glColor3f(0.0,12.0,12.0);
output(6.0,2.0,"SIET,Tumkur");
/*--------------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<---------*/
}
void details2()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,0.0);
glVertex3f(-30.0,30.0,-10.0);
glColor3f(0.0,0.0,1.0);
glVertex3f(30.0,30.0,-10.0);
glColor3f(0.0,0.0,0.0);
glVertex3f(30.0,-30.0,-10.0);
glColor3f(0.0,0.0,0.1);
glVertex3f(-30.0,-30.0,-10.0);
glEnd();
/*--------------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<---------*/
glColor3f(0.0,2.0,2.0);
output(-15.0,20.0," \"Taj Mahal\"");
glColor3f(2.0,2.0,0.0);
output(0.0,20.0," \"crown of palaces\")");
glColor3f(0.0,2.0,0.0);
output(-16.0,20.0,"The ( from Persian and Arabic,");
glColor3f(0.0,2.0,0.0);
output(-16.0,19.0,"is a white marble mausoleum located in Agra, ");
glColor3f(0.0,2.0,0.0);
output(-16.0,18.0,"Uttar Pradesh, India . It was built by Mughal ");
glColor3f(0.0,2.0,0.0);
output(-16.0,17.0,"emperor Shah Jahan in memory of his third ");
glColor3f(0.0,2.0,0.0);
output(-16.0,16.0,"wife, Mumtaz Mahal. The Taj Mahal is widely ");
glColor3f(0.0,2.0,0.0);
output(-16.0,15.0,"recognized as");
glColor3f(10.0,10.0,10.0);
output(-10.5,15.0,"\"the jewel of Muslim art in ");
glColor3f(10.0,10.0,10.0);
output(-16.0,14.0,"India and one of the universally admired ");
glColor3f(10.0,10.0,10.0);
output(-16.0,13.0,"masterpieces of the world's heritage\".");
glColor3f(0.0,2.0,15.0);
output(-16.0,10.0,"Taj Mahal is regarded by many as the finest ");
glColor3f(0.0,2.0,15.0);
output(-16.0,9.0,"example of Mughal architecture, a style that ");
glColor3f(0.0,2.0,15.0);
output(-16.0,8.0,"combines elements from Islamic, Persian, Ottoman ");
glColor3f(0.0,2.0,15.0);
output(-16.0,7.0,"Turkish and Indian architectural styles.");
glColor3f(1.0,1.0,20.0);
output(-16.0,4.0,"In 1631, Shah Jahan, emperor during the Mughal empire's period of greatest prosperity,");
glColor3f(1.0,1.0,20.0);
output(-16.0,3.0,"was grief-stricken when his third wife, Mumtaz Mahal, a Persian princess, died during");
glColor3f(1.0,1.0,20.0);
output(-16.0,2.0,"the birth of their 14th child, Gauhara Begum.Construction of the Taj Mahal began in 1632.");
glColor3f(1.0,1.0,20.0);
output(-16.0,1.0,"The court chronicles of Shah Jahan's grief illustrate the love story traditionally held as ");
glColor3f(1.0,1.0,20.0);
output(-16.0,0.0,"an inspiration for Taj Mahal. The principal mausoleum was completed in 1648 and ");
glColor3f(1.0,1.0,20.0);
output(-16.0,-1.0,"the surrounding buildings and garden were finished five years later.");
}
void star(GLfloat s1,GLfloat s2,GLfloat s3)
{
glColor3f(0.0+rand()%10,0.0+rand()%10,10.0+rand()%10);
glPushMatrix();
glTranslatef(0.0+s1,0+s2,0.0+s3);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.55,0.0);
glVertex3f(0.3,-0.15,0.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(-0.3,-0.15,0.0);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.4,0.3,0.0);
glVertex3f(-0.4,0.3,0.0);
glEnd();
glPopMatrix();
}
void stars()
{
glPointSize(1.45);
//Stars----->start
for(i=0;i<10;i++)
{
glBegin(GL_POINTS);
glColor3f(1.0,0.0,0.0);
glVertex3f((rand()%10)+0.0,6.0,(rand()%10)+0.0);
glColor3f(0.0,1.0,0.0);
glVertex3f((rand()%10)+0.0,(rand()%5)+7.0,0.0);
glColor3f(0.0,0.0,1.0);
glVertex3f(0.0,5+(rand()%3)+0.0,(rand()/10)+0.0);
glColor3f(1.0,1.0,0.0);
glVertex3f((rand()/10)+0.0,5+(rand()%3)+0.0,-(rand()%10)+0.0);
/*--------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<-------*/
glColor3f(0.0,1.0,1.0);
glVertex3f(-(rand()%10)+0.0,4+(rand()%3)+0.0,-(rand()%10)+0.0);
glColor3f(1.0,0.0,1.0);
glVertex3f(-(rand()%10)+0.0,(rand()%5)+5+0.0,(rand()%10)+0.0);
glColor3f(1.0,0.5,0.0);
glVertex3f(-(rand()%10)+0.0,4.0,(rand()%3)+0.0);
glColor3f(0.0,1.0,0.5);
glVertex3f(-(rand()%10)+0.0,(rand()%3)+6.0,0.0);
glColor3f(0.5,0.0,1.0);
glVertex3f(0.0,6+(rand()%10)+0.0,-(rand()%10)+0.0);
glColor3f(1.0,1.0,0.0);
glVertex3f(-(rand()%10)+0.0,5+(rand()%3)+0.0,-(rand()%10)+0.0);
glBegin(GL_POINTS);
glColor3f(1.0,0.0,0.0);
glVertex3f((rand()%10)+0.0,9.0,-(rand()%10)+0.0);
glColor3f(0.0,1.0,0.0);
glVertex3f((rand()%10)+0.0,(rand()%3)+5.0,-(rand()%10)+0.0);
glEnd();
}
}
void minar()
{
glPushMatrix();
glColor3f(1.3,1.3,1.3);
glRotatef(-90.0,01.0,0.0,0.0);
glRotatef(0.0,0.0,01.0,0.0);
glRotatef(0.0,0.0,0.0,1.0);
GLUquadricObj *n=gluNewQuadric();
gluCylinder(n,1.2,0.8,12.0,100,100);
glPopMatrix();
/*--------------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(1.0, 1.0, 1.0);
glRotatef(-90.0,01.0,0.0,0.0);
glRotatef(0.0,0.0,01.0,0.0);
glRotatef(0.0,0.0,0.0,1.0);
glScalef(1.0,1.0,1.1);
GLUquadricObj *m=gluNewQuadric();
gluCylinder(m,1.3,1.3,1.0,8.0,100.0);
glPopMatrix();
/*--------------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(2.0,2.0,2.0);
glTranslatef(0.0,3.5,0.0);
glRotatef(90.0,1.0,0.0,0.0);
glScalef(0.8,0.8,1.0);
glutSolidTorus(0.2,1.5,100,50);
glPopMatrix();
/*--------------<<<3D Taj Mahal>>>----*****---->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(2.0,2.0,2.0);
glTranslatef(0.0,7.5,0.0);
glRotatef(90.0,1.0,0.0,0.0);
glScalef(0.7,0.7,1.0);
glutSolidTorus(0.2,1.5,100,50);
glPopMatrix();
/*------->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(2.0,2.0,2.0);
glTranslatef(0.0,11.72,0.0);
glRotatef(90.0,1.0,0.0,0.0);
glScalef(0.55,0.55,1.1);
glutSolidTorus(0.2,1.5,100,50);
glPopMatrix();
}
void wall()
{
glPushMatrix();
glColor3f(1.5,1.5,1.5);
glScalef(1.0,0.8,0.025);
glutSolidCube(11.8);
glPopMatrix();
glPushMatrix();
// glColor3f(0.6,0.7,0.8);
glColor3f(2.0,2.0,2.0);
glTranslatef(0.0,0.7,0.0);
glScalef(0.55,1.0,0.05);
glutSolidCube(10.0);
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
//glColor3f(255,255,255);
glTranslatef(0.0,-1.0,0.0);
glScalef(0.6,0.9,0.1);
glutSolidCube(7.0);
glPopMatrix();
/*------->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(0.3,0.4,0.5);
//glColor3f(255,255,255);
glTranslatef(0.0,1.9,0.35);
glScalef(1.0,1.0,1.0);
GLUquadricObj *p=gluNewQuadric();
gluPartialDisk(p,0,2.12,100,100,-90,180.0);
glPopMatrix();
/*------->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(0.0,1.9,-0.35);
glRotatef(180.0,0.0,1.0,0.0);
glScalef(1.0,1.0,1.0);
GLUquadricObj *q=gluNewQuadric();
gluPartialDisk(q,0,2.12,100,100,-90,180.0);
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(0.0,3.8,0.35);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.5,0.0);
glVertex3f(-0.95,0.0,0.0);
glVertex3f(0.95,0.0,0.0);
glEnd();
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(0.0,3.8,-0.35);
glRotatef(180.0,0.0,1.0,0.0);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.5,0.0);
glVertex3f(-0.95,0.0,0.0);
glVertex3f(0.95,0.0,0.0);
glEnd();
glPopMatrix();
}
void windows()
{
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(4.5,0.0,0.0);
glScalef(0.6,0.65,0.15);
glutSolidCube(3.5);
glTranslatef(0.0,6.5,0.0);
glutSolidCube(3.5);
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(-4.5,0.0,0.0);
glScalef(0.6,0.65,0.15);
glutSolidCube(3.5);
glTranslatef(0.0,6.5,0.0);
glutSolidCube(3.5);
glPopMatrix();//--
/*------->>>>> ABRAR M <<<<<<---------*/
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(4.5,1.0,0.33);
glScalef(1.0,1.0,1.0);
GLUquadricObj *wp=gluNewQuadric();
gluPartialDisk(wp,0,1.0,100,100,-90,180.0);
glTranslatef(0.0,4.2,0.0);
gluPartialDisk(wp,0,1.0,100,100,-90,180.0);
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(-4.5,1.0,0.33);
glScalef(1.0,1.0,1.0);
GLUquadricObj *wp1=gluNewQuadric();
gluPartialDisk(wp,0,1.0,100,100,-90,180.0);
glTranslatef(0.0,4.2,0.0);
gluPartialDisk(wp1,0,1.0,100,100,-90,180.0);
glPopMatrix();
}
void beams(GLdouble r,GLdouble h)
{
glPushMatrix();
glColor3f(0.9, 1.0, 0.9);
glRotatef(-90.0,01.0,0.0,0.0);
glRotatef(0.0,0.0,01.0,0.0);
glRotatef(0.0,0.0,0.0,1.0);
GLUquadricObj *ob=gluNewQuadric();
gluCylinder(ob,r,r,h,6.0,100.0);
glPopMatrix();
}
void crosswall()
{
glPushMatrix();
glColor3f(1.5,1.5,1.5);
glScalef(1.0,3.2,0.1);
glutSolidCube(3);
glPopMatrix(); glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(0,-3.0,0);
glScalef(0.6,0.65,0.15);
glutSolidCube(3.5);
glTranslatef(0,6.5,0);
glutSolidCube(3.5);
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(0,2.2,0.27);
glScalef(1.0,1.0,1.0);
GLUquadricObj *sp=gluNewQuadric();
gluPartialDisk(sp,0,1.0,100,100,-90,180.0);
glTranslatef(0,-4.2,0.0);
gluPartialDisk(sp,0,1.0,100,100,-90,180.0);
glPopMatrix();
glPushMatrix();
glColor3f(0.3,0.4,0.5);
glTranslatef(0,2.2,-0.27);
glRotatef(180.0,0.0,1.0,0.0);
glScalef(1.0,1.0,1.0);
GLUquadricObj *sq=gluNewQuadric();
gluPartialDisk(sq,0,1.0,100,100,-90,180.0);
glTranslatef(0,-4.2,0.0);
gluPartialDisk(sq,0,1.0,100,100,-90,180.0);
glPopMatrix();
}
void gumbaz()
{
////////////*********************************
//////Contact me for full code//
//Abrar
}
http://abrartechworld.blogspot.com/

http://abrartechworld.blogspot.com/
void taj()
{
/*glBegin(GL_LINES); glColor3f(1.0,0.0,0.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(25.0,0.0,0.0);
glColor3f(0.0,1.0,0.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.0,25.0,0.0);
glColor3f(0.0,0.0,1.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.0,0.0,25.0);
glEnd();*/
/*ABRAR M */
glPushMatrix();
glTranslatef(12.0,0.0,12.0);
minar();
glPopMatrix();
glPushMatrix();
glTranslatef(-12.0,0.0,12.0);
minar();
glPopMatrix();
glPushMatrix();
glTranslatef(12.0,0.0,-12.0);
minar();
glPopMatrix();
glPushMatrix();
glTranslatef(-12.0,0.0,-12.0);
minar();
glPopMatrix();
glPushMatrix();
glColor3f(1.0, 1.0, 1.0);
glTranslatef(0.0,0.5,0.0);
glScalef(1.0,0.05,1.0);
glutSolidCube(24.0);
glPopMatrix();
glPushMatrix();
glColor3f(1.0, 1.0, 1.0);
glTranslatef(0.0,0.5,12.8);
glScalef(4.5,1.0,1.7);
glutSolidCube(1.2);
glPopMatrix();
glPushMatrix();
glTranslatef(0.0,5.0,8.0);
wall();
glPopMatrix();
glPushMatrix();
glTranslatef(0.0,5.0,-8.0);
wall();
glPopMatrix();
glPushMatrix();
glTranslatef(8.0,5.0,0.0);
glRotatef(90.0,0.0,1.0,0.0);
wall();
glPopMatrix();
glPushMatrix();
glTranslatef(-8.0,5.0,0.0);
glRotatef(90.0,0.0,1.0,0.0);
wall();
glPopMatrix();
glPushMatrix();
glTranslatef(6.95,5.0,-6.95);
glRotatef(-45.0,0.0,1.0,0.0);
crosswall();
glPopMatrix();
glPushMatrix();
glTranslatef(-6.95,5.0,6.95);
glRotatef(-45.0,0.0,1.0,0.0);
crosswall();
glPopMatrix();
glPushMatrix();
glTranslatef(-6.95,5.0,-6.95);
glRotatef(45.0,0.0,1.0,0.0);
crosswall();
glPopMatrix();
//Made by AbrarMKhan
glPushMatrix();
glTranslatef(6.95,5.0,6.95);
glRotatef(45.0,0.0,1.0,0.0);
crosswall();
glPopMatrix();
glPushMatrix();
glTranslatef(2.8,0.0,8.2);
beams(0.14,12.0);
glTranslatef(-5.6,0.0,0.0);
beams(0.14,12.0);
glPopMatrix();
glPushMatrix();
glTranslatef(-2.8,0.0,-8.2);
beams(0.14,12.0);
glTranslatef(5.6,0.0,0.0);
beams(0.14,12.0);
glPopMatrix();
glPushMatrix();
glTranslatef(-8.2,0.0,-2.8);
beams(0.14,12.0);
glTranslatef(0.0,0.0,5.6);
beams(0.14,12.0);
glPopMatrix(); glPushMatrix();
glTranslatef(8.2,0.0,2.8);
beams(0.14,12.0);
glTranslatef(0.0,0.0,-5.6);
beams(0.14,12.0);
glPopMatrix();
glPushMatrix();
glTranslatef(6.0,0.0,8.2);
beams(0.12,11.0);
glTranslatef(-12.0,0.0,0.0);
beams(0.12,11.0);
glPopMatrix();
glPushMatrix();
glTranslatef(-6.0,0.0,-8.2);
beams(0.12,11.0);
glTranslatef(12.0,0.0,0.0);
beams(0.12,11.0);
glPopMatrix();
glPushMatrix();
glTranslatef(-8.2,0.0,-6.0);
beams(0.12,11.0);
glTranslatef(0.0,0.0,12.0);
beams(0.12,11.0);
glPopMatrix();
glPushMatrix();
glTranslatef(8.2,0.0,6.0);
beams(0.12,11.0);
glTranslatef(0.0,0.0,-12.0);
beams(0.12,11.0);
glPopMatrix();
glPushMatrix();
glTranslatef(0.0,2.0,7.9);
windows();
glPopMatrix();
glPushMatrix();
glTranslatef(0.0,2.0,-7.9);
glRotatef(180.0,0.0,1.0,0.0);
windows();
glPopMatrix();
glPushMatrix();
glTranslatef(7.9,2.0,0.0);
glRotatef(90.0,0.0,1.0,0.0);
windows();
glPopMatrix();
glPushMatrix();
glTranslatef(-7.9,2.0,0.0);
glRotatef(-90.0,0.0,1.0,0.0);
windows();
glPopMatrix();
glPushMatrix();
glColor3f(0.8,0.8,0.8);
glTranslatef(0.0,9.5,0.0);
glScalef(0.75,0.02,1.0);
glutSolidCube(16.0);
glPopMatrix(); //---
glPushMatrix();
glColor3f(0.8,0.8,0.8);
glTranslatef(0.0,9.5,0.0);
glScalef(1.0,0.02,0.75);
glutSolidCube(16.0);
glPopMatrix();
glPushMatrix();
glColor3f(0.8,0.8,0.8);
glTranslatef(5.9,9.5,5.9);
glRotatef(45.0,0.0,1.0,0.0);
glScalef(1.0,0.1,1.0);
glutSolidCube(3);
glPopMatrix();
glPushMatrix();
glColor3f(0.8,0.8,0.8);
glTranslatef(5.9,9.5,-5.9);
glRotatef(45.0,0.0,1.0,0.0);
glScalef(1.0,0.1,1.0);
glutSolidCube(3);
glPopMatrix();
glPushMatrix();
glColor3f(0.8,0.8,0.8);
glTranslatef(-5.9,9.5,-5.9);
glRotatef(45.0,0.0,1.0,0.0);
glScalef(1.0,0.1,1.0);
glutSolidCube(3);
glPopMatrix();
glPushMatrix();
glColor3f(0.8,0.8,0.8);
glTranslatef(-5.9,9.5,5.9);
glRotatef(45.0,0.0,1.0,0.0); glScalef(1.0,0.1,1.0);
glutSolidCube(3); glPopMatrix();
//...
//....
glPushMatrix();
glTranslatef(5.0,9.0,5.0);
glScalef(0.4,0.50,0.4);
gumbaz();
glPopMatrix();
glPushMatrix();
glTranslatef(-5.0,9.0,5.0);
glScalef(0.4,0.50,0.4);
gumbaz();
glPopMatrix();
glPushMatrix();
glTranslatef(-5.0,9.0,-5.0);
glScalef(0.4,0.50,0.4);
gumbaz();
glPopMatrix();
glPushMatrix();
glTranslatef(5.0,9.0,-5.0);
glScalef(0.4,0.50,0.4);
gumbaz();
glPopMatrix();
glPushMatrix();
glTranslatef(12.0,11.5,12.0);
glScalef(0.25,0.3,0.25);
gumbaz();
glPopMatrix()
glPushMatrix();
glTranslatef(-12.0,11.5,12.0);
glScalef(0.25,0.3,0.25);
gumbaz();
glPopMatrix();
glPushMatrix();
glTranslatef(12.0,11.5,-12.0);
glScalef(0.25,0.3,0.25);
gumbaz();
glPopMatrix();
glPushMatrix();
glTranslatef(-12.0,11.5,-12.0);
glScalef(0.25,0.3,0.25);
gumbaz();
glPopMatrix();
}
http://abrartechworld.blogspot.com/
static GLfloat theta[]={0.0,0.0,0.0};
static GLint axis=1;
void display(void)
{
//////Contact me for full code////Abrar
}
if(detail==1&&dt<1500)
{
details();
dt++;
star(-6.0,20.00,-3.0);
star(3.0,20.00,-3.0);
}
if((detail==1&&dt==1500)||(detail>1))
{
details2();
glPushMatrix();
glTranslatef(10.0,10.0,0.0);
glScalef(0.5,0.5,0.5);
glRotatef(theta[0],1.0,0.0,0.0);
glRotatef(theta[1],0.0,1.0,0.0);
glRotatef(theta[2],0.0,0.0,1.0);
taj();
glPopMatrix();
}
glFlush();
glutSwapBuffers();
/*ABRAR*/
}
void spin()
{ if(left==0 && stop==0)
{
theta[axis]+=1.0;
if(theta[axis]>360.0) theta[axis]-=360.0;
glutPostRedisplay();
}
else if(left==1 && stop==0)
{
theta[axis]-=1.0;
if(theta[axis]>360.0) theta[axis]-=360.0;
glutPostRedisplay();
}
glutPostRedisplay();
}
void mouse(int btn,int state,int x,int y)
{
if(btn==GLUT_LEFT_BUTTON && state==GLUT_DOWN) left=1;//axis=0;
if(btn==GLUT_MIDDLE_BUTTON && state==GLUT_DOWN) left=0;//axis=1;
if(btn==GLUT_RIGHT_BUTTON && state==GLUT_DOWN) axis=2;
}
void keyboardown(int key, int x, int y) {
switch (key) {
case GLUT_KEY_RIGHT:
// axis=0;
axis=1;
left=0;
break;
case GLUT_KEY_LEFT:
axis=1;
left=1;
break;
case GLUT_KEY_UP:
// axis=2;
break;
case GLUT_KEY_DOWN:
// axis=0;
break;
default:
break;
}
glutPostRedisplay();
}
void keyboardFunc( unsigned char key, int x, int y )
{
switch( key )
{
case 's':
case 'S':
stop=1;
break;
case 'r':
case 'R':
stop=0;
break;
case 'q':
case 'Q':
exit(0);
break;
case 'd':
case 'D':
detail+=1;
break;
}
glutPostRedisplay();
}
void myReshape(int w,int h)
{
http://abrartechworld.blogspot.com/
//////Contact me for full code//
}
http://abrartechworld.blogspot.com/
void main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);
glutInitWindowSize(1080,720);
//glutInitWindowSize(920,780);
glutCreateWindow("3D Taj Mahal");
glutReshapeFunc(myReshape);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING); //Enable lighting
glEnable(GL_LIGHT0); //Enable light #0
glEnable(GL_LIGHT1); //Enable light #1
glEnable(GL_NORMALIZE); //Automatically normalize normals
glShadeModel(GL_SMOOTH); //Enable smooth shading
glutDisplayFunc(display);
//AbrarMKhan
glutIdleFunc(spin);
glutMouseFunc(mouse);
glutSpecialFunc(keyboardown);
glutKeyboardFunc(keyboardFunc);
glEnable(GL_DEPTH_TEST);
glutCreateMenu(menu);
glutAddMenuEntry("*******",1);
glutAddMenuEntry("D | d :-Details",2);
glutAddMenuEntry("S | s :-Stop ",3);
glutAddMenuEntry("R | r :-Rotate ",4);
glutAddMenuEntry("Q | q :-Quit",5);
glutAddMenuEntry("******",6);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
}
AbrarMKhan10
Can i get a full source code please
ReplyDeleteThis comment has been removed by the author.
ReplyDeletecan i hav the full source code
ReplyDeleteCan I get the full source code please please please please??
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello abrar.. cud u send me the full code on furqanm05@gmail.com
ReplyDeletehello.. can i get full source code? this is my email nadirahhamzah24@gmail.com
ReplyDeleteHello sir... could you please send me the source code on ijazibrahim818@gmail.com
ReplyDelete