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)
16 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)
16 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)
16 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
Fullscreen
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
Hassler Whitney - Tensor Products of Abelian Groups
Document
34 pages
Hassler Whitney - Tensor Products of Abelian Groups
Ragib Zaman
No ratings yet
Its Class 8 Optional Maths Model Question Paper 1
Document
2 pages
Its Class 8 Optional Maths Model Question Paper 1
Dhana Aryal
83% (6)
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
Putf
Document
2 pages
Putf
1AY18CS142 - AMOGH S KANADE
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
Cube Camera
Document
3 pages
Cube Camera
Sneha
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
cg_SEA
Document
17 pages
cg_SEA
sridevishettykottakki
No ratings yet
lab7,8,9
Document
12 pages
lab7,8,9
oqbaalazab
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
P3
Document
5 pages
P3
yogeshneelappa.atme
No ratings yet
CGV Lab
Document
3 pages
CGV Lab
Shobha Kumar
No ratings yet
CG LAB
Document
14 pages
CG LAB
lavanyakmlavanya24
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
Computer Graphics and Animation Assignment 1
Document
44 pages
Computer Graphics and Animation Assignment 1
Paul Phineas
No ratings yet
OPENGL Examples.doc
Document
53 pages
OPENGL Examples.doc
Wolve Bull
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
Computer Graphics and Animation Assignment 1
Document
44 pages
Computer Graphics and Animation Assignment 1
Paul Phineas
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
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
RRL Sa Smaw Ofc
Document
1 page
RRL Sa Smaw Ofc
Ren Concepcion
No ratings yet
Solimen Problems
Document
18 pages
Solimen Problems
Cindy Salenga Datu
No ratings yet
Capsule Class 12 MathS (2023-24)
Document
12 pages
Capsule Class 12 MathS (2023-24)
dhruv
No ratings yet
MAT
Document
26 pages
MAT
Sadekur Rahman
No ratings yet
MAT111 Week 10 Lecture Note
Document
14 pages
MAT111 Week 10 Lecture Note
amosjoshua272
No ratings yet
Fortnightly Subjective Test-4: Integrated Classroom Course For Olympiads and Class-IX (2021-2022)
Document
5 pages
Fortnightly Subjective Test-4: Integrated Classroom Course For Olympiads and Class-IX (2021-2022)
Atharva Ahire
No ratings yet
First Stage CBT (Common For ALP/Technician) : Duration: 60 Min, No of Questions: 75
Document
6 pages
First Stage CBT (Common For ALP/Technician) : Duration: 60 Min, No of Questions: 75
shankar
No ratings yet
Printable Shapes Flash Cards
Document
5 pages
Printable Shapes Flash Cards
Home Organising by JR
No ratings yet
Chapter 12 Teacher Skills Practice
Document
48 pages
Chapter 12 Teacher Skills Practice
api-262088658
100% (1)
Orthogonal Coordinate Systems
Document
4 pages
Orthogonal Coordinate Systems
Mahesh Vala
No ratings yet
TEST I. Multiple Choice: Victoriana Peling Tagbe National High School
Document
2 pages
TEST I. Multiple Choice: Victoriana Peling Tagbe National High School
Jessa Banawan Edulan
100% (2)
Advacnced Calculus - Polar Coordinates: Gauri Bhuju
Document
9 pages
Advacnced Calculus - Polar Coordinates: Gauri Bhuju
Deepak Yadav
No ratings yet
FINAL-MOCK-Exam-Math-P2
Document
23 pages
FINAL-MOCK-Exam-Math-P2
maryum.91407
No ratings yet
Math10 Q1 Wk3 Illustrate-Geometric-Sequence
Document
12 pages
Math10 Q1 Wk3 Illustrate-Geometric-Sequence
Jherome Bañares
No ratings yet
Math 9 Learning Competency
Document
6 pages
Math 9 Learning Competency
Cassandra Niña Navia
No ratings yet
Week 15 Centroids
Document
18 pages
Week 15 Centroids
Joshua Diaz
No ratings yet
1.1 Assignment Key
Document
4 pages
1.1 Assignment Key
Samuel Adams
No ratings yet
European Mathematical Cup 2012 Problem 2
Document
3 pages
European Mathematical Cup 2012 Problem 2
Anastasios Amvrosiadis
No ratings yet
June 2017 Paper 1 Solutions PDF
Document
24 pages
June 2017 Paper 1 Solutions PDF
King kr
No ratings yet
10-Parametric Equations and Polar Coordinates
Document
11 pages
10-Parametric Equations and Polar Coordinates
apostolos
No ratings yet
4-3 Symmetry - Line and Rotational Worksheet - Answer
Document
6 pages
4-3 Symmetry - Line and Rotational Worksheet - Answer
Black arab Galadima
0% (1)
8-5 Angle of Elevation Depression
Document
12 pages
8-5 Angle of Elevation Depression
rendycap_20
No ratings yet
Advanced Mathematics 1: C W Celia
Document
6 pages
Advanced Mathematics 1: C W Celia
Arvind Kumar
No ratings yet
mst124 Unit5 E1i1 PDF
Document
105 pages
mst124 Unit5 E1i1 PDF
Sam Adams
100% (1)
Geometry Project
Document
26 pages
Geometry Project
Anchana VM
No ratings yet
Mark Scheme (Results) June 2011: International GCSE Mathematics (4MA0) Paper 3H
Document
22 pages
Mark Scheme (Results) June 2011: International GCSE Mathematics (4MA0) Paper 3H
rawan
No ratings yet
Single Page 2 Laws of Sines and Cosines R1
Document
1 page
Single Page 2 Laws of Sines and Cosines R1
omidrezaee451
No ratings yet
Design For X' (DES 508) : Dr. Arivazhagan. A IIITD&M, Kancheepuram
Document
67 pages
Design For X' (DES 508) : Dr. Arivazhagan. A IIITD&M, Kancheepuram
Keerthi Sagar
No ratings yet