1 / 28

OpenGL ES 101

OpenGL ES 101. Dave Astle, GameDev.net, Qualcomm dave@gamedev.net, dastle@qualcomm.com. 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

glynn
Download Presentation

OpenGL ES 101

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. OpenGL ES 101 Dave Astle, GameDev.net, Qualcomm dave@gamedev.net, dastle@qualcomm.com

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

  3. 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

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

  5. In glColor4f glNormal3f glMultiTexCoord4f Out Immediate Mode glBegin/glEnd, glVertex, glTexCoord Color index mode Vertex Specification

  6. In glVertexPointer glNormalPointer glTexCoordPointer glColorPointer glDrawArrays glDrawElements glClientActiveTexture glEnableClientState glDisableClientState Out glEdgeFlagPointer glIndexPointer glArrayElement glInterleavedArrays glDrawRangeElements Quads, quad strips, and polygons Vertex Arrays

  7. In glDepthRange glViewport glMatrixMode (except color) glLoadMatrixf glRotatef glScalef glTranslatef glFrustum glOrtho glActiveTexture glPush/PopMatrix GL_RESCALE_NORMAL, GL_NORMALIZE Out glLoadTransposeMatrix glMultTransposeMatrix glTexGen glGetTexGen Transformation

  8. In 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 Materials and Lighting

  9. In glPointSize GL_POINT_SMOOTH glLineWidth GL_LINE_SMOOTH Culling glPolygonOffset Out Line and polygon stippling Polygon antialiasing glPolygonMode No point or line mode Points, Lines, and Polygons

  10. In 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 Pixels and Bitmaps

  11. In 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 Textures

  12. In 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 Per-fragment Operations

  13. In Color masking glColorMask Clears glClear glClearColor glClearDepth glClearStencil Out glDrawBuffer glReadBuffer Accumulation buffer glAccum Framebuffer Operations

  14. More 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

  15. More out • Evaluators • Selection • Feedback • Display lists • Rectangles • glRect • Clip planes • Most state queries • glGetBooleanv/glGetDoublev/glGetFloatv • glIsEnabled • Attribute stacks • glPush/PopAttrib • glPush/PopClientAttrib

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

  17. OpenGL 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()

  18. 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

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

  20. OpenGL 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

  21. 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

  22. 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)

  23. OpenGL 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

  24. 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

  25. 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

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

  27. Learning more • OpenGL ES website: www.opengles.org or www.khronos.org • OpenGL ES Game Development, Course Technology PTR, Sept. ‘04

  28. Questions?

More Related