SlideShare a Scribd company logo
1 of 4
Download to read offline
how can i build this as problem 2 of my code?
#include
#include
#include
#include
#include "./freeglut-3.4.0/include/GL/freeglut.h"
using namespace std;
bool leftDown = false, rightDown = false;
int lastPos[2];
float cameraPos[4] = { 0,1,4,1 };
int windowWidth = 640, windowHeight = 480;
double xRot = 0;
double yRot = 0;
int curProblem = 1; // TODO: change this number to try different examples
float specular[] = { 1.0, 1.0, 1.0, 1.0 };
float shininess[] = { 50.0 };
void problem1() {
// TODO
}
void problem2() {
//FIX HERE
}
void problem3() {
//TO DO
}
void problem4() {
//TO DO
}
void display()
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
glBegin(GL_LINES);
glColor3f(1, 0, 0); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); // x axis
glColor3f(0, 1, 0); glVertex3f(0, 0, 0); glVertex3f(0, 1, 0); // y axis
glColor3f(0, 0, 1); glVertex3f(0, 0, 0); glVertex3f(0, 0, 1); // z axis
glEnd(/*GL_LINES*/);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
glMaterialfv(GL_FRONT, GL_SHININESS, shininess);
glEnable(GL_LIGHT0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, windowWidth, windowHeight);
float ratio = (float)windowWidth / (float)windowHeight;
gluPerspective(50, ratio, 1, 1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(cameraPos[0], cameraPos[1], cameraPos[2], 0, 0, 0, 0, 1, 0);
glLightfv(GL_LIGHT0, GL_POSITION, cameraPos);
glRotatef(xRot, 1, 0, 0);
glRotatef(yRot, 0, 1, 0);
if (curProblem == 1) problem1();
if (curProblem == 2) problem2();
if (curProblem == 3) problem3();
if (curProblem == 4) problem4();
glutSwapBuffers();
}
void mouse(int button, int state, int x, int y)
{
if (button == GLUT_LEFT_BUTTON) leftDown = (state == GLUT_DOWN);
else if (button == GLUT_RIGHT_BUTTON) rightDown = (state == GLUT_DOWN);
lastPos[0] = x;
lastPos[1] = y;
}
void mouseMoved(int x, int y)
{
if (leftDown) {
xRot += (y - lastPos[1]) * .1;
yRot += (x - lastPos[0]) * .1;
}
if (rightDown) {
for (int i = 0; i < 3; i++)
cameraPos[i] *= pow(1.1, (y - lastPos[1]) * .1);
}
lastPos[0] = x;
lastPos[1] = y;
glutPostRedisplay();
}
void keyboard(unsigned char key, int x, int y)
{
curProblem = key - '0';
if (key == 'q' || key == 'Q' || key == 27) {
exit(0);
}
glutPostRedisplay();
}
void reshape(int width, int height)
{
windowWidth = width;
windowHeight = height;
glutPostRedisplay();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(windowWidth, windowHeight);
glutCreateWindow("HW2");
glutDisplayFunc(display);
glutMotionFunc(mouseMoved);
glutMouseFunc(mouse);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}

More Related Content

Similar to how can i build this as problem 2 of my code #include iostream.pdf

Intro to Computer Graphics.ppt
Intro to Computer Graphics.pptIntro to Computer Graphics.ppt
Intro to Computer Graphics.pptadil104135
 
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docxajoy21
 
The Ring programming language version 1.8 book - Part 66 of 202
The Ring programming language version 1.8 book - Part 66 of 202The Ring programming language version 1.8 book - Part 66 of 202
The Ring programming language version 1.8 book - Part 66 of 202Mahmoud Samir Fayed
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wireRené Domínguez
 
Robot Motion Source code
Robot Motion Source codeRobot Motion Source code
Robot Motion Source codeBrian Goggins
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdffathimalinks
 
