OpenGL & OpenGLES
OpenGL amp OpenGLES
Introduction to OpenGL
OpenGL (Open Graphics Library)[2] is a standard specification defining a cross-language cross-platform API for writing applications that produce 2D and 3D computer graphics
The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes
OpenGL was developed by Silicon Graphics Inc (SGI) in 1992[3] and is widely used in CAD virtual reality scientific visualizationinformation visualization and flight simulation
It is also used in video gameswhere it competes with Direct3D on Microsoft Windows platforms
OpenGL is managed by a non-profit technology consortium the Khronos Group
Introduction to OpenGLES
OpenGL ES (OpenGL for Embedded Systems) is a subset of the OpenGL 3D graphics API designed for embedded devices such as mobile phones PDAs and video game consoles
It is defined and promoted by the Khronos Groupa graphics hardware and software industry consortium interested in open
APIs for graphics and multimedia
The following APIs will provide central understanding in OpenGL amp OpenGLES
1048577 glVertexPointer 1048577 glDrawElements 1048577 glColor 1048577 glClear 1048577 gluLookAt 1048577 glFrustum 1048577 glViewport
OpenGL ES offers two primary methods to facilitate drawing
glVertexPointer to specify a series of points or
vertices
glDrawElements to draw them using one of the
primitive shapes
glVertexPointer( Are we using (xy) or (xyz) in each point
3 each value is a float value in the buffer
GL10GL_FLOAT Between two points there is no space
0 pointer to the start of the buffer
mFVertexBuffer)
glVertexPointer API Definition
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
Introduction to OpenGL
OpenGL (Open Graphics Library)[2] is a standard specification defining a cross-language cross-platform API for writing applications that produce 2D and 3D computer graphics
The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes
OpenGL was developed by Silicon Graphics Inc (SGI) in 1992[3] and is widely used in CAD virtual reality scientific visualizationinformation visualization and flight simulation
It is also used in video gameswhere it competes with Direct3D on Microsoft Windows platforms
OpenGL is managed by a non-profit technology consortium the Khronos Group
Introduction to OpenGLES
OpenGL ES (OpenGL for Embedded Systems) is a subset of the OpenGL 3D graphics API designed for embedded devices such as mobile phones PDAs and video game consoles
It is defined and promoted by the Khronos Groupa graphics hardware and software industry consortium interested in open
APIs for graphics and multimedia
The following APIs will provide central understanding in OpenGL amp OpenGLES
1048577 glVertexPointer 1048577 glDrawElements 1048577 glColor 1048577 glClear 1048577 gluLookAt 1048577 glFrustum 1048577 glViewport
OpenGL ES offers two primary methods to facilitate drawing
glVertexPointer to specify a series of points or
vertices
glDrawElements to draw them using one of the
primitive shapes
glVertexPointer( Are we using (xy) or (xyz) in each point
3 each value is a float value in the buffer
GL10GL_FLOAT Between two points there is no space
0 pointer to the start of the buffer
mFVertexBuffer)
glVertexPointer API Definition
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
Introduction to OpenGLES
OpenGL ES (OpenGL for Embedded Systems) is a subset of the OpenGL 3D graphics API designed for embedded devices such as mobile phones PDAs and video game consoles
It is defined and promoted by the Khronos Groupa graphics hardware and software industry consortium interested in open
APIs for graphics and multimedia
The following APIs will provide central understanding in OpenGL amp OpenGLES
1048577 glVertexPointer 1048577 glDrawElements 1048577 glColor 1048577 glClear 1048577 gluLookAt 1048577 glFrustum 1048577 glViewport
OpenGL ES offers two primary methods to facilitate drawing
glVertexPointer to specify a series of points or
vertices
glDrawElements to draw them using one of the
primitive shapes
glVertexPointer( Are we using (xy) or (xyz) in each point
3 each value is a float value in the buffer
GL10GL_FLOAT Between two points there is no space
0 pointer to the start of the buffer
mFVertexBuffer)
glVertexPointer API Definition
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
The following APIs will provide central understanding in OpenGL amp OpenGLES
1048577 glVertexPointer 1048577 glDrawElements 1048577 glColor 1048577 glClear 1048577 gluLookAt 1048577 glFrustum 1048577 glViewport
OpenGL ES offers two primary methods to facilitate drawing
glVertexPointer to specify a series of points or
vertices
glDrawElements to draw them using one of the
primitive shapes
glVertexPointer( Are we using (xy) or (xyz) in each point
3 each value is a float value in the buffer
GL10GL_FLOAT Between two points there is no space
0 pointer to the start of the buffer
mFVertexBuffer)
glVertexPointer API Definition
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
OpenGL ES offers two primary methods to facilitate drawing
glVertexPointer to specify a series of points or
vertices
glDrawElements to draw them using one of the
primitive shapes
glVertexPointer( Are we using (xy) or (xyz) in each point
3 each value is a float value in the buffer
GL10GL_FLOAT Between two points there is no space
0 pointer to the start of the buffer
mFVertexBuffer)
glVertexPointer API Definition
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glVertexPointer( Are we using (xy) or (xyz) in each point
3 each value is a float value in the buffer
GL10GL_FLOAT Between two points there is no space
0 pointer to the start of the buffer
mFVertexBuffer)
glVertexPointer API Definition
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glVertexPointer takes native buffer rather than array floatsWe need to convert these java-based floats into an accceptable C-like native bufferWe use Javanio classes to convert float array into native buffer
javanioByteBuffer vbb = javanioByteBufferallocateDirect(3 3
4)vbborder(ByteOrdernativeOrder())javanioFloatBuffer mFVertexBuffer =
vbbasFloatBuffer()
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glDrawElements API Definition
glDrawElements( type of shape
GL10GL_TRIANGLE_STRIP Number of indices
3 How big each index is
GL10GL_UNSIGNED_SHORT buffer containing the 3 indices
mIndexBuffer)
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glColor
We use it to set the default color for the subsequent drawing that takes place
Set the current color glColor4f(10f 0 0 05f)
Where 4f refers to 4 arguments all are float
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glClear
This method is used to erase the drawing surface we can reset not only the color but also the depth and the type of stencils used
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT GL_STENCIL_BUFFER_BIT
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
Understanding OpenGL Camera and Coordinates
gluLookAt Controls the direction of the
camera
glFrustum Controls the viewing volume or zoom
glViewport Controls the size of the screen or the size of the camerarsquos ldquofilmrdquo
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
Y-axis
Frustrum
Z-axis
Point it up
height000
Near(3)
Far(7)
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
gluLookAt(gl 005 000 010)
location of the camera
Eye point
direction the camera is pointing
Look-at point
whether the camera is up down or slanted
Up vector
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glFrustrumto specify the area of the scene that you are interested inThe area as bounded by a box also called the frustum or viewing volume
frustrum= far point - near point
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
In OpenGL you can imagine this box in one of two ways
Prespective projection Orthographic projection
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
Specifying a Frustum through glFrustum
calculate aspect ratio first
float ratio = (float) w hindicate that we want a perspective projection
glMatrixMode(GL10GL_PROJECTION)Specify the frustum the viewing volume
glglFrustumf( -ratio Left side of the viewing box
ratio right side of the viewing box
1 top of the viewing box
-1 bottom of the viewing box
3 how far is the front of the box from the camera
7) how far is the back of the box from the camera
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glViewport
It is responsible for specifying the rectangular area on the screen onto which the viewing volume will be projected
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
glViewport(0 lower left x of the rectangle on the screen
0 lower left y of the rectangle on the screen
width width of the rectangle on the screen
height) height of the rectangle on the screen
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
The other classes in the package include
GLUThis utility class contains utilities that wrap the underlying OpenGL ES API in order to aggregate some common functionality
GLUtilsThis utility class contains Android-specific utilities that are built to make interacting with the OpenGL ES easier
MatrixThis is the transformation matrix that is essential for transformations such as scaling moving etc
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
VisibilityIt deals with the visibility aspects of OpenGL
such as what triangle meshes are visible on the screen GLDebugHelperA static utility class that allows you to
wrap the ldquoGLrdquoand ldquoEGLrdquo interfaces so that you can control logging errors additional checks etc
GLSurfaceViewEGLConfigChooserAn EGL tells
OpenGL the type of display characteristics GLSurfaceViewGLWrapperThis interface allows you to
wrap theldquoglrdquo interface so that you can intercept the OpenGL calls across the entire system
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
GLSurfaceViewRendererThis interface allows for derived classes to draw It allows GLSurfaceView to call draw when the surface has changed etc
public static interface GLSurfaceViewRenderervoid onDrawFrame(GL10 gl)void onSuraceChanged(GL10 gl int width int
height)void onSurfaceCreated(GL10 gl EGLConfig config)
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
onDrawFrame()- This is called to draw the current frameThe main drawing happens in this method onSurfaceCreated()-Whenever new surface is created this method is calledwe can also call a no of OpenGL APIrsquos such as dithering or depth controlonSurfaceChanged()-Whenever surface changes
such as width height of the window this method is called
Thank You
Thank You