SlideShare a Scribd company logo
1 of 17
CSE 4208
Introduction to OpenGL
Conducted By:
Sk. Md. Masudul Ahsan
and
Kazi Saeed Alam
Objective of graphics programming
 To create synthetic image such a way that
it is close to reality.
 To create artificial animation that emulates
virtual reality.
 But why? We have already tools like
camera to create image of natural scene
and video camera for creating natural
movies!
2
OpenGL – Open Graphics Library
 What it is ?
 a software interface to graphics hardware
 a graphics programming library
 Dominant industry "standard" for 3D graphics
 Consists of about 150 basic commands
 Platform independent
 What it is not ?
 a windowing system (no window creation)
 a UI system (no keyboard and mouse routines)
 a 3D modeling system (Open Inventor, VRML,
Java3D)
3
OpenGL Related Libraries
 GL – gl.h – Opengl32.lib
 Provides basic commands for graphics drawing
 GLU (OpenGL Utility Library) – glu.h – glu32.lib
 Uses GL commands for performing compound
graphics like
 viewing orientation and projection specification
 polygon tessellations, surface rendering etc.
 GLUT (OpenGL Utility Toolkit) – glut.h – glut.lib
 is a window system-independent toolkit for user
interaction
4
OpenGL Library Organization
GLU
GL
Generic
Graphics API
GLUT
User
Interface
DirectDraw
WGL
Xlib / Xt
GLX
OpenGL
Application
Program
Frame
Buffer
Host OS
Either will
Exist in any
system
5
Object space and world space
Object space
World Space
Instantiate &
Modeling
Transform
6
Eye space
 A model can be viewed from different angles.
 Viewing Transform specify following
information about the viewer:
 eye position
 head up
 Look at direction
 View volume
7
Pipelined architecture
a
c
b
a *

* +
b
c
Arithmetic pipeline for c
b
a *

8
Geometric pipeline
Transformer Clipper Projector Rasterizer
Pixels
vertices
9
OpenGL graphics Pipeline
Graphics
Primitives
Object
Space
transform
matrix
Modeling
Transform
World
Space
Eye, lookat,
headup
Viewing
Transform
Eye
Space
Parallel or
Perspectiv
e
volume
Normalize
& Clip
Clipping
Space
material,
lights, color
Shading &
Texture
viewport
location
Image on
Screen
Viewport
Transform
Device
Space
Image
Space
Projection
projection
matrix
Image in
Internal Buffer
Rasteri-
zation
Screen
Space
Scan
conversio
n
10
Convention of function naming
glColor3f(...)
Gl library Root
Command
Number of
Arguments
Type of
Arguments
11
OpenGL APIs
 Primitive functions
glBegin(type);
glVertex(…);
glVertex(…);
…
glVertex(…);
glEnd();
 Attribute functions
glColor3f(…);
12
OpenGL APIs
 Transformation functions
glRotate(…); glTranslate(…);
 Viewing functions
gluLookAt(…);
 Input functions
glutKeyboardFunc(…);
 Control functions
 Inquiry functions
13
Primitives
 Primitives: Points, Lines & Polygons
 Each object is specified by a set of
Vertices
• Grouped together by glBegin & glEnd
glBegin(type)
glVertex*( )
glVertex*( )
…
glEnd( );
• type can have 10
possible values
To specify attributes of last Vertex drawn:
glColor*()/ glIndex*() current vertex color
glNormal*() current vertex normal (lighting)
glMaterial*() current material property
(lighting)
glTexCoord*() current texture coordinate
glEdgeFlag*() edge status (surface primitives)
14
Primitive Types
GL_POINTS
V0
V1
V2
V3
V5
V4
GL_LINE_LOOP
V0
V1
V2
V3
V5
V4
GL_LINES
V0
V1
V2
V3
V5
V4
GL_LINE_STRIP
V0
V1
V2
V3
V5
V4
GL_POLYGON
V0
V1
V2
V3
V4
Polygon must be:
•Simple
•No-holes inside
•Convex Simple
Non-convex
Complex
Convex
P1
P2
15
Primitive Types
GL_TRIANGLES
V0
V1
V2
V3
V4
V5
V6
V7
V8
GL_QUADS
V0
V1
V2
V3
V4
V5
V6
V7
GL_TRIANGLE_STRIP
V0
V1
V2
V3
V4
V5
Order of Vertex rendering
GL_TRIANGLE_STRIP
012, 213, 234, 435
GL_QUAD_STRIP
V0
V1
V2
V3
V4
V5
V6
V7
GL_QUAD_STRIP
0132, 2354, 4576
GL_TRIANGLE_FAN
V0
V1
V2
V3
V4
V5
GL_TRIANGLE_FAN
012, 023 , 034, 04516
Finally
 Making your programming environment
ready
 Let’s see some projects
 Your first program
 Now try with some more stuffs
17

More Related Content

Similar to Introduction to OpenGL.ppt

Lecture 6 introduction to open gl and glut
Lecture 6   introduction to open gl and glutLecture 6   introduction to open gl and glut
Lecture 6 introduction to open gl and glut
simpleok
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_gl
changehee lee
 
13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL
Jungsoo Nam
 
VisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalVisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_Final
Masatsugu HASHIMOTO
 

Similar to Introduction to OpenGL.ppt (20)

Opengl (1)
Opengl (1)Opengl (1)
Opengl (1)
 
