Graphics Libraries
-
Upload
prachi-mishra -
Category
Design
-
view
53 -
download
0
Transcript of Graphics Libraries
Graphics Libraries
Presented By:Prachi Mishra
Contents
Overview
Common Graphics Libraries
PHIGS
Features of PHIGS
OpenGL
OpenGL Pipeline
Commands
Direct3D
How’s Direct3D Different?
Conclusion
References
03
04
05
06
07
08
09
14
15
16
17
Overview
• Today 3D graphics tools provide new methods in engineering, medicine, entertainment and technology
• These are selected from exhaustive online research
• Incorrect selection can lead to undesired results
• A graphics library is a software interface to graphics hardware commonly called the APIs
• It provides a set of graphics commands and functions which can specify primitive geometric models and their attributes to digitize and display
Common Graphics Libraries
A graphics programmer is should be able to program in at least one of the following:
• OpenGL
• Direct3D
• PHIGS (Programmer's Hierarchical Interactive Graphics System)
• GKS (Graphics Kernel System)
PHIGS (Programmer's Hierarchical Interactive Graphics System)
• An API standard for rendering 3D computer graphics through 1980s
• Available as a standalone implementation like IBM’s GraPHIGS or Sun’s SunPHIGS
• Became a standard by 1990s ( ANSI and ISO)
• Supports only the most basic 3D graphics, including basic geometry and meshes
• A combination of features of PHIGS and power led to the rise of OpenGL
Features of PHIGS
• Included a scene graph which is a data structure for storing logical sequences
• Had a CSS (Centralized Structure Store) i.e. a database for storing primitives and their attributes
• CSSes were shared under workstations to give views
• Simple working:
Model built into CSSWorkstation created and opened Model connected
OpenGL (Open Graphics Library)
• Most widely adopted graphics API
• Easy to use, well documented
• Cross platform and cross language
• Everything is primitive (can accept only simple shapes and sizes)
• Largely built on C but can be used in most programming languages
OpenGL Graphics Pipeline
void display(void){
int x, y;//a. generate a random pointx = rand() % Width;y = rand() % Height;//b. specify a drawing color: redglColor3f(1, 0, 0);//c. specify to draw a pointglBegin(GL_POINTS);glVertex2i (x,y);glEnd();//d. start drawingglFlush();
}
Basic Commands for Drawing and Shape
void drawtriangle(float *v1, float *v2, float *v3){glBegin(GL_TRIANGLES);glVertex3fv(v1);glVertex3fv(v2);glVertex3fv(v3);glEnd();}
Commands for Transformation
glPushMatrix();glLoadIdentity ();glRotatef (alpha, 0.0, 0.0, 1.0);drawArm (O, A);glTranslatef (A[0], A[1], 0.0);glRotatef (beta, 0.0, 0.0, 1.0);glTranslatef (-A[0], -A[1], 0.0);drawArm (A, B);
glPopMatrix();
Viewing
static void reshape(int w, int h)
{
//a.specify modeling coordinates
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glOrtho(left, right, bottom, top, new, far);}
Color and Lighting
• Different colors for different vertices of the model can be specified
• Light sources can be put to give different colors at different positions in the environment, so the model can have overall brightness, dull reflections, and/or shiny spots
• Lighting can be achieved by calculating the color of a pixel
• The normal of the pixel, the position of the viewer, and the colors and positions of the light sources inherently decide the lighting
Transparency
▪ Used for transparent objects by implementing transmission coefficients for overlapping objects
▪ A final pixel’s R,G or B value depends on the blending of the corresponding R, G, or B values of the pixels in the overlapping objects through the transmission coefficients: Iλ = a1Iλ1 + a2 Iλ2, where λ is R, G, or B; Iλ the blended color component, a1 the transmission coefficient of the pixel in the first object, and Iλ1 the color of the first object.
Direct3D
• Graphics API for Microsoft Windows
• Used to render 3D applications where performance is important like gaming environments
• Implemented on Windows family of operating systems
• Also on embedded versions of Xbox family of video game consoles
How’s Direct3D Different?
▪ Portability – OpenGL is cross platform while Direct3D is Windows centric
▪ User Functionality – Direct3D is 3D hardware interface while OpenGL is 3D rendering system that could be hardware accelerated
▪ Performance – Direct3D is more suitable when performance is considered because of lighter codes
▪ Users/Applications – OpenGL has always seen more number of users. Direct3D is mostly used for computer games
References
▪ http://www.opengl.org
▪ http://mohammadshakergtr.wordpress.com/
▪ http://graphics.wikia.com/wiki/Direct3D_vs._OpenGL
▪ http://slideshare.net/OpenGL_Basics
▪ https://ilias.fhv.at/goto_ilias_fhv_at_file_225344_download.html