SlideShare a Scribd company logo
1 of 36
OpenGL
Opengl
OpenGL has been around for over 16 years. Its
development is overseen by the Khronos group.

OpenGL has undergone some radical changes in its most
recent release.
OpenGL Architecture

internal state machine
In programmable it is up to the
programmer to not only pass in
the correct information (for
example the color of the vertex)
but also apply this information
to the vertex in the shader.
What is opengl?
Pipeline
Fixed-Function vs.
 Programmability
Related Libraries

GLUT (OpenGL Utility Toolkit)
SDL
GLUT
OpenGL Utility Toolkit
windowing, menus, or input
SDL

The Simple Direct Media Layer

audio, input, 2D graphics, and many other things
WGL
prevent multiple OpenGL applications from interfering with
each other. This is done through the use of a rendering
context

Only one rendering context per thread.

HGLRC wglCreateContext(HDC hDC);

BOOL wglDeleteContext(HGLRC hRC);

BOOL wglMakeCurrent(HDC hDC, HGLRC hRC);
WGL
HGLRC wglGetCurrentContext();


HDC wglGetCurrentDC();
Pixel Formats
typedef struct tagPIXELFORMATDESCRIPTOR {

WORD nSize;
WORD nVersion;
DWORD dwFlags;
BYTE iPixelType;
BYTE cColorBits;
BYTE cRedBits;
BYTE cRedShift;
BYTE cGreenBits;
BYTE cGreenShift; BYTE cBlueBits;
BYTE cBlueShift;
BYTE cAlphaBits;
BYTE cAlphaShift; BYTE cAccumBits;
BYTE cAccumRedBits; BYTE cAccumGreenBits; BYTE cAccumBlueBits; BYTE
cAccumAlphaBits; BYTE cDepthBits;
BYTE cStencilBits; BYTE cAuxBuffers; BYTE iLayerType;
BYTE bReserved;
DWORD dwLayerMask; DWORD dwVisibleMask; DWORD dwDamageMask;

} PIXELFORMATDESCRIPTOR;
Pixel Formats
  nSize

  dwFlags

  iPixelType
        PFD_TYPE_RGBA. RGBA pixels. Each pixel has four
        components in this order: red, green, blue, and alpha.
        PFD_TYPE_COLORINDEX. Paletted mode. Each pixel uses a
        color-index value.

• cColorBits the bits per pixel
Setting the Pixel Format
int ChoosePixelFormat(HDC hdc, CONST
PIXELFORMATDESCRIPTOR *ppfd); (modify pixel
format to match supported and return id for pixel format)

BOOL SetPixelFormat(HDC hdc, int pixelFormat, const
PIXELFORMATDESCRIPTOR *ppfd);
State Functions
void glGetBooleanv(GLenum pname, GLboolean
*params); void glGetDoublev(GLenum pname, GLdouble
*params); void glGetFloatv(GLenum pname, GLfloat
*params); void glGetIntegerv(GLenum pname, GLint
*params);
Enabling and Disabling States

void glEnable(GLenum cap);

void glDisable(GLenum cap);

GLboolean glIsEnabled(GLenum cap);
Querying String Values
const GLubyte *glGetString(GLenum name);

GL_VENDOR , GL_RENDERER , GL_VERSION ,
GL_EXTENSIONS
Finding Errors
GLenum glGetError();
Colors in OpenGL
void glColor (T components);

void glColorv(T components);
Primitives
Handling Primitives
Immediate Mode

Vertex Arrays
Immediate Mode
void glBegin(GLenum mode);

glBegin()

glEnd()

GL_INVALID_OPERATION

void glVertex{234}{dfis}();

void glVertex{234}{dfis}v();
Demo 1
Vertex Arrays
void glEnableClientState(GLenum cap);

void glDisableClientState(GLenum cap);

gl*Pointer()

void glVertexPointer(GLint size, GLenum type, GLsizei
stride, const GLvoid *array);
        size must be 2, 3, or 4 and
        Type can be set to GL_SHORT, GL_INT, GL_FLOAT, or
        GL_DOUBLE.
        Stride padding in bytes between each vertex
Vertex Arrays
void glColorPointer(GLint size, GLenum type, GLsizei
stride, const GLvoid *array);
void glEdgeFlagPointer(GLsizei stride, const GLboolean
*array);
        Array of Boolean

void glNormalPointer(GLenum type, GLsizei stride, const
GLvoid *array); normals always (x,y,z) so no need for the
size.
void glTexCoordPointer(GLint size, GLenum type, GLsizei
stride, const GLvoid *array); size = number of coordinate
per vertex
Rendering Uesing Vertex
           Arrays
