CGV 18cs67 Lab Manual
CGV 18cs67 Lab Manual
LAB MANUAL
18CSL67
PREPARED BY:
PART A
Design, develop, and implement the following programs in C/C++ using OpenGL API
S.NO LIST OF EXPRIEMENTS
Implement Brenham's line drawing algorithm for all types of
1
slope.
2 Create and rotate a triangle about the origin and a xed point.
1
Dept Of CSE , BRCE
18CSL67
PART B (MINI-PROJECT)
Students should develop a mini project on the topics metioned below or similar
applica-tions using OpenGL API. Consider all types of attributes like color,
thickness, styles, font, background, speed etc., while doing mini project.
During the practical exam, students should demonstrate and answer viva-voce.
Simulation of concepts of OS, Data Structres, Algorithms etc.
COURSE OBJECTIVES:-
COURSE OUTCOMES:-
The students should be able to
2
Dept Of CSE , BRCE
18CSL67
OpenGL Hierarchy
• Several levels of abstraction are provided
• GL
Lowest level: vertex, matrix manipulation
glVertex3f(point.x, point.y, point.z)
• GLU
Helper functions for shapes, transformations
gluPerspective( fovy, aspect, near, far )
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
• GLUT
Highest level: Window and interface management
glutSwapBuffers()
glutInitWindowSize (500, 500);
OpenGL Implementations
• OpenGL IS an API (think of as collection of .h files):
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
• Windows, Linux, UNIX, etc. all provide a platform specific implementation.
• Windows: opengl32.lib glu32.lib glut32.lib
• Linux: -l GL -l GLU –l GLUT
OpenGL: Camera
• Two things to specify:
Physical location of camera in the scene (MODELVIEW matrix in OpenGL).
Projection properties of the camera (PROJECTION matrix in OpenGL):
OpenGL Conventions
Many functions have multiple forms:
glVertex2f, glVertex3i, glVertex4dv, etc.
Number indicates number of arguments
Letters indicate type
f: float, d: double, ub: unsigned byte, etc.
“v‟ (if present) indicates a single pointer argument
glutMainLoop: enters the infinite event-processing loop, i.e, put the OpenGL graphics
system to wait for events (such as re-paint), and trigger respective event handlers (such
as display()).
void glutMainLoop()
glutInitDisplayMode: requests a display with the specified mode, such as color mode
(GLUT_RGB, GLUT_RGBA, GLUT_INDEX), single/double buffering (GLUT_SINGLE,
GLUT_DOUBLE), enable depth (GLUT_DEPTH), joined with a bit OR '|'.
void glutInitDisplayMode(unsigned int displayMode)
void glMatrixMode (GLenum mode);
The glMatrixMode function specifies which matrix is the current matrix.
Void
glOrtho(GLdoubleleft,GLdoubleright,GLdoublebottom,GLdoubletop,GLdoublezNear,G
Ldou blezFar);
The glOrtho function multiplies the current matrix by an orthographic matrix.
void glPointSize (GLfloat size);
The glPointSize function specifies the diameter of rasterized points.
Void glutPostRedisplay(void);
glutPostRedisplay marks the current window as needing to be redisplayed.
void glPushMatrix (void);
void glPopMatrix (void);
The glPushMatrix and glPopMatrix functions push and pop the current matrix stack.
GLintglRenderMode (GLenum mode);
The glRenderMode function sets the rasterization mode.
void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat);
The glRotatef functions multiply the current matrix by a rotation matrix.
void glScalef (GLfloat x, GLfloat y, GLfloat z);
The glScalef functions multiply the current matrix by a general scaling matrix.
void glTranslatef (GLfloat x, GLfloat y, GLfloat z);
The glTranslatef functions multiply the current matrix by a translation matrix.
void glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
The glViewport function sets the viewport.
void glEnable, glDisable();
The glEnable and glDisable functions enable or disable OpenGL capabilities.
glutBitmapCharacter();
The glutBitmapCharacter function used for font style.
5
Dept Of CSE , BRCE
18CSL67
OpenGL Hierarchy:
Several levels of abstraction are provided
GL
Lowest level: vertex, matrix manipulation
glVertex3f(point.x, point.y, point.z)
GLU
Helper functions for shapes, transformations
gluPerspective( fovy, aspect, near, far )
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
GLUT
Highest level: Window and interface management
glutSwapBuffers()
glutInitWindowSize (500, 500);
OpenGL Implementations :
OpenGL IS an API (think of as collection of .h files):
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
Windows, Linux, UNIX, etc. all provide a platform specific implementation.
Windows: opengl32.lib glu32.lib glut32.lib
Linux: -l GL -l GLU –l GLUT
Event Loop:
• OpenGL programs often run in an event loop: 6
Dept Of CSE , BRCE
18CSL67
7
Dept Of CSE , BRCE
18CSL67
Projections in OpenGL
Perspective projection:
8
Dept Of CSE , BRCE
18CSL67
Orthographic projection:
5. Bresenham's Line Algorithm can draw circle and curves with more accurate than DDA
Algorithm.
In this method, next pixel selected is that one who has the least distance from true line.
Assume a pixel P1'(x1',y1'),then select subsequent pixels as we work our may to the night, one
pixel position at a time in the horizontal direction toward P2'(x2',y2').
The line is best approximated by those pixels that fall the least distance from the path between
P1',P2'.
10
Dept Of CSE , BRCE
18CSL67
To chooses the next one between the bottom pixel S and top pixel T.
If S is chosen
We have xi+1=xi+1 and yi+1=yi
If T is chosen
We have xi+1=xi+1 and yi+1=yi+1
11
Dept Of CSE , BRCE
18CSL67
This difference is
s-t = (y-yi)-[(yi+1)-y]
= 2y - 2yi -1
We can write the decision variable di+1 for the next slip on
di+1=2△y.xi+1-2△x.yi+1+c
di+1-di=2△y.(xi+1-xi)- 2△x(yi+1-yi)
Finally, we calculate d1
d1=△x[2m(x1+1)+2b-2y1-1]
d1=△x[2(mx1+b-y1)+2m-1]
Advantage:
1. It involves only integer arithmetic, so it is simple.
12
Dept Of CSE , BRCE
18CSL67
3. It can be implemented using hardware because it does not use multiplication and
division.
Disadvantage:
1. This algorithm is meant for basic line drawing only Initializing is not a part of
Bresenham's line algorithm. So to draw smooth lines, you should want to look into a
different algorithm.
Step5: Consider (x, y) as starting point and xendas maximum possible value of x.
If dx < 0
Then x = x2
y = y2
xend=x1
If dx > 0
Then x = x1
y = y1
xend=x2
Stop.
Step9: Increment x = x + 1
Step11: Go to step 7
Example: Starting and Ending position of the line are (1, 1) and (8, 5). Find
intermediate points.
Solution: x1=1
y1=1
x2=8
y2=5
dx= x2-x1=8-1=7
dy=y2-y1=5-1=4
I1=2* ∆y=2*4=8
I2=2*(∆y-∆x)=2*(4-7)=-6
d = I1-∆x=8-7=1
x y d=d+I1 or I2
1 1 d+I2=1+(-6)=-5
2 2 d+I1=-5+8=3
3 2 d+I2=3+(-6)=-3
4 3 d+I1=-3+8=5
5 3 d+I2=5+(-6)=-1
14
Dept Of CSE , BRCE
18CSL67
6 4 d+I1=-1+8=7
7 4 d+I2=7+(-6)=1
#include<glut.h>
#include<stdio.h>
}
drawpixel(x, y);
while(x<x2)
{
x++;
if(p<0)
p+=twoDy;
else
{
y++;
p+=twoDyMinusDx;
}
drawpixel(x, y);
}
}
void myInit()
{
glClearColor(0.0,0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 500.0, 0.0, 500.0);
glMatrixMode(GL_MODELVIEW);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
brenhamslinedraw(x1, y1, x2, y2);
glFlush();
}
16
Dept Of CSE , BRCE
18CSL67
OUTPUT :
17
Dept Of CSE , BRCE
18CSL67
2. Create and rotate a triangle about the origin and a fixed point.
#include<glut.h>
#include<stdio.h>
int x,y;
int rFlag=0;
void triangle()
{
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);
glVertex2f(100,100);
glVertex2f(250,400);
glVertex2f(400,100);
glEnd();
}
float th=0.0;
float trX=0.0,trY=0.0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
18
Dept Of CSE , BRCE
18CSL67
void myInit()
{
glClearColor(0.0,0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-500.0, 500.0, -500.0, 500.0);
glMatrixMode(GL_MODELVIEW);
}
4
Dept Of CSE , BRCE
18CSL67
5
Dept Of CSE , BRCE
18CSL67
3. Program to draw a color cube and spin it using OpenGL transformation matrices.
#include <stdlib.h>
#include <glut.h>
GLfloat vertices[][3] = {{-1,-1,-1},{1,-1,-1},{1,1,-1},{-1,1,-1},
{-1,-1,1},{1,-1,1}, {1,1,1},{-1,1,1}};
GLfloat colors[][3] = {{1,0,0},{1,1,0},{0,1,0},{0,0,1},
{1,0,1},{1,1,1},{0,1,1},{0.5,0.5,0.5}};
void colorcube(void)
{
polygon(0,3,2,1);
polygon(0,4,7,3);
polygon(5,4,0,1);
polygon(2,3,7,6);
polygon(1,2,6,5);
polygon(4,5,6,7);
}
void display(void)
{
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();
glutSwapBuffers();
}
void spinCube()
{
theta[axis] += 1.0;
if( theta[axis] > 360.0 )
theta[axis] -= 360.0;
glutPostRedisplay();
}
6
Dept Of CSE , BRCE
18CSL67
OUTPUT :
7
Dept Of CSE , BRCE
18CSL67
4. Program to draw a color cube and allow the user to move the camera suitably to
experiment with perspective viewing.
#include <stdlib.h>
#include <glut.h>
void colorcube(void)
{
polygon(0,3,2,1);
polygon(0,4,7,3);
polygon(5,4,0,1);
polygon(2,3,7,6);
polygon(1,2,6,5);
polygon(4,5,6,7);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(viewer[0],viewer[1],viewer[2], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
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();
}
8
Dept Of CSE , BRCE
18CSL67
9
Dept Of CSE , BRCE
18CSL67
OUTPUT :
10
Dept Of CSE , BRCE
18CSL67
#include <stdio.h>
#include <glut.h>
11
Dept Of CSE , BRCE
18CSL67
else
{
y = y0 + (y1 - y0) * (xmin - x0)/(x1 - x0);
x = xmin;
}
if (outcodeOut == outcode0)
{
x0 = x;
y0 = y;
outcode0 = ComputeOutCode (x0, y0);
}
else
{
x1 = x;
y1 = y;
outcode1 = ComputeOutCode (x1, y1);
}
}
}while (!done);
if (accept)
{
double sx=(xvmax-xvmin)/(xmax-xmin);
double sy=(yvmax-yvmin)/(ymax-ymin);
double vx0=xvmin+(x0-xmin)*sx;
double vy0=yvmin+(y0-ymin)*sy;
double vx1=xvmin+(x1-xmin)*sx;
double vy1=yvmin+(y1-ymin)*sy;
glColor3f(1.0,1.0,1.0);
glBegin(GL_LINES);
glVertex2d (vx0, vy0);
glVertex2d (vx1, vy1);
glEnd();
}
}
void display()
{
double x0=60,y0=20,x1=80,y1=120;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,1.0,1.0);
glBegin(GL_LINES);
glVertex2d (x0, y0);
glVertex2d (x1, y1);
glEnd();
glColor3f(1.0, 1.0, 1.0);
12
Dept Of CSE , BRCE
18CSL67
glBegin(GL_LINE_LOOP);
glVertex2f(xmin, ymin);
glVertex2f(xmax, ymin);
glVertex2f(xmax, ymax);
glVertex2f(xmin, ymax);
glEnd();
CohenSutherland(x0,y0,x1,y1);
glFlush();
}
void myinit()
{
glClearColor(0.0,0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,500.0,0.0,500.0);
glMatrixMode(GL_MODELVIEW);
}
void main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("Cohen Suderland Line Clipping Algorithm");
myinit();
glutDisplayFunc(display);
glutMainLoop();
}
OUTPUT :
13
Dept Of CSE , BRCE
18CSL67
6. Program to draw a simple shaded scene consisting of a tea pot on a table. Define
suitably the position and properties of the light source along with the properties of
the properties of the surfaces of the solid object used in the scene.
#include<glut.h>
void light()
{
GLfloat mat_ambient[]={1.0,1.0,1.0,1.0};
GLfloat mat_diffuse[]={0.5,0.5,0.5,1.0};
GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
GLfloat mat_shininess[]={50.0f};
glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);
glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);
GLfloat light_position[]={2.0,6.0,3.0,1.0};
GLfloat lightIntensity[]={0.7,0.7,0.7,1.0};
glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glLightfv(GL_LIGHT0,GL_DIFFUSE,lightIntensity);
}
14
Dept Of CSE , BRCE
18CSL67
void display()
{
GLfloat teapotP=-0.07,tabletopP=-0.15,tablelegP=0.2,wallP=0.5;
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(-2.0,2.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
void myinit()
{
glClearColor(0.0,0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0,1.0,-1.0,1.0,-1.0,10.0);
glMatrixMode(GL_MODELVIEW);
}
15
Dept Of CSE , BRCE
18CSL67
OUTPUT :
16
Dept Of CSE , BRCE
18CSL67
#include <stdlib.h>
#include <stdio.h>
#include <glut.h>
float point v[][3]={{0.0, 0.0, 0.0}, {0.0, 1.0, -1.0},{-1.0, -1.0, -1.0},
{1.0, -1.0, -1.0}};
int n;
17
Dept Of CSE , BRCE
18CSL67
OUTPUT :
18
Dept Of CSE , BRCE
18CSL67
8. Develop a menu driven program to animate a flag using Bezier curve algorithm.
#include<glut.h>
#include<stdio.h>
#include<math.h>
#define PI 3.1416
typedef struct point
{
GLfloat x, y, z;
};
void bino(int n, int *C)
{
int k, j;
for(k=0;k<=n;k++)
{
C[k]=1;
for(j=n;j>=k+1; j--)
C[k]*=j;
for(j=n-k;j>=2;j--)
C[k]/=j;
}
}
void computeBezPt(float u, point *pt1, int cPt, point *pt2, int *C)
{
int k, n=cPt-1;
float bFcn;
pt1 ->x =pt1 ->y = pt1->z=0.0;
for(k=0; k< cPt; k++)
{
bFcn = C[k] * pow(u, k) * pow( 1-u, n-k);
pt1 ->x += pt2[k].x * bFcn;
pt1 ->y += pt2[k].y * bFcn;
pt1 ->z += pt2[k].z * bFcn;
}
}
void bezier(point *pt1, int cPt, int bPt)
{
point bcPt;
float u;
int *C, k;
C= new int[cPt];
bino(cPt-1, C);
glBegin(GL_LINE_STRIP);
for(k=0; k<=bPt; k++)
{
u=float(k)/float(bPt);
computeBezPt(u, &bcPt, cPt, pt1, C);
glVertex2f(bcPt.x, bcPt.y);
}
glEnd();
delete[]C;
}
19
Dept Of CSE , BRCE
18CSL67
float theta = 0;
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
int nCtrlPts = 4, nBCPts =20;
point ctrlPts[4] = {{100, 400, 0}, {150, 450, 0}, {250, 350, 0},
{300, 400, 0}};
ctrlPts[1].x +=50*sin(theta * PI/180.0);
ctrlPts[1].y +=25*sin(theta * PI/180.0);
ctrlPts[2].x -= 50*sin((theta+30) * PI/180.0);
ctrlPts[2].y -= 50*sin((theta+30) * PI/180.0);
ctrlPts[3].x -= 25*sin((theta) * PI/180.0);
ctrlPts[3].y += sin((theta-30) * PI/180.0);
theta+=0.2;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glPointSize(5);
glPushMatrix();
glLineWidth(5);
glColor3f(1, 0.4, 0.2); //Indian flag: Orange color code
for(int i=0;i<50;i++)
{
glTranslatef(0, -0.8, 0);
bezier(ctrlPts, nCtrlPts, nBCPts);
}
glColor3f(1, 1, 1); //Indian flag: white color code
for(int i=0;i<50;i++)
{
glTranslatef(0, -0.8, 0);
bezier(ctrlPts, nCtrlPts, nBCPts);
}
glColor3f(0, 1, 0); //Indian flag: green color code
for(int i=0;i<50;i++)
{
glTranslatef(0, -0.8, 0);
bezier(ctrlPts, nCtrlPts, nBCPts);
}
glPopMatrix();
glColor3f(0.7, 0.5,0.3);
glLineWidth(5);
glBegin(GL_LINES);
glVertex2f(100,400);
glVertex2f(100,40);
glEnd();
glutPostRedisplay();
glutSwapBuffers();
}
void init()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,500,0,500);
}
20
Dept Of CSE , BRCE
18CSL67
OUTPUT :
21
Dept Of CSE , BRCE
18CSL67
9. Develop a menu driven program to fill any given polygon using scan-line area filling
algorithm.
#include <stdlib.h>
#include <stdio.h>
#include <glut.h>
float x1,x2,x3,x4,y1,y2,y3,y4;
int fillFlag=0;
void edgedetect(float x1,float y1,float x2,float y2,int *le,int *re)
{
float mx,x,temp;
int i;
if((y2-y1)<0){
temp=y1;y1=y2;y2=temp;
temp=x1;x1=x2;x2=temp;
}
if((y2-y1)!=0)
mx=(x2-x1)/(y2-y1);
else
mx=x2-x1;
x=x1;
for(i=y1;i<=y2;i++)
{
if(x<(float)le[i])
le[i]=(int)x;
if(x>(float)re[i])
re[i]=(int)x;
x+=mx;
}
}
void draw_pixel(int x,int y)
{
glColor3f(1.0,1.0,0.0);
glBegin(GL_POINTS);
glVertex2i(x,y);
glEnd();
}
void scanfill(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4)
{
int le[500],re[500];
int i,y;
for(i=0;i<500;i++)
{
le[i]=500;
re[i]=0;
}
edgedetect(x1,y1,x2,y2,le,re);
edgedetect(x2,y2,x3,y3,le,re);
edgedetect(x3,y3,x4,y4,le,re);
edgedetect(x4,y4,x1,y1,le,re);
for(y=0;y<500;y++)
{
for(i=(int)le[y];i<(int)re[y];i++)
draw_pixel(i,y);
}
}
22
Dept Of CSE , BRCE
18CSL67
void display()
{
x1=200.0;y1=200.0;x2=100.0;y2=300.0;x3=200.0;y3=400.0;x4=300.0;y4=300.0;
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_LINE_LOOP);
glVertex2f(x1,y1);
glVertex2f(x2,y2);
glVertex2f(x3,y3);
glVertex2f(x4,y4);
glEnd();
if(fillFlag==1)
scanfill(x1,y1,x2,y2,x3,y3,x4,y4);
glFlush();
}
void init()
{
glClearColor(0.0,0.0,0.0,1.0);
glColor3f(1.0,0.0,0.0);
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,499.0,0.0,499.0);
}
void fillMenu(int option)
{
if(option==1)
fillFlag=1;
if(option==2)
fillFlag=2;
display();
}
void main(int argc, char* argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("Filling a Polygon using Scan-line Algorithm");
init();
glutDisplayFunc(display);
glutCreateMenu(fillMenu);
glutAddMenuEntry("Fill Polygon",1);
glutAddMenuEntry("Empty Polygon",2);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
}
23
Dept Of CSE , BRCE
18CSL67
OUTPUT :
24
Dept Of CSE , BRCE
18CSL67
PART B (MINI-PROJECT)
Students should develop a mini project on the topics metioned below or similar applica-tions using OpenGL
API. Consider all types of attributes like color, thickness, styles, font, background, speed etc., while doing
mini project. During the practical exam, students should demonstrate and answer viva-voce. Simulation of
concepts of OS, Data Structres, Algorithms etc.
available on a wide range of platforms. Very important: Don't use AUX. Use GLUT instead.
15. How does the camera work in OpenGL? Answer: As far as OpenGL is concerned, there is
no camera. More
specifcally, the camera is always located at the eye space coordinate (0., 0., 0.). To give the
appearance of moving
the camera, your OpenGL application must move the scene with the inverse of the camera
transformation.
16. How do I implement a zoom operation? Answer: A simple method for zooming is to use a
uniform scale on the
ModelView matrix. However, this often results in clipping by the zNear and zFar clipping
planes if the model is scaled
too large. A better method is to restrict the width and height of the view volume in the
Projection matrix.
17. What are OpenGL coordinate units? Answer: Depending on the contents of your geometry
database, it may
be convenient for your application to treat one OpenGL coordinate unit as being equal to one
millimeter or one parsec
or anything in between (or larger or smaller). OpenGL also lets you specify your geometry
with coordinates of difering
values. For example, you may fnd it convenient to model an airplane's controls in centimeters,
its fuselage in meters,
and a world to fy around in kilometers. OpenGL's ModelView matrix can then scale these
diferent coordinate systems
into the same eye coordinate space. It's the application's responsibility to ensure that the
Projection and ModelView
matrices are constructed to provide an image that keeps the viewer at an appropriate distance,
with an appropriate
feld of view, and keeps the zNear and zFar clipping planes at an appropriate range. An
application that displays
molecules in micron scale, for example, would probably not want to place the viewer at a
distance of 10 feet with a 60
degree feld of view.
18. What is Microsoft Visual Studio? Answer: Microsoft Visual Studio is an integrated
development environment
(IDE) for developing windows applications. It is the most popular IDE for developing
windows applications or windows
based software.
19. What does the .gl or .GL fle format have to do with OpenGL? Answer: .gl fles have
nothing to do with
OpenGL, but are sometimes confused with it. .gl is a fle format for images, which has no
relationship to OpenGL.
20. Who needs to license OpenGL? Who doesn't? Is OpenGL free software? Answer: 28
Dept Of CSE , BRCE
18CSL67
30
Dept Of CSE , BRCE