Introduction to Computer Graphics using OpenGLCan someone tell me .pdf
Introduction to Computer Graphics using OpenGLCan someone tell me .pdfIntroduction to Computer Graphics using OpenGLCan someone tell me .pdf
Introduction to Computer Graphics using OpenGLCan someone tell me .pdffathimafancyjeweller
 
The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185Mahmoud Samir Fayed
 
FLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - ExercisesFLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - ExercisesMichel Alves
 
LISA QooxdooTutorial Slides
LISA QooxdooTutorial SlidesLISA QooxdooTutorial Slides
LISA QooxdooTutorial SlidesTobias Oetiker
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision DetectionJenchoke Tachagomain
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2MEJenchoke Tachagomain
 
square.cpp Open
 square.cpp Open square.cpp Open
square.cpp OpenMikeEly930
 
The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202Mahmoud Samir Fayed
 
Hello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfHello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfFashionColZone
 
The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181Mahmoud Samir Fayed
 

Similar to how can i build this as problem 2 of my code #include iostream.pdf (20)

opengl.ppt
opengl.pptopengl.ppt
opengl.ppt
 
Intro to Computer Graphics.ppt
Intro to Computer Graphics.pptIntro to Computer Graphics.ppt
Intro to Computer Graphics.ppt
 
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
#includefloat angle, move, scene, roadmove,turn, on=1; int i, st.docx
 
The Ring programming language version 1.8 book - Part 66 of 202
The Ring programming language version 1.8 book - Part 66 of 202The Ring programming language version 1.8 book - Part 66 of 202
The Ring programming language version 1.8 book - Part 66 of 202
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
 
Robot Motion Source code
Robot Motion Source codeRobot Motion Source code
Robot Motion Source code
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
 
Drawing Figures
Drawing FiguresDrawing Figures
Drawing Figures
 
Introduction to Computer Graphics using OpenGLCan someone tell me .pdf
Introduction to Computer Graphics using OpenGLCan someone tell me .pdfIntroduction to Computer Graphics using OpenGLCan someone tell me .pdf
Introduction to Computer Graphics using OpenGLCan someone tell me .pdf
 
135
135135
135
 
The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185The Ring programming language version 1.5.4 book - Part 55 of 185
The Ring programming language version 1.5.4 book - Part 55 of 185
 
FLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - ExercisesFLTK Summer Course - Part VIII - Eighth Impact - Exercises
FLTK Summer Course - Part VIII - Eighth Impact - Exercises
 
LISA QooxdooTutorial Slides
LISA QooxdooTutorial SlidesLISA QooxdooTutorial Slides
LISA QooxdooTutorial Slides
 
Mobile Game and Application with J2ME - Collision Detection
Mobile Gameand Application withJ2ME  - Collision DetectionMobile Gameand Application withJ2ME  - Collision Detection
Mobile Game and Application with J2ME - Collision Detection
 
Mobile Game and Application with J2ME
Mobile Gameand Application with J2MEMobile Gameand Application with J2ME
Mobile Game and Application with J2ME
 
square.cpp Open
 square.cpp Open square.cpp Open
square.cpp Open
 
Lập trình C
Lập trình CLập trình C
Lập trình C
 
The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202The Ring programming language version 1.8 book - Part 64 of 202
The Ring programming language version 1.8 book - Part 64 of 202
 
Hello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfHello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdf
 
The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181The Ring programming language version 1.5.2 book - Part 54 of 181
The Ring programming language version 1.5.2 book - Part 54 of 181
 

More from mail931892

I need help writing test Codepackage org.example;import j.pdf
I need help writing test Codepackage org.example;import j.pdfI need help writing test Codepackage org.example;import j.pdf
I need help writing test Codepackage org.example;import j.pdfmail931892
 
I need help on this 5 and 6. here is the code so far import jav.pdf
I need help on this 5 and 6. here is the code so far import jav.pdfI need help on this 5 and 6. here is the code so far import jav.pdf
I need help on this 5 and 6. here is the code so far import jav.pdfmail931892
 