void glDrawArrays(GLenum mode, GLint first, GLsizei
count);



void glDrawElements(GLenum mode, GLsizei count,
GLenum type, const GLvoid *indices); [count is the
number of indices that you want to render ]

void glDrawRangeElements(GLenum mode, GLuint start,
GLuint end, GLsizei count, GLenum type, const GLvoid *
indices);
Demo vertix_with_indcies
Rendering Uesing Vertex
           Arrays
void glMultiDrawArrays(GLenum mode, GLint *first,
GLsizei *count, GLsizei primcount)
Vertex Buffer Objects
(VRAM) instead of (RAM)

To use a VBO, you need to perform the following steps:
     1. Generate a name for the buffer.
     2. Bind (activate) the buffer.
     3. Store data in the buffer.
     4. Use the buffer to render the data. 5. Destroy the buffer.
     5. Destroy the buffer.
Generating a Name
void glGenBuffers(GLsizei n, GLuint *buffers);

void glDeleteBuffers(GLsizei n, const GLuint *buffers);
Binding the Buffer
Binding a buffer makes it current; all buffer-related OpenGL calls
and rendering will operate on the currently bound buffer.

void glBindBuffer(GLenum target, GLuint buffer);

target can be GL_ARRAY_BUFFER,
GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER,
or GL_PIXEL_UNPACK_BUFFER

GL_ARRAY_BUFFER for vertices data and
GL_ELEMENT_ARRAY_BUFFER for indices data.

if buffer is zero, the call will unbind any currently bound buffer.
Filling the Buffer
void glBufferData(GLenum target, GLsizeiptr size, const
GLvoid *data, GLenum usage);
usage is a hint to OpenGL telling it how you intend to use
this buffer. It can be GL_STREAM_DRAW,
GL_STREAM_READ, GL_STREAM_COPY,
GL_STATIC_DRAW, GL_STATIC_READ,
GL_STATIC_COPY, GL_DYNAMIC_DRAW,
GL_DYNAMIC_READ, or GL_DYNAMIC_COPY
Calling glBufferData() on a buffer object that already
contains data will cause the old data to be destroyed and
replaced with the new data
Rendering with Buffers and
      Vertex Arrays
When rendering with VBOs you use gl*Pointer() functions
as an offset.
Demo simple point
Modifying Point Size
void glPointSize(GLfloat size)

If point anti-aliasing is disabled then the point size is
rounded to the nearest integer never zero.

More Related Content

What's hot

Illumination model
Illumination modelIllumination model
Illumination modelAnkur Kumar
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer GraphicsAnkur Soni
 
2D Transformation
2D Transformation2D Transformation
2D TransformationShahDhruv21
 
Graphics inputdevices
Graphics inputdevicesGraphics inputdevices
Graphics inputdevicesBCET
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output PrimitivesPrathimaBaliga
 
Geometric modelling
Geometric modellingGeometric modelling
Geometric modellingAakash S
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphicsKamal Acharya
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithmMani Kanth
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Input of graphical data
Input of graphical dataInput of graphical data
Input of graphical dataRajapriya82
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Computer animation
Computer animationComputer animation
Computer animationshusrusha
 

What's hot (20)

Opengl basics
Opengl basicsOpengl basics
Opengl basics
 
Open gl
Open glOpen gl
Open gl
 
Illumination model
Illumination modelIllumination model
Illumination model
 
ANIMATION SEQUENCE
ANIMATION SEQUENCEANIMATION SEQUENCE
ANIMATION SEQUENCE
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Shading
ShadingShading
Shading
 
Hog
HogHog
Hog
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
2D Transformation
2D Transformation2D Transformation
2D Transformation
 
Graphics inputdevices
Graphics inputdevicesGraphics inputdevices
Graphics inputdevices
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Geometric modelling
Geometric modellingGeometric modelling
Geometric modelling
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Input of graphical data
Input of graphical dataInput of graphical data
Input of graphical data
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Difference between 2d and 3d Animation
Difference between 2d and 3d AnimationDifference between 2d and 3d Animation
Difference between 2d and 3d Animation
 
Computer animation
Computer animationComputer animation
Computer animation
 

Viewers also liked

OpenGL Introduction
OpenGL IntroductionOpenGL Introduction
OpenGL IntroductionYi-Lung Tsai
 
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 glutsimpleok
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL TransformationSandip Jadhav
 
OpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianOpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianMohammad Shaker
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityMark Kilgard
 
Instancing
InstancingInstancing
Instancingacbess
 
Protein structure by Pauling & corey
Protein structure by Pauling & coreyProtein structure by Pauling & corey
Protein structure by Pauling & coreyCIMAP
 
