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
Parts List: Frame Assembly
Document
202 pages
Parts List: Frame Assembly
louati
100% (2)
Attendence Management Project Report
Document
47 pages
Attendence Management Project Report
Anurag Yadav
No ratings yet
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
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
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
Tutor 1-5
Document
13 pages
Tutor 1-5
hilmi fauzi
No ratings yet
Sodapdf Converted 1
Document
10 pages
Sodapdf Converted 1
seenu.80506
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
FRP in Low Temperature or Cold Climate Conditions
Document
35 pages
FRP in Low Temperature or Cold Climate Conditions
supergas
No ratings yet
Linear Algebraic Equations: - Direct Methods
Document
202 pages
Linear Algebraic Equations: - Direct Methods
eegala
100% (1)
Mca-I-Gf: Self-Regulating Heating Cables For Anti-Freeze Corrosives and Acids
Document
1 page
Mca-I-Gf: Self-Regulating Heating Cables For Anti-Freeze Corrosives and Acids
José Vera
No ratings yet
Decision Making and Negotiation
Document
18 pages
Decision Making and Negotiation
Serly Sanoni
No ratings yet
AWS January 2022 Invoice
Document
3 pages
AWS January 2022 Invoice
Deewan E Yaar
No ratings yet
Mega Goal 1 Worksheet Unit 1
Document
2 pages
Mega Goal 1 Worksheet Unit 1
nesrin goda
50% (2)
Mastering Inventory Management in Food and Beverage
Document
6 pages
Mastering Inventory Management in Food and Beverage
bslnarasimhan
No ratings yet
WBP Topic 3 Notes - 230403 - 202305
Document
70 pages
WBP Topic 3 Notes - 230403 - 202305
Pratiksha Jadhav
No ratings yet
May Keyword-Query Relevance Evaluation Webinar Q&A
Document
8 pages
May Keyword-Query Relevance Evaluation Webinar Q&A
Nguyễn Chín
No ratings yet
Class10 Science Notes Chapter13
Document
5 pages
Class10 Science Notes Chapter13
Anonymous skV4ao4
No ratings yet
Vikas Tiwari LOR 2
Document
1 page
Vikas Tiwari LOR 2
ABHISHEK PATIL
No ratings yet
678 Com
Document
108 pages
678 Com
6976297902
No ratings yet
ASME PTC 6a - 2000 Appendix PTC 6 Steam Turbine
Document
175 pages
ASME PTC 6a - 2000 Appendix PTC 6 Steam Turbine
Kristian
No ratings yet
CEMA 7th Ed. Spanish16
Document
1 page
CEMA 7th Ed. Spanish16
ScribdTranslations
No ratings yet
Predicting Dog Emotions Based on Posture Analysis Using DeepLabCut
Document
16 pages
Predicting Dog Emotions Based on Posture Analysis Using DeepLabCut
pawan.rathod
No ratings yet
Guide For Using Uls Crowdsourced Learning Management System (Https://ulsclms - Online)
Document
2 pages
Guide For Using Uls Crowdsourced Learning Management System (Https://ulsclms - Online)
cykablyat
No ratings yet
IT5409 Ch7 Part1 Object Detection v2 Linhdt 2023
Document
49 pages
IT5409 Ch7 Part1 Object Detection v2 Linhdt 2023
Mai
No ratings yet
Yanmar 4JH4 HTE
Document
2 pages
Yanmar 4JH4 HTE
Cengiz özdolap
No ratings yet
Xilinx Zcu208 Product Brief
Document
2 pages
Xilinx Zcu208 Product Brief
karthikp207
No ratings yet
Curriculum Vitae: Jyoti Dukare
Document
2 pages
Curriculum Vitae: Jyoti Dukare
lalitkumar kalaskar
No ratings yet
Guide To Writing Empirical Papers, Theses, and Dissertations-G. D. Garson
Document
357 pages
Guide To Writing Empirical Papers, Theses, and Dissertations-G. D. Garson
101176
100% (1)
Cast Iron Slide Gate Specification
Document
12 pages
Cast Iron Slide Gate Specification
Sohaib Ahmad Mushtaq
No ratings yet
Isothermal Chem
Document
12 pages
Isothermal Chem
Harsh Dwivedi
No ratings yet
New Beginnings
Document
12 pages
New Beginnings
Daniel Thomas
No ratings yet
Identification of Brain Tumor Using Image Processing Techniques
Document
9 pages
Identification of Brain Tumor Using Image Processing Techniques
Rachna
No ratings yet
Jameica Agbayani: Brgy.20 Cabisuculan Vintar, Ilocos Norte 09453349311
Document
7 pages
Jameica Agbayani: Brgy.20 Cabisuculan Vintar, Ilocos Norte 09453349311
Jhorrielle Miles Carnate
No ratings yet
Achmea Investor Update 2021
Document
70 pages
Achmea Investor Update 2021
JWH
No ratings yet