SlideShare ist ein Scribd-Unternehmen logo
1 von 9
glOrtho
 The glOrtho function describes a perspective matrix that produces a
parallel projection. The (left, bottom, near) and (right, top, near)
parameters specify the points on the near clipping plane that are mapped
to the lower-left and upper-rightcorners of the window, respectively,
assuming that the eye is located at (0, 0, 0). The far parameter specifies the
location of the far clipping plane. Both the near and the far can be either
positive or negative.
 Because OpenGL uses matrices to set up all its transformations, thecall to
gluOrtho2D() mustbepreceded by two setup functions:
 glMatrixMode(GL_PROJECTION);
 glLoadIdentity(); //toreset the matrix
World Window
 The space in which objects are described is called world coordinates (the
numbers used for x and y are those in the world, wherethe objects are
defined).
 World coordinates use the Cartesian xy-coordinatesystemused in
mathematics, based on whatever units are convenient.
 We define a rectangular worldwindow in these world coordinates.
 The world window specifies which part of the world should be drawn:
whichever part lies inside the window should be drawn, and whichever part
lies outside should be clipped away and not drawn.
 OpenGL does the clipping automatically.
 The function setWindow sets the world window size:
 void setWindow(GLdoubleleft, GLdouble right, GLdouble bottom, GLdouble
top)
 {
 glMatrixMode(GL_PROJECTION);
o glLoadIdentity();
o gluOrtho2D(left, right, bottom, top);
 }
Viewport
 In addition, we define a rectangular viewport in the screen window on the
display.
 A mapping (consisting of scalings [changesize] and translations [move
object]) between the world window and the viewportis established by
OpenGL.
 The objects inside the world window appear automatically at proper sizes
and locations inside the viewport(in screencoordinates, which arepixel
coordinates on the display).
 void setViewport(GLintleft, GLint right, GLint bottom, GLint top)
 {
 glViewport(left, bottom, right - left, top - bottom);
 }
 Calls: setWindow(-5.0,5.0, -0.3, 1.0);
o setViewport(0, 640, 0, 480);
 In myInit();
 We use natural coordinates for whatwe are drawing (the world window).
 OpenGL converts our coordinates to screen coordinates when we set up a
screen window and a viewport. The viewportmay be smaller than the
screen window. The default viewportis the entire screen window.
 The conversion requires scaling and shifting: mapping the world window to
the screen window and the viewport.
 Windows aredescribed by their left, top, right, and bottom values,
 w.l,
 w.t,
 w.r,
 w.b.
 Viewports aredescribed by the samevalues but in screen window
coordinates.
 v.l,
 v.t,
 v.r,
 v.b,