I need a substantive comment on this postThe formal structure of .pdf
I need a substantive comment on this postThe formal structure of .pdfI need a substantive comment on this postThe formal structure of .pdf
I need a substantive comment on this postThe formal structure of .pdfmail931892
 
I need help debugging some code. I am trying to read a text file and.pdf
I need help debugging some code. I am trying to read a text file and.pdfI need help debugging some code. I am trying to read a text file and.pdf
I need help debugging some code. I am trying to read a text file and.pdfmail931892
 
I have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdfI have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdfmail931892
 
I am trying to create a dynamic web project in Eclipse IDE that impl.pdf
I am trying to create a dynamic web project in Eclipse IDE that impl.pdfI am trying to create a dynamic web project in Eclipse IDE that impl.pdf
I am trying to create a dynamic web project in Eclipse IDE that impl.pdfmail931892
 
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdfHow do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdfmail931892
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfmail931892
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfmail931892
 
Hi All!I have a question regrading creating a subgraph or rather v.pdf
Hi All!I have a question regrading creating a subgraph or rather v.pdfHi All!I have a question regrading creating a subgraph or rather v.pdf
Hi All!I have a question regrading creating a subgraph or rather v.pdfmail931892
 
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdfHeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdfmail931892
 
Help I keep getting the same error when running a code. Below is the.pdf
Help I keep getting the same error when running a code. Below is the.pdfHelp I keep getting the same error when running a code. Below is the.pdf
Help I keep getting the same error when running a code. Below is the.pdfmail931892
 
For this part you will need to analyze the provided logfile part2.lo.pdf
For this part you will need to analyze the provided logfile part2.lo.pdfFor this part you will need to analyze the provided logfile part2.lo.pdf
For this part you will need to analyze the provided logfile part2.lo.pdfmail931892
 
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdfGinny (45) is unmarried. Who of the following may be Ginnys quali.pdf
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdfmail931892
 

More from mail931892 (14)

I need help writing test Codepackage org.example;import j.pdf
I need help writing test Codepackage org.example;import j.pdfI need help writing test Codepackage org.example;import j.pdf
I need help writing test Codepackage org.example;import j.pdf
 
I need help on this 5 and 6. here is the code so far import jav.pdf
I need help on this 5 and 6. here is the code so far import jav.pdfI need help on this 5 and 6. here is the code so far import jav.pdf
I need help on this 5 and 6. here is the code so far import jav.pdf
 
I need a substantive comment on this postThe formal structure of .pdf
I need a substantive comment on this postThe formal structure of .pdfI need a substantive comment on this postThe formal structure of .pdf
I need a substantive comment on this postThe formal structure of .pdf
 
I need help debugging some code. I am trying to read a text file and.pdf
I need help debugging some code. I am trying to read a text file and.pdfI need help debugging some code. I am trying to read a text file and.pdf
I need help debugging some code. I am trying to read a text file and.pdf
 
I have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdfI have these files in picture I wrote most the codes but I stuck wit.pdf
I have these files in picture I wrote most the codes but I stuck wit.pdf
 
I am trying to create a dynamic web project in Eclipse IDE that impl.pdf
I am trying to create a dynamic web project in Eclipse IDE that impl.pdfI am trying to create a dynamic web project in Eclipse IDE that impl.pdf
I am trying to create a dynamic web project in Eclipse IDE that impl.pdf
 
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdfHow do I fix it in LinkedList.javaLinkedList.java Define.pdf
How do I fix it in LinkedList.javaLinkedList.java Define.pdf
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
 
Hi All!I have a question regrading creating a subgraph or rather v.pdf
Hi All!I have a question regrading creating a subgraph or rather v.pdfHi All!I have a question regrading creating a subgraph or rather v.pdf
Hi All!I have a question regrading creating a subgraph or rather v.pdf
 
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdfHeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
HeadWallRam Inc. has expanded its reach globally and needs to re-lay.pdf
 
