Location via proxy:
[ UP ]
[Report a bug]
[Manage cookies]
No cookies
No scripts
No ads
No referrer
Show this form
Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Loading...
User Settings
close menu
Welcome to Scribd!
Upload
Read for free
FAQ and support
Language (EN)
Sign in
0 ratings
0% found this document useful (0 votes)
6 views
6th Week-Lab Program
Uploaded by
akr28921
AI-enhanced
Copyright:
© All Rights Reserved
Available Formats
Download
as DOCX, PDF, TXT or read online from Scribd
Download
Save
Save 6th week-Lab program For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
6th Week-Lab Program
Uploaded by
akr28921
0 ratings
0% found this document useful (0 votes)
6 views
3 pages
AI-enhanced title
Document Information
click to expand document information
Original Title
6th week-Lab program
Copyright
© © All Rights Reserved
Available Formats
DOCX, PDF, TXT or read online from Scribd
Share this document
Share or Embed Document
Sharing Options
Share on Facebook, opens a new window
Facebook
Share on Twitter, opens a new window
Twitter
Share on LinkedIn, opens a new window
LinkedIn
Share with Email, opens mail client
Email
Copy link
Copy link
Did you find this document useful?
0%
0% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Is this content inappropriate?
Report
Copyright:
© All Rights Reserved
Available Formats
Download
as DOCX, PDF, TXT or read online from Scribd
Download now
Download as docx, pdf, or txt
Save
Save 6th week-Lab program For Later
0 ratings
0% found this document useful (0 votes)
6 views
3 pages
6th Week-Lab Program
Uploaded by
akr28921
AI-enhanced title
Copyright:
© All Rights Reserved
Available Formats
Download
as DOCX, PDF, TXT or read online from Scribd
Save
Save 6th week-Lab program For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download as docx, pdf, or txt
Jump to Page
You are on page 1
of 3
Search inside document
5.
Develop a program to demonstrate 3D transformation on basic objects
#include <stdlib.h>
#include <GL/glut.h>
GLfloat vertices[][3] = {{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0},{1.0,1.0,-1.0}, {-1.0,1.0,1.0},
{-1.0,-1.0,1.0} {1.0,-1.0,1.0}, {1.0,1.0,1.0}, {-1.0,1.0,1.0}};
GLfloat normals[][3] = {{-1.0,-1.0,-1.0},{1.0,-1.0,-1.0}, {1.0,1.0,-1.0}, {-1.0,1.0,-1.0},
{-1.0,-1.0,1.0} {1.0,-1.0,1.0}, {1.0,1.0,1.0}, {-1.0,1.0,1.0}};
GLfloat colors[][3] = {{0.0,0.0,0.0},{1.0,0.0,0.0}, {1.0,1.0,0.0}, {0.0,1.0,0.0},
{0.0,0.0,1.0},{1.0,0.0,1.0}, {1.0,1.0,1.0}, {0.0,1.0,1.0}};
void polygon(int a, int b, int c , int d)
{/* draw a polygon via list of vertices */
glBegin(GL_POLYGON);
glColor3fv(colors[a]);
glNormal3fv(normals[a]);
glVertex3fv(vertices[a]);
glColor3fv(colors[b]);
glNormal3fv(normals[b]);
glVertex3fv(vertices[b]);
glColor3fv(colors[c]);
glNormal3fv(normals[c]);
glVertex3fv(vertices[c]);
glColor3fv(colors[d]);
glNormal3fv(normals[d]);
glVertex3fv(vertices[d]);
glEnd();
}
void display(void)
{/* display callback, clear frame buffer and z buffer,
rotate cube and draw, swap buffers */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
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);
colorcube();
glFlush();
glutSwapBuffers();
void spinCube()
{/* Idle callback, spin cube 2 degrees about selected axis*/
theta[axis] += 0.1;
if( theta[axis] > 360.0 ) theta[axis] -= 360.0;
/* display(); */
glutPostRedisplay();
}
void mouse(int btn, int state, int x, int y)
{/* mouse callback, selects an axis about which to rotate */
if(btn==GLUT_LEFT_BUTTON && state == GLUT_DOWN) axis = 0;
if(btn==GLUT_MIDDLE_BUTTON && state == GLUT_DOWN) axis = 1;
if(btn==GLUT_RIGHT_BUTTON && state == GLUT_DOWN) axis = 2;
}
void myReshape(int w, int h)
{ glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho(-2.0, 2.0, -2.0 * (GLfloat) h / (GLfloat) w,
2.0 * (GLfloat) h / (GLfloat) w, -10.0, 10.0);
else
glOrtho(-2.0 * (GLfloat) w / (GLfloat) h,
2.0 * (GLfloat) w / (GLfloat) h, -2.0, 2.0, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
}
void main(int argc, char **argv)
{
glutInit(&argc, argv);
/* need both double buffering and z buffer */
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(500, 500);
glutCreateWindow("Rotating a Color Cube");
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutIdleFunc(spinCube);
glutMouseFunc(mouse);
glEnable(GL_DEPTH_TEST); /* Enable hidden surface--removal */
glutMainLoop();
}
You might also like
4.84kWh - Standard - Product Specification - R0.2 - 20190319
Document
48 pages
4.84kWh - Standard - Product Specification - R0.2 - 20190319
danilo reyes
100% (2)
Camc Curriculum - Final
Document
0 pages
Camc Curriculum - Final
gus_lions
No ratings yet
Kladivar
Document
107 pages
Kladivar
anta77
No ratings yet
Understanding The Self
Document
4 pages
Understanding The Self
Kevin
0% (1)
Program To Draw A Color Cube and Spin It Using Opengl Transformation Matrices
Document
3 pages
Program To Draw A Color Cube and Spin It Using Opengl Transformation Matrices
Vedant Sinha
No ratings yet
Document
Document
6 pages
Document
fyfy
No ratings yet
Cube Camera
Document
3 pages
Cube Camera
Sneha
No ratings yet
Draw A Color Cube and Allow The User To Move The Camera Suitably To Experiment With Perspective Viewing
Document
3 pages
Draw A Color Cube and Allow The User To Move The Camera Suitably To Experiment With Perspective Viewing
Vishal B B
No ratings yet
Program 1:-Implement Bresenham's Line Drawing Algorithm For All Types of Slope
Document
25 pages
Program 1:-Implement Bresenham's Line Drawing Algorithm For All Types of Slope
RV Yashvanth
No ratings yet
CGV Lab Manual
Document
30 pages
CGV Lab Manual
Jagath J
No ratings yet
Cube Rotation
Document
3 pages
Cube Rotation
Pramoda S
No ratings yet
Implement Brenham's Line Drawing Algorithm For All Types of Slope
Document
24 pages
Implement Brenham's Line Drawing Algorithm For All Types of Slope
Suhas.R
No ratings yet
CG Removed
Document
29 pages
CG Removed
abhishek
No ratings yet
CG Manual PDF
Document
33 pages
CG Manual PDF
Jaina H Shah
No ratings yet
Cube Rotation
Document
3 pages
Cube Rotation
Hittu Prasad
No ratings yet
Program 1: AIM:Implement Brenham's Line Drawing Algorithm For All Types of Slope
Document
26 pages
Program 1: AIM:Implement Brenham's Line Drawing Algorithm For All Types of Slope
Aasim Inamdar
No ratings yet
Program1:Implement Brenham's Line Drawing Algorithm For All Types of Slope
Document
33 pages
Program1:Implement Brenham's Line Drawing Algorithm For All Types of Slope
Swapnapriya
No ratings yet
CG & V Labmanual
Document
44 pages
CG & V Labmanual
sri kbs
No ratings yet
Program To Recursively Subdivide A Tetrahedron To Form 3D Serpinsky Gasket - The Number of Recursive Steps Is To Be Specified by The User
Document
29 pages
Program To Recursively Subdivide A Tetrahedron To Form 3D Serpinsky Gasket - The Number of Recursive Steps Is To Be Specified by The User
ani2011
No ratings yet
CG Lab Programs Using Opengl: #Include Void
Document
32 pages
CG Lab Programs Using Opengl: #Include Void
sundaravanan_rm
No ratings yet
Cgmannual2018 Content
Document
24 pages
Cgmannual2018 Content
FunZoa Life
No ratings yet
Programas para Generar Carros
Document
45 pages
Programas para Generar Carros
claudia serrano
No ratings yet
Lab Manual
Document
28 pages
Lab Manual
somnathabhagata
No ratings yet
Plantra
Document
3 pages
Plantra
Luis daniel Arzani castro
No ratings yet
CGV Lab
Document
3 pages
CGV Lab
Shobha Kumar
No ratings yet
Her Mite
Document
5 pages
Her Mite
Mukul Pai
No ratings yet
Pgm5 - 3D Transformation On Basic Objects
Document
3 pages
Pgm5 - 3D Transformation On Basic Objects
ram patil
No ratings yet
CG Lab Experiments
Document
11 pages
CG Lab Experiments
Shahriar Ahmed
No ratings yet
CG Lab Manual-2
Document
8 pages
CG Lab Manual-2
nuredinmaru5
No ratings yet
LAPO
Document
16 pages
LAPO
Wisnu Al-Alfarizi
No ratings yet
CG Manual 21 Scheme
Document
25 pages
CG Manual 21 Scheme
shaquibk449
No ratings yet
Solution
Document
7 pages
Solution
c.ronaldo2012777
No ratings yet
CG Lab Programs
Document
17 pages
CG Lab Programs
Nigar
No ratings yet
KTĐH Chính
Document
26 pages
KTĐH Chính
Hien Luong
No ratings yet
Assignment01
Document
7 pages
Assignment01
Geerbani Shashi
No ratings yet
Micro 1
Document
2 pages
Micro 1
Sharfuddin Shariff
No ratings yet
CGV Lab Manual
Document
28 pages
CGV Lab Manual
renuka_ec694456
No ratings yet
CG Lab Vtu Biet
Document
15 pages
CG Lab Vtu Biet
VINAYAKA.K
No ratings yet
Pgm4 - 2D Transformation On Basic Objects
Document
4 pages
Pgm4 - 2D Transformation On Basic Objects
ram patil
No ratings yet
QR 1
Document
24 pages
QR 1
MohAmed ReFat
No ratings yet
Đồ họa máy tính
Document
7 pages
Đồ họa máy tính
Minh Bùi Long Bình
No ratings yet
Kubus: Nonik Putri/5171311006/PTM3
Document
4 pages
Kubus: Nonik Putri/5171311006/PTM3
nn
No ratings yet
Computer Graphics Lab
Document
126 pages
Computer Graphics Lab
princeji
No ratings yet
Lab04 - Nguyen Đuc Hoai Vu - 102220048
Document
9 pages
Lab04 - Nguyen Đuc Hoai Vu - 102220048
Vũ Hoài
No ratings yet
3d Text Code
Document
9 pages
3d Text Code
Dilip Kumar
No ratings yet
Viewing and Transformation
Document
28 pages
Viewing and Transformation
TarekHemdan
No ratings yet
LabDHMT ViewTransformation
Document
8 pages
LabDHMT ViewTransformation
nguyenhai742004
No ratings yet
Fractal Tree Project
Document
12 pages
Fractal Tree Project
Jaid Mulla UT
No ratings yet
LAB7
Document
2 pages
LAB7
Kishonandan Mv
No ratings yet
Sodapdf Converted 1
Document
10 pages
Sodapdf Converted 1
seenu.80506
No ratings yet
Tutor 1-5
Document
13 pages
Tutor 1-5
hilmi fauzi
No ratings yet
Grafika Kompjuterike Ushtrim 5
Document
3 pages
Grafika Kompjuterike Ushtrim 5
Душко Маџоски
No ratings yet
All CG Programs
Document
45 pages
All CG Programs
haripriya.888m
No ratings yet
CG Lab
Document
28 pages
CG Lab
vaishuteju12
No ratings yet
Transformasi Dan Animasi Grafkom Glut
Document
19 pages
Transformasi Dan Animasi Grafkom Glut
indri
No ratings yet
Tinywow - Computer Graphics Experiments (2) - 41880454
Document
77 pages
Tinywow - Computer Graphics Experiments (2) - 41880454
xedewej976
No ratings yet
Robot
Document
28 pages
Robot
MRB
No ratings yet
Source Code Pemrograman Grafik
Document
4 pages
Source Code Pemrograman Grafik
ErwinA.Yusuf
100% (1)
Microsoft Word Document جديد
Document
30 pages
Microsoft Word Document جديد
اسامه العبسي
No ratings yet
Helicopter Code
Document
11 pages
Helicopter Code
Shashank Shashank. A. R
No ratings yet
Tugas Proyek Komputer Grafis
Document
44 pages
Tugas Proyek Komputer Grafis
marsaljuarmes123
No ratings yet
Rock Eet
Document
5 pages
Rock Eet
melvinnyaata
No ratings yet
Computer Engineering Laboratory Solution Primer
From Everand
Computer Engineering Laboratory Solution Primer
Karan Bhandari
No ratings yet
150+ C Pattern Programs
From Everand
150+ C Pattern Programs
Hernando Abella
No ratings yet
UsbFix Report
Document
3 pages
UsbFix Report
Baazaoui Mohamed Hedi
No ratings yet
Science 8 DLL (Reference)
Document
40 pages
Science 8 DLL (Reference)
Jovilyn Jardiel
No ratings yet
Catalog Robolabs 2018
Document
19 pages
Catalog Robolabs 2018
Jesus Conceicao
No ratings yet
Autocoid
Document
7 pages
Autocoid
Idrissa Conteh
No ratings yet
Tryvmware P Activate - PHP P Vmware-workstation&Lp 1
Document
2 pages
Tryvmware P Activate - PHP P Vmware-workstation&Lp 1
Onecio Araujo Ribeiro
No ratings yet
CyberAces Module3-Python 3 Scripts
Document
16 pages
CyberAces Module3-Python 3 Scripts
Cyrlland
No ratings yet
Physics Practical File
Document
31 pages
Physics Practical File
Ayush
No ratings yet
PDF
Document
4 pages
PDF
rawad
No ratings yet
Tinnitus Handicap Inventory (THI)
Document
4 pages
Tinnitus Handicap Inventory (THI)
Dian Setyaningrum
No ratings yet
Class 3 Computer Studies
Document
3 pages
Class 3 Computer Studies
TECHNO PASSPORT
No ratings yet
Percobaan Produksi Biogas Dari Kotoran S 9de36e88
Document
7 pages
Percobaan Produksi Biogas Dari Kotoran S 9de36e88
Galih Purboningrum
No ratings yet
Patna Master Plan Report
Document
335 pages
Patna Master Plan Report
ARUN KUMAR
No ratings yet
Problem Set 3
Document
3 pages
Problem Set 3
kaylovellu
No ratings yet
7FBR10 Dikonversi
Document
31 pages
7FBR10 Dikonversi
hdb jualforklift
No ratings yet
Green Human Resource Management Practice
Document
15 pages
Green Human Resource Management Practice
Kawsar Ahmed Badhon
No ratings yet
Dokumen - Tips Brian F Towler Fundamental Principles of Reservoir Engineering Spe Textbook
Document
2 pages
Dokumen - Tips Brian F Towler Fundamental Principles of Reservoir Engineering Spe Textbook
Héctor Gallardo
No ratings yet
HBO-Midterm Notes
Document
2 pages
HBO-Midterm Notes
Marielle TANGARO
No ratings yet
Present Simple Practice - Oxford
Document
8 pages
Present Simple Practice - Oxford
Diana G
No ratings yet
Chemically Expanded Graphite-Based Ultra-High Molecular Weight Polyethylene Nanocomposites With Enhanc
Document
11 pages
Chemically Expanded Graphite-Based Ultra-High Molecular Weight Polyethylene Nanocomposites With Enhanc
Shimelis Kebede
No ratings yet
Bahan 3 Sejarah
Document
36 pages
Bahan 3 Sejarah
Si Gam Batat
No ratings yet
Textbook Answer CH6 Animation
Document
3 pages
Textbook Answer CH6 Animation
ijgirj
100% (1)
Annals of Gastroent Surgery - 2023 - Iwatsuki - The Comprehensive Review
Document
8 pages
Annals of Gastroent Surgery - 2023 - Iwatsuki - The Comprehensive Review
SCJUBv Chirurgie I
No ratings yet
BBS Tools Setup Log
Document
66 pages
BBS Tools Setup Log
Francisco Almeida
No ratings yet
If Only
Document
9 pages
If Only
angielskiemi
No ratings yet
CCNA2-Routing Dynamic RIP With Default Route (Stub Network)
Document
8 pages
CCNA2-Routing Dynamic RIP With Default Route (Stub Network)
Yoki Wahyudi
No ratings yet
20170317044105quick Start Instructions
Document
7 pages
20170317044105quick Start Instructions
Jayson Valentin Escobar
No ratings yet