glMatrixMode
Specify which matrix is the current matrix
C Specification
void glMatrixMode( GLenum mode);
Parameters
Mode specifies which matrix stack is the target for subsequent matrix
operations. Three values are accepted:
GL_MODELVIEW,
GL_PROJECTION,and
GL_TEXTURE.
The initial value is GL_MODELVIEW.Additionally, if
the ARB_imaging extension is supported, GL_COLOR is also accepted.
Description
glMatrixMode sets the current matrix mode.
mode can assume one of four values:
GL_MODELVIEW applies subsequent matrix operations to the modelview
matrix stack.
GL_PROJECTION applies subsequent matrix operations to the projection
matrix stack.
GL_TEXTURE applies subsequent matrix operations to the texture matrix
stack.
GL_COLOR applies subsequent matrix operations to the color matrix stack.
glRotate
Multiply the current matrix by a rotation matrix
C Specification
void glRotated( GLdouble angle,
GLdouble x,
GLdouble y,
GLdouble z);
void glRotatef( GLfloat angle,
GLfloat x,
GLfloat y,
GLfloat z);
Parameters
Angle specifies the angle of rotation, in degrees.
x, y, z specify the x, y, and z coordinates of a vector, respectively.
Description
glRotate produces a rotation of angle degrees around the vector x y z .
The current matrix (see glMatrixMode) is multiplied by a rotation matrix
with the product replacing the current matrix, as if glMultMatrix were
called with the following matrix as its argument:
x 2 ⁡ 1 - c + c x ⁢ y ⁡ 1 - c - z ⁢ s x ⁢ z ⁡ 1 - c + y ⁢ s 0 y ⁢ x ⁡ 1 - c
+ z ⁢ s y 2 ⁡ 1 - c + c y ⁢ z ⁡ 1 - c - x ⁢ s 0 x ⁢ z ⁡ 1 - c - y ⁢ s y ⁢ z
⁡ 1 - c + x ⁢ s z 2 ⁡ 1 - c + c 0 0 0 0 1
Where c = cos ⁡ angle , s = sin ⁡ angle , and x y z = 1 (if not, the GL
will normalize this vector).
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION,all objects
drawn after glRotate is called are rotated.
Use glPushMatrix and glPopMatrix to save and restore the unrotated
coordinate system.
Notes
This rotation follows the right-hand rule, so if the vector x y z points
toward the user, the rotation will be counterclockwise.
glTranslate
Multiply the current matrix by a translation matrix
C Specification
void glTranslated(GLdouble x,
GLdouble y,
GLdouble z);
void glTranslatef(GLfloat x,
GLfloat y,
GLfloat z);
Parameters
x, y, z specify the x, y, and z coordinates of a translation vector.
Description
glTranslate produces a translation by x y z . The current matrix is
multiplied by this translation matrix, with the product replacing the
current matrix, as if glMultMatrixc were called with the following
matrix for its argument:
1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION,all
objects drawn after a call to glTranslate are translated.
Use glPushMatrix and glPopMatrix to save and restore the untranslated
coordinate system.
glScale
Multiply the current matrix by a general scaling matrix
C Specification
void glScaled(GLdouble x,
GLdouble y,
GLdouble z);
void glScalef(GLfloat x,
GLfloat y,
GLfloat z);
Parameters
x, y, z specify scale factors along the x, y, and z axes, respectively.
Description
glScale produces a non-uniform scaling along the x, y, and z axes. The
three parameters indicate the desired scale factor along each of the three
axes.
The current matrix is multiplied by this scale matrix, and the product
replaces the current matrix.
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION,all
objects drawn after glScale is called are scaled.
Use glPushMatrix and glPopMatrix to save and restore the unscaled
coordinate system.
Notes
If scale factors other than 1 are applied to the modelview matrix and
lighting is enabled, lighting often appears wrong. In that case, enable
automatic normalization of normals by calling glEnable with the
argument GL_NORMALIZE.
glutSolidSphere,glutWireSphere
glutSolidSphere and glutWireSphere render a solid or wireframe
sphere respectively.
Usage
void glutSolidSphere(GLdouble radius,
GLint slices, GLint stacks);
void glutWireSphere(GLdouble radius,
GLint slices, GLint stacks);
Parameters
Radius the radius of the sphere.
Slices the number of subdivisions around the Z axis (similar to lines of
longitude).
Stacks the number of subdivisions along the Z axis (similar to lines of
latitude).
Description
Renders a sphere centered at the modeling coordinates origin of the
specified radius.The sphere is subdivided around the Z axis into slices
and along the Z axis into stacks.
glutSolidCube, glutWireCube
glutSolidCube and glutWireCube render a solid or wireframe cube
respectively.
Usage
void glutSolidCube(GLdoublesize);
void glutWireCube(GLdoublesize);
Description
glutSolidCube and glutWireCube render a solid or wireframe cube
respectively. The cube is centered at the modeling coordinates origin
with sides of length size.
glutSolidCone, glutWireCone
glutSolidCone and glutWireCone render a solid or wireframe cone
respectively.
Usage
void glutSolidCone(GLdouble base, GLdouble height,
GLint slices, GLint stacks);
void glutWireCone(GLdouble base, GLdouble height,
GLint slices, GLint stacks);
Parameters
Base the radius of the base of the cone.
Height the height of the cone.
Slices the number of subdivisions around the Z axis.
Stacks the number of subdivisions along the Z axis.
Description
glutSolidCone and glutWireCone render a solid or wireframe cone
respectively oriented along the Z axis. The base of the cone is placed at
Z = 0, and the top at Z = height.The cone is subdivided around the Z
axis into slices, and along the Z axis into stacks.
glutSolidTorus, glutWireTorus
glutSolidTorus and glutWireTorus render a solid or wireframe torus
(doughnut) respectively.
Usage
void glutSolidTorus(GLdouble innerRadius,
GLdouble outerRadius,
GLint nsides, GLint rings);
void glutWireTorus(GLdouble innerRadius,
GLdouble outerRadius,
GLint nsides, GLint rings);
InnerRadius inner radius of the torus.
OuterRadius outer radius of the torus.
Nsides number of sides for each radial section.
Rings number of radial divisions for the torus.
Description
glutSolidTorus and glutWireTorus render a solid or wireframe torus
(doughnut) respectively centered at the modeling coordinates origin
whose axis is aligned with the Z axis.
glColor3f function
Sets the current color.
Syntax
void glColor3f(
GLfloat red,
GLfloat green,
GLfloat blue
);
Parameters
Red the new red value for the current color.
Green the new green value for the current color.
Blue the new blue value for the current color.
Returnvalue this function does not return a value.
glutCreateMenu
Creates a new pop-up menu.
Usage
int glutCreateMenu(void (*func)(int value));
Parameters
Func the callback function for the menu that is called when a menu entry
from the menu is selected. The value passed to the callback is
determined by the value for the selected menu entry.
Description
glutCreateMenu creates a new pop-up menu and returns a unique small integer
identifier. The rangeof allocated identifiers starts at one. The menu identifier
range is separate fromthe window identifier range. Implicitly, the currentmenu is
set to the newly created menu. This menu identifier can be used when
calling glutSetMenu.
When the menu callback is called becausea menu entry is selected for the menu,
the currentmenu willbe implicitly set to the menu with the selected entry before
the callback is made.

