Top Banner
© Copyright Khronos Group, 2004 - Page 1 OpenGL ES 101 OpenGL ES 101 Dave Astle, GameDev.net, Qualcomm [email protected], [email protected]
28

OpenGL ES 101

Jan 07, 2016

Download

Documents

glynn

OpenGL ES 101. Dave Astle, GameDev.net, Qualcomm [email protected], [email protected]. Outline. Background OpenGL ES 1.0 vs. OpenGL OpenGL ES 1.0 Extensions What’s new in OpenGL 1.1 Learning more. Why OpenGL ES?. Need for a standard 3D graphics API for a wide range of devices - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 1

OpenGL ES 101OpenGL ES 101

Dave Astle, GameDev.net, [email protected], [email protected]

Page 2: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 2

OutlineOutline• Background• OpenGL ES 1.0 vs. OpenGL• OpenGL ES 1.0 Extensions• What’s new in OpenGL 1.1• Learning more

Page 3: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 3

Why OpenGL ES?Why OpenGL ES?• Need for a standard 3D graphics API for a wide range of devices

- Low processing power- Limited memory- Battery powered (usually)- Low resolution

• OpenGL is a natural fit- However, needed modifications to be suitable for low-power, relatively limited devices

• Based on OpenGL 1.3- Removed redundant APIs- Removed features that were too expensive or unused- Removed some data types- Added smaller data types for some APIs- Added support for fixed point

• Common vs. Common-lite profiles- Common-lite doesn’t support floating point

Page 4: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 4

OutlineOutline• Background• OpenGL ES 1.0 vs. OpenGL• OpenGL ES 1.0 Extensions• What’s new in OpenGL 1.1• Learning more

Page 5: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 5

Vertex SpecificationVertex SpecificationIn• glColor4f

• glNormal3f

• glMultiTexCoord4f

Out• Immediate Mode

- glBegin/glEnd, glVertex, glTexCoord

• Color index mode

Page 6: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 6

Vertex ArraysVertex ArraysIn• glVertexPointer• glNormalPointer• glTexCoordPointer• glColorPointer• glDrawArrays• glDrawElements• glClientActiveTexture• glEnableClientState• glDisableClientState

Out• glEdgeFlagPointer• glIndexPointer• glArrayElement• glInterleavedArrays• glDrawRangeElements• Quads, quad strips, and polygons

Page 7: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 7

TransformationTransformationIn• glDepthRange• glViewport• glMatrixMode (except color)• glLoadMatrixf• glRotatef• glScalef• glTranslatef• glFrustum• glOrtho• glActiveTexture• glPush/PopMatrix• GL_RESCALE_NORMAL,

GL_NORMALIZE

Out• glLoadTransposeMatrix• glMultTransposeMatrix• glTexGen• glGetTexGen

Page 8: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 8

Materials and LightingMaterials and LightingIn• glFrontFace• GL_LIGHTING, GL_LIGHT{0-7}• glMaterialf[v]

- GL_FRONT_AND_BACK only

• glLightf[v]• glLightModelf[v]

- GL_LIGHT_MODEL_TWO_SIDE- GL_AMBIENT

• GL_COLOR_MATERIAL• glShadeModel

Out• glGetMaterial• glGetLight• glLightModel

- GL_LIGHT_MODEL_COLOR_CONTROL- GL_LIGHT_MODEL_LOCAL_VIEWER

• glColorMaterial

Page 9: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 9

Points, Lines, and PolygonsPoints, Lines, and PolygonsIn• glPointSize• GL_POINT_SMOOTH• glLineWidth• GL_LINE_SMOOTH• Culling• glPolygonOffset

Out• Line and polygon stippling• Polygon antialiasing• glPolygonMode

- No point or line mode

Page 10: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 10

Pixels and BitmapsPixels and BitmapsIn• glPixelStorei

- For loading textures and reading from the screen

- Only supports GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT

• glReadPixels- Limited number of formats

Out• Imaging subset (filters, histograms,

minmax)• glDrawPixels• glCopyPixels• glPixelZoom• glBitmap• glRasterPos

Page 11: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 11

TexturesTexturesIn• Most common formats