KARNAUGH MAP using OpenGL (KMAP)
KARNAUGH MAP using OpenGL (KMAP)KARNAUGH MAP using OpenGL (KMAP)
KARNAUGH MAP using OpenGL (KMAP)Sagar Uday Kumar
 
CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4fungfung Chen
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyMohammad Shaker
 
LUDO BOARD GAME OPENGL COMPUTER GRAPHICS
LUDO BOARD GAME OPENGL COMPUTER GRAPHICSLUDO BOARD GAME OPENGL COMPUTER GRAPHICS
LUDO BOARD GAME OPENGL COMPUTER GRAPHICSRAJEEV KUMAR SINGH
 
Computer Graphics Project Development Help with OpenGL computer graphics proj...
Computer Graphics Project Development Help with OpenGL computer graphics proj...Computer Graphics Project Development Help with OpenGL computer graphics proj...
Computer Graphics Project Development Help with OpenGL computer graphics proj...Team Codingparks
 

Viewers also liked (20)

OpenGL Introduction
OpenGL IntroductionOpenGL Introduction
OpenGL Introduction
 
OpenGL L01-Primitives
OpenGL L01-PrimitivesOpenGL L01-Primitives
OpenGL L01-Primitives
 
OpenGL Introduction
OpenGL IntroductionOpenGL Introduction
OpenGL Introduction
 
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
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL Transformation
 
OpenGL Starter L01
OpenGL Starter L01OpenGL Starter L01
OpenGL Starter L01
 
OpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and TerrianOpenGL L07-Skybox and Terrian
OpenGL L07-Skybox and Terrian
 
NVIDIA's OpenGL Functionality
NVIDIA's OpenGL FunctionalityNVIDIA's OpenGL Functionality
NVIDIA's OpenGL Functionality
 
Presentatie Lucas Hulsebos DWWA 2008
Presentatie Lucas Hulsebos DWWA 2008Presentatie Lucas Hulsebos DWWA 2008
Presentatie Lucas Hulsebos DWWA 2008
 
Instancing
InstancingInstancing
Instancing
 
XNA L01–Introduction
XNA L01–IntroductionXNA L01–Introduction
XNA L01–Introduction
 
Introdução à OpenGL
Introdução à OpenGLIntrodução à OpenGL
Introdução à OpenGL
 
Protein structure by Pauling & corey
Protein structure by Pauling & coreyProtein structure by Pauling & corey
Protein structure by Pauling & corey
 
KARNAUGH MAP using OpenGL (KMAP)
KARNAUGH MAP using OpenGL (KMAP)KARNAUGH MAP using OpenGL (KMAP)
KARNAUGH MAP using OpenGL (KMAP)
 
CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4CG OpenGL polar curves & input display color-course 4
CG OpenGL polar curves & input display color-course 4
 
Interaction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with PsychologyInteraction Design L06 - Tricks with Psychology
Interaction Design L06 - Tricks with Psychology
 
LUDO BOARD GAME OPENGL COMPUTER GRAPHICS
LUDO BOARD GAME OPENGL COMPUTER GRAPHICSLUDO BOARD GAME OPENGL COMPUTER GRAPHICS
LUDO BOARD GAME OPENGL COMPUTER GRAPHICS
 
Nvidia
Nvidia Nvidia
Nvidia
 
Open gles
Open glesOpen gles
Open gles
 
Computer Graphics Project Development Help with OpenGL computer graphics proj...
Computer Graphics Project Development Help with OpenGL computer graphics proj...Computer Graphics Project Development Help with OpenGL computer graphics proj...
Computer Graphics Project Development Help with OpenGL computer graphics proj...
 

Similar to Opengl presentation

Richard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleRichard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleAxway Appcelerator
 
The Ring programming language version 1.9 book - Part 112 of 210
The Ring programming language version 1.9 book - Part 112 of 210The Ring programming language version 1.9 book - Part 112 of 210
The Ring programming language version 1.9 book - Part 112 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 106 of 202
The Ring programming language version 1.8 book - Part 106 of 202The Ring programming language version 1.8 book - Part 106 of 202
The Ring programming language version 1.8 book - Part 106 of 202Mahmoud Samir Fayed
 
The fallowing program shows the simple transformation #define GLEW.pdf
The fallowing program shows the simple transformation #define GLEW.pdfThe fallowing program shows the simple transformation #define GLEW.pdf
The fallowing program shows the simple transformation #define GLEW.pdfarwholesalelors
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wireRené Domínguez
 
Intro to Computer Graphics.ppt
Intro to Computer Graphics.pptIntro to Computer Graphics.ppt
Intro to Computer Graphics.pptadil104135
 
iOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLiOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLDouglass Turner
 
The Ring programming language version 1.7 book - Part 102 of 196
The Ring programming language version 1.7 book - Part 102 of 196The Ring programming language version 1.7 book - Part 102 of 196
The Ring programming language version 1.7 book - Part 102 of 196Mahmoud Samir Fayed
 
Open GL Programming Training Session I
Open GL Programming Training Session IOpen GL Programming Training Session I
Open GL Programming Training Session INEEVEE Technologies
 
The Ring programming language version 1.10 book - Part 115 of 212
The Ring programming language version 1.10 book - Part 115 of 212The Ring programming language version 1.10 book - Part 115 of 212
The Ring programming language version 1.10 book - Part 115 of 212Mahmoud Samir Fayed
 

Similar to Opengl presentation (20)

BYO3D 2011: Rendering
BYO3D 2011: RenderingBYO3D 2011: Rendering
BYO3D 2011: Rendering
 
Development with OpenGL and Qt
Development with OpenGL and QtDevelopment with OpenGL and Qt
Development with OpenGL and Qt
 
OpenGL L06-Performance
OpenGL L06-PerformanceOpenGL L06-Performance
OpenGL L06-Performance
 
Richard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL ModuleRichard Salter: Using the Titanium OpenGL Module
Richard Salter: Using the Titanium OpenGL Module
 
OpenVG 1.1 Reference Card
OpenVG 1.1 Reference Card OpenVG 1.1 Reference Card
OpenVG 1.1 Reference Card
 
The Ring programming language version 1.9 book - Part 112 of 210
The Ring programming language version 1.9 book - Part 112 of 210The Ring programming language version 1.9 book - Part 112 of 210
The Ring programming language version 1.9 book - Part 112 of 210
 
Open gl polygon code review
Open gl polygon code reviewOpen gl polygon code review
Open gl polygon code review
 
The Ring programming language version 1.8 book - Part 106 of 202
The Ring programming language version 1.8 book - Part 106 of 202The Ring programming language version 1.8 book - Part 106 of 202
The Ring programming language version 1.8 book - Part 106 of 202
 
The fallowing program shows the simple transformation #define GLEW.pdf
The fallowing program shows the simple transformation #define GLEW.pdfThe fallowing program shows the simple transformation #define GLEW.pdf
The fallowing program shows the simple transformation #define GLEW.pdf
 
OpenGL SC 2.0 Quick Reference
OpenGL SC 2.0 Quick ReferenceOpenGL SC 2.0 Quick Reference
OpenGL SC 2.0 Quick Reference
 
Bai 1
Bai 1Bai 1
Bai 1
 
Programa de objetos 3 d wire
Programa de objetos 3 d wirePrograma de objetos 3 d wire
Programa de objetos 3 d wire
 
opengl.ppt
opengl.pptopengl.ppt
opengl.ppt
 
Intro to Computer Graphics.ppt
Intro to Computer Graphics.pptIntro to Computer Graphics.ppt
Intro to Computer Graphics.ppt
 
iOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLiOS Visual F/X Using GLSL
iOS Visual F/X Using GLSL
 
The Ring programming language version 1.7 book - Part 102 of 196
The Ring programming language version 1.7 book - Part 102 of 196The Ring programming language version 1.7 book - Part 102 of 196
The Ring programming language version 1.7 book - Part 102 of 196
 
2D Drawing
2D Drawing2D Drawing
2D Drawing
 
Open gl tips
Open gl tipsOpen gl tips
Open gl tips
 
Open GL Programming Training Session I
Open GL Programming Training Session IOpen GL Programming Training Session I
Open GL Programming Training Session I
 
The Ring programming language version 1.10 book - Part 115 of 212
The Ring programming language version 1.10 book - Part 115 of 212The Ring programming language version 1.10 book - Part 115 of 212
The Ring programming language version 1.10 book - Part 115 of 212
 