Weitere ähnliche Inhalte

Was ist angesagt?

Second derivative and graphing
Second derivative and graphingSecond derivative and graphing
Second derivative and graphing
mcftay15
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...
Mani Kanth
 

Was ist angesagt? (18)

Feature Extraction
Feature ExtractionFeature Extraction
Feature Extraction
 
Second derivative and graphing
Second derivative and graphingSecond derivative and graphing
Second derivative and graphing
 
Trytten computergraphics(1)
Trytten computergraphics(1)Trytten computergraphics(1)
Trytten computergraphics(1)
 
Matlab Feature Extraction Using Segmentation And Edge Detection
Matlab Feature Extraction Using Segmentation And Edge DetectionMatlab Feature Extraction Using Segmentation And Edge Detection
Matlab Feature Extraction Using Segmentation And Edge Detection
 
Graphics practical lab manual
Graphics practical lab manualGraphics practical lab manual
Graphics practical lab manual
 
Unit 3
Unit 3Unit 3
Unit 3
 
Computer graphics lab assignment
Computer graphics lab assignmentComputer graphics lab assignment
Computer graphics lab assignment
 
The Ring programming language version 1.8 book - Part 107 of 202
The Ring programming language version 1.8 book - Part 107 of 202The Ring programming language version 1.8 book - Part 107 of 202
The Ring programming language version 1.8 book - Part 107 of 202
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Ce 2009 Gate Paper Prsolutions08
Ce 2009 Gate Paper Prsolutions08Ce 2009 Gate Paper Prsolutions08
Ce 2009 Gate Paper Prsolutions08
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...
 
Computer Graphics Lab
Computer Graphics LabComputer Graphics Lab
Computer Graphics Lab
 
Instancing
InstancingInstancing
Instancing
 
Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019Sceneform SDK на практиці - UA Mobile 2019
Sceneform SDK на практиці - UA Mobile 2019
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
2D Drawing
2D Drawing2D Drawing
2D Drawing
 
