Vtu Lab Programs On Computer Graphics - 2018-2019 StudyChaCha

 User Name Remember Me? Password

#1
June 6th, 2013, 05:51 PM
 Unregistered Guest Posts: n/a
Vtu Lab Programs On Computer Graphics

Hey can you please provide me VTU Computer Graphics Lab Programs for 6th Sem?
#2
June 6th, 2013, 06:05 PM
 Super Moderator Join Date: Dec 2011 Posts: 40,525
Re: Vtu Lab Programs On Computer Graphics

As you want VTU Computer Graphics Lab Programs for 6th Sem so here I am providing you PDF file so you can download to below:
Attached Files
 VTU Computer Graphics Lab Programs for 6th Sem.pdf (182.0 KB, 137 views)
__________________
Answered By StudyChaCha Member

#3
September 29th, 2015, 03:45 PM
 Unregistered Guest Posts: n/a
Re: Vtu Lab Programs On Computer Graphics

Will you please give here Computer Graphics lab programs of BTECh 6th semester course of Visvesvaraya Technological University (VTU)?
#4
September 29th, 2015, 03:49 PM
 Super Moderator Join Date: Dec 2012 Posts: 19,443
Re: Vtu Lab Programs On Computer Graphics

As you want I am here giving you Computer Graphics lab programs of BTECh 6th semester course of Visvesvaraya Technological University (VTU).

Program:

networks
Program to draw 3D Sierpinski gasket, the user is allowed to determine the number of
divisions for the tetrahedron.
#include
#include
typedef float point[3];
point v[]={ {0.0,0.0,1.0},{0.0,0.9,-0.3},{-0.8,-0.4,-
0.3},{0.8,-0.4,-0.3}};
int n;
void triangle(point a,point b,point c)
{
glBegin(GL_POLYGON);
glVertex3fv(a);
glVertex3fv(b);
glVertex3fv(c);
glEnd();
}
void divide_triangle(point a,point b,point c,int m)
{
point v1,v2,v3;
int j;
if(m>0)
{
for(j=0;j<=2;j++)v1[j]=(a[j]+b[j])/2;
for(j=0;j<=2;j++)v2[j]=(a[j]+c[j])/2;
for(j=0;j<=2;j++)v3[j]=(b[j]+c[j])/2;
divide_triangle(a,v1,v2,m-1);
divide_triangle(c,v2,v3,m-1);
divide_triangle(b,v3,v1,m-1);
}
else
{
triangle(a,b,c);
}
}
void tetrahedron(int m)
{
glColor3f(1.0,0.0,0.0);
divide_triangle(v[0],v[1],v[2],m);
glColor3f(0.0,1.0,0.0);
divide_triangle(v[3],v[2],v[1],m);
glColor3f(0.0,0.0,1.0);
divide_triangle(v[0],v[3],v[1],m);
divide_triangle(v[0],v[2],v[3],m);
}
void display(void)
{
glClear(GL_DEPTH_BUFFER_BIT);
tetrahedron(n);
glFlush();
}
void myReshape(int w,int h)
{
glMatrixMode(GL_PROJECTION);
glOrtho(-2.0,2.0,-2.0,2.0,-10.0,10.0);
glMatrixMode(GL_MODELVIEW);
}
void main(int argc,char **argv)
{
printf("No. of divisions?");
scanf("%d",&n);
glutInit(&argc,argv);
glutInitWindowSize(500,500);
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glEnable(GL_DEPTH_TEST);
glutMainLoop();
}

Here is the attachment.

Visvesvaraya Technological University
Jnana Sangama
Belagavi, Karnataka 590018

Attached Files
 VTU CG lab program.pdf (182.0 KB, 29 views)
__________________
Answered By StudyChaCha Member

Reply to this Question / Ask Another Question

Message:
Options

 Forum Jump StudyChaCha Discussion Forum     General Topics     Exams     MBA / Business Schools     Study Abroad and Immigration Consultancy     Career and Jobs Questions by Topics     Medicine and Health     Management

All times are GMT +6.5. The time now is 12:58 AM.

 -- Default Style -- Default vBulletin -- Lightweight MBA Discussion - Job Discussion - Contact Us - StudyChaCha - Blog Archives - Forum Archive - Partners : Management Forum Eduvark MBA Forum Courses Forum Top