OpenGL: The Open Graphics Language - PowerPoint PPT Presentation

About This Presentation
Title:

OpenGL: The Open Graphics Language

Description:

Title: 3D Graphics Rendering Author: Ricardo Veguilla Last modified by: Ricardo Veguilla Created Date: 6/29/2005 6:16:25 AM Document presentation format – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 17
Provided by: RicardoV
Learn more at: http://ece.uprm.edu
Category:

less

Transcript and Presenter's Notes

Title: OpenGL: The Open Graphics Language


1
OpenGL The Open Graphics Language
  • Technology and Historical Overview

By Ricardo Veguilla
2
OpenGL The Open Graphics Language
  • De facto Application Programming Interface (API)
    for cross-platform development of 3D graphics
    applications.
  • Implementations available for all major Operating
    Systems and hardware platforms.
  • Support for hardware accelerated 3D rendering.
  • Scalable, high-level, easy to use, well
    documented.

3
History of OpenGL
  • Originally released by SGI in the early 90s.
  • Descendant of IRIX GL.
  • Previous 3D graphics APIs were generally platform
    dependant.
  • Born out of market pressure for a cross-platform
    3D API during the late 80s.

4
OpenGL - Primitive types
5
Transformation Matrices
  • OpenGL provide 3 transformation matrix stacks
  • Perspective Matrix Used for viewing
    transformations equivalent to positioning and
    aiming a camera.
  • Modeling Matrix Used for modeling
    transformations equivalent to positioning and
    orienting the model to be drawn.
  • Texture Matrix Used for texture transformations
    equivalent to positioning and orienting the
    texture to be drawn over a polygon.

6
Transformation Matrix Selection
  • Using glMatrixMode(GLenum mode) function with one
    of the following argument
  • GL_MODELVIEW
  • GL_PROJECTION
  • GL_TEXTURE.
  • All subsequent transformation commands affect the
    specified matrix.

7
Transformation functions
  • glLoadIdentity()
  • glTranslate(TYPE x, TYPE y, TYPE z)
  • glRotate(TYPE angle, TYPE x, TYPE y, TYPE z)
  • glScale(TYPE x, TYPE y, TYPE z)
  • glPushMatrix()
  • glPopMatrix()

8
glLoadIdentity
  • glLoadIdentity()
  • Loads the identity matrix into the current
    transformation matrix.
  • Used to reset the current transformation matrix
    before performing a transformation.

9
Translatoin
  • glTranslate(TYPE x, TYPE y, TYPE z)
  • Multiplies the current transformation matrix by a
    matrix that moves an object (the local coordinate
    system) by the given x, y, and z values.

10
Rotation
  • glRotate(TYPE angle, TYPE x, TYPE y, TYPE z)
  • Multiplies the current transformation matrix by a
    matrix that rotates an object (or the local
    coordinate system) in a counter clockwise
    direction about the ray from the origin through
    the point (x, y, z). The angle parameter
    specifies the angle of rotation in degrees.

11
Scaling
  • glScale(TYPE x, TYPE y, TYPE z)
  • Multiplies the current transformation matrix by a
    matrix that stretches, shrinks, or reflects and
    object (or the local coordinate system) along the
    axes. Each x, y, and z coordinate of every point
    in the object is multiplied by the corresponding
    argument x, y, or z.

12
Controlling the tranformation matrix stacks
  • glPushMatrix()
  • Pushed the current transformation matrix into the
    stack.
  • glPopMatrix()
  • Loads the matrix at the top of the stack into the
    current transformation matrix.

13
OpenGL - Code Example
  • // Set the viewport size
  • glViewport(0, 0, width, height)
  • // Clear the window
  • glClear(GL_COLOR_BUFFER_BIT)
  • // Set the drawing color
  • glColor3f(1.0, 1.0, 1.0)
  • // Start primitive type definition
  • glBegin(GL_POLYGON)
  • // Specify verticies
  • glVertex2f(-0.5, -0.5)
  • glVertex2f(-0.5, 0.5)
  • glVertex2f(0.5, 0.5)
  • glVertex2f(0.5, -0.5)
  • // End primitive type definition
  • glEnd()
  • // Flush the buffer to force drawing of all
    objects thus far
  • glFlush()

14
Development Considerations
  • OpenGL API designed only for drawing images.
  • Auxiliary visual toolkits are required for
    developing OpenGL applications for modern
    windowed desktop environments.
  • Potential cross-platform options
  • GLUT, SDL, GTK

15
Auxiliary Toolkits
  • GLUT Specifically designed for developing OpenGL
    demo applications.
  • SDL (Simple DirectMedia Layer) Library for
    multimedia and game development.
  • GTK General purpose toolkit for creating
    graphical user interfaces with OpenGL extensions
    available.

16
References
  • OpenGL - The Industry Standard for High
    Performance Graphics
  • http//www.opengl.org/
  • Wikipidia OpenGL
  • http//en.wikipedia.org/wiki/OpenGL
Write a Comment
User Comments (0)
About PowerShow.com