3D Curve Project
3D Curve Project3D Curve Project
3D Curve Project
 

Ähnlich wie computer graphics slides by Talha shah

Geometric objects and transformations
Geometric objects and transformationsGeometric objects and transformations
Geometric objects and transformations
saad siddiqui
 

Ähnlich wie computer graphics slides by Talha shah (20)

Getting Started with OpenGL ES
Getting Started with OpenGL ESGetting Started with OpenGL ES
Getting Started with OpenGL ES
 
3 d graphics with opengl part 2
3 d graphics with opengl  part 23 d graphics with opengl  part 2
3 d graphics with opengl part 2
 
CS 354 Object Viewing and Representation
CS 354 Object Viewing and RepresentationCS 354 Object Viewing and Representation
CS 354 Object Viewing and Representation
 
Three dimensional geometric transformations
Three dimensional geometric transformationsThree dimensional geometric transformations
Three dimensional geometric transformations
 
Bai 1
Bai 1Bai 1
Bai 1
 
The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189The Ring programming language version 1.6 book - Part 57 of 189
The Ring programming language version 1.6 book - Part 57 of 189
 
Development with OpenGL and Qt
Development with OpenGL and QtDevelopment with OpenGL and Qt
Development with OpenGL and Qt
 
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
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Geometric objects and transformations
Geometric objects and transformationsGeometric objects and transformations
Geometric objects and transformations
 
2 transformation computer graphics
2 transformation computer graphics2 transformation computer graphics
2 transformation computer graphics
 
Lesson 2 - Drawing Objects
Lesson 2 - Drawing ObjectsLesson 2 - Drawing Objects
Lesson 2 - Drawing Objects
 
transformation in open GL. why use open GL modes
transformation in open GL. why use open GL modestransformation in open GL. why use open GL modes
transformation in open GL. why use open GL modes
 
CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10CG OpenGL Shadows + Light + Texture -course 10
CG OpenGL Shadows + Light + Texture -course 10
 
The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago3D Math Primer: CocoaConf Chicago
3D Math Primer: CocoaConf Chicago
 
Geometry Shader-based Bump Mapping Setup
Geometry Shader-based Bump Mapping SetupGeometry Shader-based Bump Mapping Setup
Geometry Shader-based Bump Mapping Setup
 
Lec4
Lec4Lec4
Lec4
 
The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210The Ring programming language version 1.9 book - Part 65 of 210
The Ring programming language version 1.9 book - Part 65 of 210
 

Kürzlich hochgeladen

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
QucHHunhnh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

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
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