Help I keep getting the same error when running a code. Below is the.pdf
Help I keep getting the same error when running a code. Below is the.pdfHelp I keep getting the same error when running a code. Below is the.pdf
Help I keep getting the same error when running a code. Below is the.pdf
 
For this part you will need to analyze the provided logfile part2.lo.pdf
For this part you will need to analyze the provided logfile part2.lo.pdfFor this part you will need to analyze the provided logfile part2.lo.pdf
For this part you will need to analyze the provided logfile part2.lo.pdf
 
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdfGinny (45) is unmarried. Who of the following may be Ginnys quali.pdf
Ginny (45) is unmarried. Who of the following may be Ginnys quali.pdf
 

Recently uploaded

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 

Recently uploaded (20)

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 

how can i build this as problem 2 of my code #include iostream.pdf

  • 1. how can i build this as problem 2 of my code? #include #include #include #include #include "./freeglut-3.4.0/include/GL/freeglut.h" using namespace std; bool leftDown = false, rightDown = false; int lastPos[2]; float cameraPos[4] = { 0,1,4,1 }; int windowWidth = 640, windowHeight = 480; double xRot = 0; double yRot = 0; int curProblem = 1; // TODO: change this number to try different examples float specular[] = { 1.0, 1.0, 1.0, 1.0 }; float shininess[] = { 50.0 }; void problem1() { // TODO } void problem2() { //FIX HERE } void problem3() { //TO DO } void problem4() { //TO DO } void display() { glClearColor(0, 0, 0, 0);
  • 2. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDisable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glBegin(GL_LINES); glColor3f(1, 0, 0); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); // x axis glColor3f(0, 1, 0); glVertex3f(0, 0, 0); glVertex3f(0, 1, 0); // y axis glColor3f(0, 0, 1); glVertex3f(0, 0, 0); glVertex3f(0, 0, 1); // z axis glEnd(/*GL_LINES*/); glEnable(GL_LIGHTING); glShadeModel(GL_SMOOTH); glMaterialfv(GL_FRONT, GL_SPECULAR, specular); glMaterialfv(GL_FRONT, GL_SHININESS, shininess); glEnable(GL_LIGHT0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0, 0, windowWidth, windowHeight); float ratio = (float)windowWidth / (float)windowHeight; gluPerspective(50, ratio, 1, 1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(cameraPos[0], cameraPos[1], cameraPos[2], 0, 0, 0, 0, 1, 0); glLightfv(GL_LIGHT0, GL_POSITION, cameraPos); glRotatef(xRot, 1, 0, 0); glRotatef(yRot, 0, 1, 0); if (curProblem == 1) problem1(); if (curProblem == 2) problem2(); if (curProblem == 3) problem3(); if (curProblem == 4) problem4(); glutSwapBuffers(); } void mouse(int button, int state, int x, int y) { if (button == GLUT_LEFT_BUTTON) leftDown = (state == GLUT_DOWN); else if (button == GLUT_RIGHT_BUTTON) rightDown = (state == GLUT_DOWN); lastPos[0] = x; lastPos[1] = y;
  • 3. } void mouseMoved(int x, int y) { if (leftDown) { xRot += (y - lastPos[1]) * .1; yRot += (x - lastPos[0]) * .1; } if (rightDown) { for (int i = 0; i < 3; i++) cameraPos[i] *= pow(1.1, (y - lastPos[1]) * .1); } lastPos[0] = x; lastPos[1] = y; glutPostRedisplay(); } void keyboard(unsigned char key, int x, int y) { curProblem = key - '0'; if (key == 'q' || key == 'Q' || key == 27) { exit(0); } glutPostRedisplay(); } void reshape(int width, int height) { windowWidth = width; windowHeight = height; glutPostRedisplay(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(windowWidth, windowHeight); glutCreateWindow("HW2");