ETI 5104 - Lecture 3 - Graphics Software
ETI 5104 - Lecture 3 - Graphics Software
animations.
◼ Importance in Design, Simulation, and Communication:
◼ Design: Graphic software is used to create visual representations of
illustrations.
◼ CorelDRAW – Another vector graphics editor used in design and
marketing.
◼ Applications: Logo design, UI design, and any graphic that needs to
be scaled without losing quality.
◼ Real-Life Analogy: A vector image is like a blueprint for a building. The
blueprint contains precise instructions on how to create the design, and
you can scale it up or down without losing detail.
Types of Computer Graphics Software
3. 3D Graphics Software
◼ Software designed to create 3D models and animations. They allow
manipulation of three-dimensional objects in a virtual environment.
◼ Examples:
◼ Blender – Open-source software for 3D modeling, animation, and
rendering.
◼ Autodesk Maya – Industry-standard software for creating 3D models
2D and 3D designs.
◼ SolidWorks – Primarily used for 3D modeling in product design,
graphics.
◼ DirectX – A Microsoft API for handling multimedia tasks,
performance
◼ Focus on rendering
system dependencies
◼ Alternative to OpenGL: Vulkan
OpenGL Libraries
◼ OpenGL core library
◼ OpenGL32 on Windows
◼ GL on most unix/linux systems (libGL.a)
◼ OpenGL Utility Library (GLU)
◼ Provides functionality in OpenGL core but avoids
having to rewrite code
◼ Links with window system
◼ GLX for X window systems
◼ WGL for Windows
◼ AGL for Macintosh
Basic OpenGL Syntax
◼ Function names are prefixed with gl for core
library, glu for GLU, glut for GLUT library
◼ glBegin, glClear, gluOrtho2D,glutInit
◼ Constants
◼ GL_2D, GL_RGB, GLUT_SINGLE
◼ Data types
◼ GLbyte, GLshort, GLint, GLfloat, GLdouble
GLUT
◼ OpenGL Utility Toolkit (GLUT)
◼ Provides functionality common to all window
systems
◼ Open a window
◼ Get input from mouse and keyboard
◼ Menus
◼ Event-driven
◼ Code is portable but GLUT lacks the functionality
of a good toolkit for a specific platform
◼ No slide bars
OpenGL Architecture
Texture
Memory
Pixel
Operations
OpenGL Functions
◼ Primitives
◼ Points
◼ Line Segments
◼ Polygons
◼ Attributes
◼ Transformations
◼ Viewing
◼ Modeling
◼ Control (GLUT)
◼ Input (GLUT)
◼ Query
OpenGL State
function name
dimensions
glVertex3f(x,y,z)
glVertex3fv(p)
p is a pointer to an array
OpenGL Command Formats
glVertex3fv( v )
nonconvex polygon
nonsimple polygon
Attributes
◼ Attributes are part of the OpenGL state and
determine the appearance of objects
◼ Color (points, lines, polygons)
◼ Size and width (points, lines)
◼ Stipple pattern (lines, polygons)
◼ Polygon mode
◼ Display as filled: solid color or stipple pattern
◼ Display edges
◼ Display vertices
RGB color
◼ Each color component is stored separately in the
frame buffer
◼ Usually 8 bits per component in buffer
◼ Note in glColor3f the color values range from 0.0
(none) to 1.0 (all), whereas in glColor3ub the
values range from 0 to 255
Color and State
◼ The color as set by glColor becomes part of the
state and will be used until changed
◼ Colors and other attributes are not part of the
object but are assigned when the object is
rendered
◼ We can create conceptual vertex colors by code such
as
glColor
glVertex
glColor
glVertex
Viewports
◼ Do not have to use the entire window for
the image: glViewport(x,y,w,h)
◼ Values in pixels (screen coordinates)
Geometric Primitive Types
Header files
• #include <windows.h>
• #include <GL/gl.h>
• #include <GL/glu.h>
• #include <stdlib.h>
• #include <math.h>
DISPLAY WINDOW MANAGEMENT USING
GLUT
◼ glMatrixMode(GL_PROJECTION)
◼ gluOrtho2D(0.0,200.0,0.0,150.0)
IMPLEMENTATION
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0); // red
glVertex3f(-4.0, -2.0, 0.0);
glColor3f(0.0, 1.0, 0.0); // green
glVertex3f(4.0, -2.0, 0.0);
glColor3f(0.0, 0.0, 1.0); // blue
glVertex3f(0.0, 5.0, 0.0);
glEnd();