What is OpenGL ?

CaptainKoLiBer 4,272 views 21 slides Mar 08, 2018
Slide 1
Slide 1 of 21
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21

About This Presentation

Some basic informations about OpenGL and GPU


Slide Content

What is OpenGL ? KoLiBer

OpenGL ( Open Graphics Library ) Is a cross-language, cross-platform API for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering the people who make GPUs, are responsible for writing implementations of the OpenGL rendering system. Their implementations, commonly called "drivers “ , translate OpenGL API commands into GPU commands

OpenGL History Development started by SGI ( Silicon Graphics INC.) at 1991 ( developers groups name was ARB ( IBM , Microsoft , Nvidia , … ) First release at 1992 ( OpenGL 1.0 ) Last release by SGI at 2 July 2006 ( OpenGL 2.1 ) Maintainer changed at July 2006 ( from SGI to Khronos Group( SGI , ATI , Nvidia , … ) ) First big release by Khronos at 11 Agust 2008 ( OpenGL 3.0 ) Last release by Khronos at 31 July 2017 ( OpenGL 4.6 )

OpenGL usages Games Animations and Videos virtual reality CAD (Computer Aided Design ) Mobile phones

OpenGL Libraries gl: OpenGL Core library ( rendering , drawing vertices , … ) glu: OpenGL Utility library ( transforming , rotating , mathematical operations over GPU , … ) glut: OpenGL Utility Toolkit library ( multiplatform window system interface ) wgl,cgl,glx: Advance window system interface for OS (windows , *unix , mac , … )

OpenGL Libraries

OpenGL implementations Nvidia OpenGL ( called nvidia driver – for nvidia GPUs ) AMD OpenGL ( called amd driver – for amd GPUs ) Mesa3D ( open source opengl implementation for Intel HD graphics )

Deep into base !

Some questions What is GPU ? Like CPUs , GPUs are processors , but for huge processes like rendering What is Rendering ? Rendering means the process of translating 2D or 3D geometry to raster Image Is GPU only for rendering ? Of course not , GPGPU ( general purpose graphics processing unit ) , is the use of a GPU to perform computation in applications traditionally handled by the CPU

Some questions CPU vs GPU ? As we know CPUs are devided by brands (Intel , AMD , …) , ISAs (CISC , RISC , ZISC , MISC , …) , … , GPUs can be devided by parameters such brands ( Nvidia , Intel , AMD , … ) , Architectures (Kepler , Maxwell , Pascal , Volta , … ) and etc Can we write an application for GPU ? Like CPUs that have compiler ( translating high-level language to assembly ( clang , gcc , cc , … ) ) and assembler ( translate assembly to machine code ( nasm , yasm , … ) ) , GPUs are programmable , too and have c ompiler ( nvcc , hcc , … ) and assembler ( gcnasm , asfermi , … ) What is OpenGL for ? For writing applications with interacting to GPU for rendering , we need deep knowledge about our GPU Architecture and hardware to create a simple application , renders a model , so OpenGL is a higher level API for simple interacting with GPU

Deep into OpenGL !

OpenGL rendering pipeline At the first level OpenGL gets vertex array of our model and our texture coordinates or ( color and coordinates ) At the second level OpenGL will translate , rotate , scale our vertices based on the transformation and perspective matrices ( position calculator ) At the third level OpenGL assembles our vertices into triangles based on primitive type At the fourth level OpenGL rasterizes our triangles into pixel format based on view port matrices and At the fifth level OpenGL will colorize and texturize our pixels ( called fragment shader or pixel shader ) ( color chooser ) At the sixth level OpenGL will test our pixels and do some blending operations and at the end will write pixels into framebuffer for showing in display

OpenGL rendering pipeline Vertex shader ( position calculator ) Fragment shader ( color chooser ) Another simple view of OpenGL pipeline

OpenGL rendering pipeline Primitive types for triangle assembling at level two

Rasterization ?

Rasterization ?

Testing ? Some time’s OpenGL may fail to rendering correctly like this picture The Depth Test is a per-sample processing operation performed after the Fragment Shader for detecting incorrect frames and discarding them .

An important question ! How can you render this simple wall ? How many triangles you need to render it ? 100 ? 1000 ? Millions ? Oh is wrong to use Millions of triangles for rendering a simple wall ! So how can you ? Of course ! Textures  You can use a simple rectangle and map this image on it ( called texture mapping )

An important question ! OpenGL texture mapping

Any question ?

Resources https://www.khronos.org / https://www.wikipedia.org / https://www.mesa3d.org / https:// code.tutsplus.com/