- GL_RGB, GL_RGBA, GL_LUMINANCE, GL_ALPHA, GL_LUMINANCE_ALPHA

- 16-bit formats (packed pixel), 24 bits, 32 bits

• 2D textures- glTexImage2D- glTexSubImage2D- glCopyTexImage2D- glCopyTexSubImage2D

• Compressed 2D textures- glCompressedTexImage2D- glCOmpressedTexSubImage2D- Spec doesn’t define any compression standard- Does include paletted textures as req. extension

• Texture parameters- All filtering modes (including mipmaps)- Clamp-to-edge and repeat wrap modes

• Texture environment modes- Modulate, replace, add, decal, blend

Out• 1D & 3D textures• Cube maps• Texture parameters

- No LOD control- No texture border- Thus, no clamp-to-border or clamp wrap modes

• Texture priorities- glPrioritizeTextures- glAreTexturesResident

• Dynamic texture state queries- glGetTexImage- glGetCompressedTexImage- glGetTexParameter- glGetTexLevelParameter- glGetTexEnv- glIsTexture

Page 12: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 12

Per-fragment OperationsPer-fragment OperationsIn• Scissor test

- glEnable(GL_SCISSOR_TEST), glScissor• Multisampling

- glEnable(GL_MULTISAMPLE), glSampleCoverage

• Alpha test- glEnable(GL_ALPHA_TEST), glAlphaFunc

• Stencil test- Implementations aren’t required to have a

stencil buffer• Depth test

- Implementations aren’t required to have a depth buffer

• Blending- Mostly

• Dithering- Implementation may ignore it

• Logic ops (non-indexed only)- glColorLogicOp

Out• Some control over blending

- glBlendEquation- glBlendColor

Page 13: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 13

Framebuffer OperationsFramebuffer OperationsIn• Color masking

- glColorMask

• Clears- glClear- glClearColor- glClearDepth- glClearStencil

Out• glDrawBuffer• glReadBuffer• Accumulation buffer

- glAccum

Page 14: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 14

More inMore in• glFlush• glFinish• glHint• glGetString• glGetIntegerv

- Limited to static states

• Fog- glFog- Indexed fog not supported- Will probably be done per-vertex rather than per-pixel

Page 15: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 15

More outMore out• Evaluators• Selection• Feedback• Display lists• Rectangles

- glRect

• Clip planes• Most state queries

- glGetBooleanv/glGetDoublev/glGetFloatv- glIsEnabled

• Attribute stacks- glPush/PopAttrib- glPush/PopClientAttrib

Page 16: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 16

OutlineOutline• Background• OpenGL ES 1.0 vs. OpenGL• OpenGL ES 1.0 Extensions• What’s new in OpenGL 1.1• Learning more

Page 17: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 17

OpenGL ES 1.0 ExtensionsOpenGL ES 1.0 Extensions• Divided into core additions, required, and optional• OES_byte_coordinates (core)

- Allows the use of bytes in vertex and texcoord arrays

• OES_fixed_point (core)- For every function taking a float, there’s now a function accepting fixed

- e.g. glClearColorx, glTexParameterx- New type: GL_FIXED (s15.16)

• OES_single_precision (core)- No doubles in OpenGL ES so…- Added several new functions to replace functions that only accept doubles

- e.g. glFrustum

• OES_read_format (required)- Allows implementation to specify preferred forma/typet for glReadPixels- This is in addition to the required format/type of GL_RGBA/GL_UNSIGNED_BYTE- Queried by passing GL_IMPLEMENTATION_READ_FORMAT_OES and

GL_IMPLEMENTATION_READ_TYPE_OES to glGetIntegerv()

Page 18: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 18

OpenGL ES 1.0 Extensions (cont)OpenGL ES 1.0 Extensions (cont)• OES_compressed_paletted_texture

- Allows the use of textures composed of palettes of 16 or 256 entries in 5 different formats (24-bit RGB, 32-bit RGBA, RGB565, RGB5551, RGB4444)

- Specified using the glCompressedTexImage2D API

• OES_query_matrix (optional)- Allows an app to read the current value of any matrix stack- API allows the implementation to report representation as accurately as possible without using

