1 / 16

OpenGL: The Open Graphics Language

Learn about OpenGL, the de facto API for cross-platform 3D graphics development. Understand transformation matrices, transformation functions, and code examples for implementation. Explore development considerations and auxiliary toolkits for OpenGL applications.

Download Presentation

OpenGL: The Open Graphics Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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

More Related