Opengl presentation

  • 2. Opengl OpenGL has been around for over 16 years. Its development is overseen by the Khronos group. OpenGL has undergone some radical changes in its most recent release.
  • 3. OpenGL Architecture internal state machine In programmable it is up to the programmer to not only pass in the correct information (for example the color of the vertex) but also apply this information to the vertex in the shader.
  • 7. Related Libraries GLUT (OpenGL Utility Toolkit) SDL
  • 9. SDL The Simple Direct Media Layer audio, input, 2D graphics, and many other things
  • 10. WGL prevent multiple OpenGL applications from interfering with each other. This is done through the use of a rendering context Only one rendering context per thread. HGLRC wglCreateContext(HDC hDC); BOOL wglDeleteContext(HGLRC hRC); BOOL wglMakeCurrent(HDC hDC, HGLRC hRC);
  • 12. Pixel Formats typedef struct tagPIXELFORMATDESCRIPTOR { WORD nSize; WORD nVersion; DWORD dwFlags; BYTE iPixelType; BYTE cColorBits; BYTE cRedBits; BYTE cRedShift; BYTE cGreenBits; BYTE cGreenShift; BYTE cBlueBits; BYTE cBlueShift; BYTE cAlphaBits; BYTE cAlphaShift; BYTE cAccumBits; BYTE cAccumRedBits; BYTE cAccumGreenBits; BYTE cAccumBlueBits; BYTE cAccumAlphaBits; BYTE cDepthBits; BYTE cStencilBits; BYTE cAuxBuffers; BYTE iLayerType; BYTE bReserved; DWORD dwLayerMask; DWORD dwVisibleMask; DWORD dwDamageMask; } PIXELFORMATDESCRIPTOR;
  • 13. Pixel Formats nSize dwFlags iPixelType PFD_TYPE_RGBA. RGBA pixels. Each pixel has four components in this order: red, green, blue, and alpha. PFD_TYPE_COLORINDEX. Paletted mode. Each pixel uses a color-index value. • cColorBits the bits per pixel
  • 14. Setting the Pixel Format int ChoosePixelFormat(HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd); (modify pixel format to match supported and return id for pixel format) BOOL SetPixelFormat(HDC hdc, int pixelFormat, const PIXELFORMATDESCRIPTOR *ppfd);
  • 16. void glGetBooleanv(GLenum pname, GLboolean *params); void glGetDoublev(GLenum pname, GLdouble *params); void glGetFloatv(GLenum pname, GLfloat *params); void glGetIntegerv(GLenum pname, GLint *params);
  • 17. Enabling and Disabling States void glEnable(GLenum cap); void glDisable(GLenum cap); GLboolean glIsEnabled(GLenum cap);
  • 18. Querying String Values const GLubyte *glGetString(GLenum name); GL_VENDOR , GL_RENDERER , GL_VERSION , GL_EXTENSIONS
  • 20. Colors in OpenGL void glColor (T components); void glColorv(T components);
  • 23. Immediate Mode void glBegin(GLenum mode); glBegin() glEnd() GL_INVALID_OPERATION void glVertex{234}{dfis}(); void glVertex{234}{dfis}v();
  • 25. Vertex Arrays void glEnableClientState(GLenum cap); void glDisableClientState(GLenum cap); gl*Pointer() void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *array); size must be 2, 3, or 4 and Type can be set to GL_SHORT, GL_INT, GL_FLOAT, or GL_DOUBLE. Stride padding in bytes between each vertex
  • 26. Vertex Arrays void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *array); void glEdgeFlagPointer(GLsizei stride, const GLboolean *array); Array of Boolean void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *array); normals always (x,y,z) so no need for the size. void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *array); size = number of coordinate per vertex
  • 27. Rendering Uesing Vertex Arrays void glDrawArrays(GLenum mode, GLint first, GLsizei count); void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); [count is the number of indices that you want to render ] void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices);
  • 29. Rendering Uesing Vertex Arrays void glMultiDrawArrays(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
  • 30. Vertex Buffer Objects (VRAM) instead of (RAM) To use a VBO, you need to perform the following steps: 1. Generate a name for the buffer. 2. Bind (activate) the buffer. 3. Store data in the buffer. 4. Use the buffer to render the data. 5. Destroy the buffer. 5. Destroy the buffer.
  • 31. Generating a Name void glGenBuffers(GLsizei n, GLuint *buffers); void glDeleteBuffers(GLsizei n, const GLuint *buffers);
  • 32. Binding the Buffer Binding a buffer makes it current; all buffer-related OpenGL calls and rendering will operate on the currently bound buffer. void glBindBuffer(GLenum target, GLuint buffer); target can be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER GL_ARRAY_BUFFER for vertices data and GL_ELEMENT_ARRAY_BUFFER for indices data. if buffer is zero, the call will unbind any currently bound buffer.
  • 33. Filling the Buffer void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); usage is a hint to OpenGL telling it how you intend to use this buffer. It can be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY Calling glBufferData() on a buffer object that already contains data will cause the old data to be destroyed and replaced with the new data
  • 34. Rendering with Buffers and Vertex Arrays When rendering with VBOs you use gl*Pointer() functions as an offset.
  • 36. Modifying Point Size void glPointSize(GLfloat size) If point anti-aliasing is disabled then the point size is rounded to the nearest integer never zero.