computer graphics slides by Talha shah

  • 1. glOrtho  The glOrtho function describes a perspective matrix that produces a parallel projection. The (left, bottom, near) and (right, top, near) parameters specify the points on the near clipping plane that are mapped to the lower-left and upper-rightcorners of the window, respectively, assuming that the eye is located at (0, 0, 0). The far parameter specifies the location of the far clipping plane. Both the near and the far can be either positive or negative.  Because OpenGL uses matrices to set up all its transformations, thecall to gluOrtho2D() mustbepreceded by two setup functions:  glMatrixMode(GL_PROJECTION);  glLoadIdentity(); //toreset the matrix World Window  The space in which objects are described is called world coordinates (the numbers used for x and y are those in the world, wherethe objects are defined).  World coordinates use the Cartesian xy-coordinatesystemused in mathematics, based on whatever units are convenient.  We define a rectangular worldwindow in these world coordinates.  The world window specifies which part of the world should be drawn: whichever part lies inside the window should be drawn, and whichever part lies outside should be clipped away and not drawn.  OpenGL does the clipping automatically.  The function setWindow sets the world window size:  void setWindow(GLdoubleleft, GLdouble right, GLdouble bottom, GLdouble top)  {  glMatrixMode(GL_PROJECTION); o glLoadIdentity(); o gluOrtho2D(left, right, bottom, top);  }
  • 2. Viewport  In addition, we define a rectangular viewport in the screen window on the display.  A mapping (consisting of scalings [changesize] and translations [move object]) between the world window and the viewportis established by OpenGL.  The objects inside the world window appear automatically at proper sizes and locations inside the viewport(in screencoordinates, which arepixel coordinates on the display).  void setViewport(GLintleft, GLint right, GLint bottom, GLint top)  {  glViewport(left, bottom, right - left, top - bottom);  }  Calls: setWindow(-5.0,5.0, -0.3, 1.0); o setViewport(0, 640, 0, 480);  In myInit();  We use natural coordinates for whatwe are drawing (the world window).  OpenGL converts our coordinates to screen coordinates when we set up a screen window and a viewport. The viewportmay be smaller than the screen window. The default viewportis the entire screen window.  The conversion requires scaling and shifting: mapping the world window to the screen window and the viewport.  Windows aredescribed by their left, top, right, and bottom values,  w.l,  w.t,  w.r,  w.b.  Viewports aredescribed by the samevalues but in screen window coordinates.  v.l,  v.t,  v.r,  v.b,
  • 3. glMatrixMode Specify which matrix is the current matrix C Specification void glMatrixMode( GLenum mode); Parameters Mode specifies which matrix stack is the target for subsequent matrix operations. Three values are accepted: GL_MODELVIEW, GL_PROJECTION,and GL_TEXTURE. The initial value is GL_MODELVIEW.Additionally, if the ARB_imaging extension is supported, GL_COLOR is also accepted. Description glMatrixMode sets the current matrix mode. mode can assume one of four values: GL_MODELVIEW applies subsequent matrix operations to the modelview matrix stack. GL_PROJECTION applies subsequent matrix operations to the projection matrix stack. GL_TEXTURE applies subsequent matrix operations to the texture matrix stack. GL_COLOR applies subsequent matrix operations to the color matrix stack. glRotate Multiply the current matrix by a rotation matrix C Specification void glRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
  • 4. void glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z); Parameters Angle specifies the angle of rotation, in degrees. x, y, z specify the x, y, and z coordinates of a vector, respectively. Description glRotate produces a rotation of angle degrees around the vector x y z . The current matrix (see glMatrixMode) is multiplied by a rotation matrix with the product replacing the current matrix, as if glMultMatrix were called with the following matrix as its argument: x 2 ⁡ 1 - c + c x ⁢ y ⁡ 1 - c - z ⁢ s x ⁢ z ⁡ 1 - c + y ⁢ s 0 y ⁢ x ⁡ 1 - c + z ⁢ s y 2 ⁡ 1 - c + c y ⁢ z ⁡ 1 - c - x ⁢ s 0 x ⁢ z ⁡ 1 - c - y ⁢ s y ⁢ z ⁡ 1 - c + x ⁢ s z 2 ⁡ 1 - c + c 0 0 0 0 1 Where c = cos ⁡ angle , s = sin ⁡ angle , and x y z = 1 (if not, the GL will normalize this vector). If the matrix mode is either GL_MODELVIEW or GL_PROJECTION,all objects drawn after glRotate is called are rotated. Use glPushMatrix and glPopMatrix to save and restore the unrotated coordinate system. Notes This rotation follows the right-hand rule, so if the vector x y z points toward the user, the rotation will be counterclockwise. glTranslate Multiply the current matrix by a translation matrix C Specification void glTranslated(GLdouble x, GLdouble y,
  • 5. GLdouble z); void glTranslatef(GLfloat x, GLfloat y, GLfloat z); Parameters x, y, z specify the x, y, and z coordinates of a translation vector. Description glTranslate produces a translation by x y z . The current matrix is multiplied by this translation matrix, with the product replacing the current matrix, as if glMultMatrixc were called with the following matrix for its argument: 1 0 0 x 0 1 0 y 0 0 1 z 0 0 0 1 If the matrix mode is either GL_MODELVIEW or GL_PROJECTION,all objects drawn after a call to glTranslate are translated. Use glPushMatrix and glPopMatrix to save and restore the untranslated coordinate system. glScale Multiply the current matrix by a general scaling matrix C Specification void glScaled(GLdouble x, GLdouble y, GLdouble z); void glScalef(GLfloat x, GLfloat y, GLfloat z); Parameters x, y, z specify scale factors along the x, y, and z axes, respectively. Description
  • 6. glScale produces a non-uniform scaling along the x, y, and z axes. The three parameters indicate the desired scale factor along each of the three axes. The current matrix is multiplied by this scale matrix, and the product replaces the current matrix. If the matrix mode is either GL_MODELVIEW or GL_PROJECTION,all objects drawn after glScale is called are scaled. Use glPushMatrix and glPopMatrix to save and restore the unscaled coordinate system. Notes If scale factors other than 1 are applied to the modelview matrix and lighting is enabled, lighting often appears wrong. In that case, enable automatic normalization of normals by calling glEnable with the argument GL_NORMALIZE. glutSolidSphere,glutWireSphere glutSolidSphere and glutWireSphere render a solid or wireframe sphere respectively. Usage void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); void glutWireSphere(GLdouble radius, GLint slices, GLint stacks); Parameters Radius the radius of the sphere. Slices the number of subdivisions around the Z axis (similar to lines of longitude). Stacks the number of subdivisions along the Z axis (similar to lines of latitude). Description Renders a sphere centered at the modeling coordinates origin of the specified radius.The sphere is subdivided around the Z axis into slices and along the Z axis into stacks. glutSolidCube, glutWireCube
  • 7. glutSolidCube and glutWireCube render a solid or wireframe cube respectively. Usage void glutSolidCube(GLdoublesize); void glutWireCube(GLdoublesize); Description glutSolidCube and glutWireCube render a solid or wireframe cube respectively. The cube is centered at the modeling coordinates origin with sides of length size. glutSolidCone, glutWireCone glutSolidCone and glutWireCone render a solid or wireframe cone respectively. Usage void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); Parameters Base the radius of the base of the cone. Height the height of the cone. Slices the number of subdivisions around the Z axis. Stacks the number of subdivisions along the Z axis. Description glutSolidCone and glutWireCone render a solid or wireframe cone respectively oriented along the Z axis. The base of the cone is placed at Z = 0, and the top at Z = height.The cone is subdivided around the Z axis into slices, and along the Z axis into stacks. glutSolidTorus, glutWireTorus glutSolidTorus and glutWireTorus render a solid or wireframe torus (doughnut) respectively. Usage void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint nsides, GLint rings); void glutWireTorus(GLdouble innerRadius,
  • 8. GLdouble outerRadius, GLint nsides, GLint rings); InnerRadius inner radius of the torus. OuterRadius outer radius of the torus. Nsides number of sides for each radial section. Rings number of radial divisions for the torus. Description glutSolidTorus and glutWireTorus render a solid or wireframe torus (doughnut) respectively centered at the modeling coordinates origin whose axis is aligned with the Z axis. glColor3f function Sets the current color. Syntax void glColor3f( GLfloat red, GLfloat green, GLfloat blue ); Parameters Red the new red value for the current color. Green the new green value for the current color. Blue the new blue value for the current color. Returnvalue this function does not return a value. glutCreateMenu Creates a new pop-up menu. Usage int glutCreateMenu(void (*func)(int value)); Parameters Func the callback function for the menu that is called when a menu entry from the menu is selected. The value passed to the callback is determined by the value for the selected menu entry. Description
  • 9. glutCreateMenu creates a new pop-up menu and returns a unique small integer identifier. The rangeof allocated identifiers starts at one. The menu identifier range is separate fromthe window identifier range. Implicitly, the currentmenu is set to the newly created menu. This menu identifier can be used when calling glutSetMenu. When the menu callback is called becausea menu entry is selected for the menu, the currentmenu willbe implicitly set to the menu with the selected entry before the callback is made.