Lecture 6 introduction to open gl and glut
Lecture 6   introduction to open gl and glutLecture 6   introduction to open gl and glut
Lecture 6 introduction to open gl and glut
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With Unity
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
Baiscs of OpenGL
Baiscs of OpenGLBaiscs of OpenGL
Baiscs of OpenGL
 
Bai 1
Bai 1Bai 1
Bai 1
 
CS 354 Introduction
CS 354 IntroductionCS 354 Introduction
CS 354 Introduction
 
Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL Computer Graphics Project Report on Sinking Ship using OpenGL
Computer Graphics Project Report on Sinking Ship using OpenGL
 
Open gl introduction
Open gl introduction Open gl introduction
Open gl introduction
 
OpenGL ES EGL Spec&APIs
OpenGL ES EGL Spec&APIsOpenGL ES EGL Spec&APIs
OpenGL ES EGL Spec&APIs
 
Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_gl
 
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdfJIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
JIT Spraying Never Dies - Bypass CFG By Leveraging WARP Shader JIT Spraying.pdf
 
Graphics Libraries
Graphics LibrariesGraphics Libraries
Graphics Libraries
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGL
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL
 
VisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_FinalVisionizeBeforeVisulaize_IEVC_Final
VisionizeBeforeVisulaize_IEVC_Final
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 

Introduction to OpenGL.ppt

  • 1. CSE 4208 Introduction to OpenGL Conducted By: Sk. Md. Masudul Ahsan and Kazi Saeed Alam
  • 2. Objective of graphics programming  To create synthetic image such a way that it is close to reality.  To create artificial animation that emulates virtual reality.  But why? We have already tools like camera to create image of natural scene and video camera for creating natural movies! 2
  • 3. OpenGL – Open Graphics Library  What it is ?  a software interface to graphics hardware  a graphics programming library  Dominant industry "standard" for 3D graphics  Consists of about 150 basic commands  Platform independent  What it is not ?  a windowing system (no window creation)  a UI system (no keyboard and mouse routines)  a 3D modeling system (Open Inventor, VRML, Java3D) 3
  • 4. OpenGL Related Libraries  GL – gl.h – Opengl32.lib  Provides basic commands for graphics drawing  GLU (OpenGL Utility Library) – glu.h – glu32.lib  Uses GL commands for performing compound graphics like  viewing orientation and projection specification  polygon tessellations, surface rendering etc.  GLUT (OpenGL Utility Toolkit) – glut.h – glut.lib  is a window system-independent toolkit for user interaction 4
  • 5. OpenGL Library Organization GLU GL Generic Graphics API GLUT User Interface DirectDraw WGL Xlib / Xt GLX OpenGL Application Program Frame Buffer Host OS Either will Exist in any system 5
  • 6. Object space and world space Object space World Space Instantiate & Modeling Transform 6
  • 7. Eye space  A model can be viewed from different angles.  Viewing Transform specify following information about the viewer:  eye position  head up  Look at direction  View volume 7
  • 8. Pipelined architecture a c b a *  * + b c Arithmetic pipeline for c b a *  8
  • 9. Geometric pipeline Transformer Clipper Projector Rasterizer Pixels vertices 9
  • 10. OpenGL graphics Pipeline Graphics Primitives Object Space transform matrix Modeling Transform World Space Eye, lookat, headup Viewing Transform Eye Space Parallel or Perspectiv e volume Normalize & Clip Clipping Space material, lights, color Shading & Texture viewport location Image on Screen Viewport Transform Device Space Image Space Projection projection matrix Image in Internal Buffer Rasteri- zation Screen Space Scan conversio n 10
  • 11. Convention of function naming glColor3f(...) Gl library Root Command Number of Arguments Type of Arguments 11
  • 12. OpenGL APIs  Primitive functions glBegin(type); glVertex(…); glVertex(…); … glVertex(…); glEnd();  Attribute functions glColor3f(…); 12
  • 13. OpenGL APIs  Transformation functions glRotate(…); glTranslate(…);  Viewing functions gluLookAt(…);  Input functions glutKeyboardFunc(…);  Control functions  Inquiry functions 13
  • 14. Primitives  Primitives: Points, Lines & Polygons  Each object is specified by a set of Vertices • Grouped together by glBegin & glEnd glBegin(type) glVertex*( ) glVertex*( ) … glEnd( ); • type can have 10 possible values To specify attributes of last Vertex drawn: glColor*()/ glIndex*() current vertex color glNormal*() current vertex normal (lighting) glMaterial*() current material property (lighting) glTexCoord*() current texture coordinate glEdgeFlag*() edge status (surface primitives) 14
  • 16. Primitive Types GL_TRIANGLES V0 V1 V2 V3 V4 V5 V6 V7 V8 GL_QUADS V0 V1 V2 V3 V4 V5 V6 V7 GL_TRIANGLE_STRIP V0 V1 V2 V3 V4 V5 Order of Vertex rendering GL_TRIANGLE_STRIP 012, 213, 234, 435 GL_QUAD_STRIP V0 V1 V2 V3 V4 V5 V6 V7 GL_QUAD_STRIP 0132, 2354, 4576 GL_TRIANGLE_FAN V0 V1 V2 V3 V4 V5 GL_TRIANGLE_FAN 012, 023 , 034, 04516
  • 17. Finally  Making your programming environment ready  Let’s see some projects  Your first program  Now try with some more stuffs 17