graphics libraries

17
Graphics Libraries Presented By: Prachi Mishra

Upload: prachi-mishra

Post on 15-Jul-2015

53 views

Category:

Design


0 download

TRANSCRIPT

Page 1: Graphics Libraries

Graphics Libraries

Presented By:Prachi Mishra

Page 2: Graphics Libraries

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

Page 3: Graphics Libraries

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

Page 4: Graphics Libraries

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)

Page 5: Graphics Libraries

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

Page 6: Graphics Libraries

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

Page 7: Graphics Libraries

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

Page 8: Graphics Libraries

OpenGL Graphics Pipeline

Page 9: Graphics Libraries

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();}

Page 10: Graphics Libraries

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();

Page 11: Graphics Libraries

Viewing

static void reshape(int w, int h)

{

//a.specify modeling coordinates

glMatrixMode(GL_PROJECTION);

glLoadIdentity ();

glOrtho(left, right, bottom, top, new, far);}

Page 12: Graphics Libraries

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

Page 13: Graphics Libraries

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.

Page 14: Graphics Libraries

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

Page 15: Graphics Libraries

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

Page 16: Graphics Libraries
Page 17: Graphics Libraries

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