floats:GLbitfield glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16])

- Matrix component i = mantissa[i] * 2 ^ exponent[i]- Invalid matrix elements are identified in return value

Page 19: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 19

OutlineOutline• Background• OpenGL ES 1.0 vs. OpenGL• OpenGL ES 1.0 Extensions• What’s new in OpenGL 1.1• Learning more

Page 20: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 20

OpenGL ES 1.1OpenGL ES 1.1• Released at SIGGRAPH last month

• Based on OpenGL 1.5 specification

• Many changes added with hardware support in mind

• Adds features to OpenGL ES 1.0- Higher quality rendering options- Performance optimizations- Reduces memory bandwidth and power consumption

Page 21: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 21

What’s new in OpenGL ES 1.1?What’s new in OpenGL ES 1.1?• Vertex buffer objects

- Subset of OpenGL 1.5 VBOs – no read or copy, no stream draw, no memory mapping

• User clip planes- At least one

• Point parameters• Greatly improved multitexture support

- At least two texture units supported- All GL_COMBINE modes supported except for crossbar

• Automatic mipmap generation• Blend squaring• glColor4ub and glColor4ubv• Almost all dynamic and static state queries are now supported

Page 22: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 22

What wasn’t included?What wasn’t included?• Occlusion queries• Secondary color• Fog coordinates• Multi draw arrays/elements• Mirrored repeat wrap mode• LOD bias• Depth textures and shadow mapping operations• No shaders (yet)

Page 23: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 23

OpenGL ES 1.1 ExtensionsOpenGL ES 1.1 Extensions• OES_matrix_get (core)

- Replaces OES_query_matrix- Allows Common-lite profiles to report floating point representation without requiring floating point

support in the profile- Values are returned encoded in ints, using IEEE 734 representation

- Adds GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES, GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES, and GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES tokens to be passed to glGetIntegerv

• OES_point_sprite (required)- Very similar to ARB_point_sprite and NV_point_sprite extensions- Used with point size and point size attenuation

• OES_point_size_array (required)- Adds additional vertex attribute/array for point sizes- Used with point sprites to specify sprites of different sizes

Page 24: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 24

OpenGL ES 1.1 Extensions (cont.)OpenGL ES 1.1 Extensions (cont.)• OES_matrix_palette (optional)

- Simplified ARB_matrix_palette

- Palette contains up to GL_MAX_PALETTE_MATRICES_OES matrices

- Matrices added to palette by setting the matrix mode to GL_MATRIX_PALETTE_OES and using glCurrentPaletteMatrixOES and existing matrix functions

- Can also load from the current modelview matrix with glLoadPaletteFromModelViewMatrixOES

- Each vertex can have up to GL_MAX_VERTEX_UNITS_OES matrix indices and weights

- Per-vertex indices and weights specified with:- glMatrixIndexPointerOES- glWeightPointerOES

Page 25: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 25

OpenGL ES 1.1 Extensions (cont.)OpenGL ES 1.1 Extensions (cont.)• OES_draw_texture (optional)

- Allows fast rendering of 2D elements by taking advantage of existing texture hardware

- Adds a texture crop rectangle per texture object- Set by using GL_TEXTURE_CROP_RECT_OES with glTexParameteriv

- The region in the crop triangle is drawn using glDrawTexOES- Interface allows the image to be stretched or shrunk- Z value can be controlled, but is constant across the surface- Causes fragments to be generated for the specified window region

- No different from normal fragments- All active texture units are applied, using filtering modes and texture environment- Current color applied- Eye depth is 0 for fog computation, though this can be changed if EXT_fog_coord is supported

Page 26: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 26

OutlineOutline• Background• OpenGL ES 1.0 vs. OpenGL• OpenGL ES 1.0 Extensions• What’s new in OpenGL 1.1• Learning more

Page 27: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 27

Learning moreLearning more• OpenGL ES website: www.opengles.org or www.khronos.org

• OpenGL ES Game Development, Course Technology PTR, Sept. ‘04

Page 28: OpenGL ES 101

© Copyright Khronos Group, 2004 - Page 28

Questions?Questions?