Prologue to 2D/3D Design Advancement with OpenGL ES on the Beagle Board.


349 views
Uploaded on:
Description
Prologue to 2D/3D Design Advancement with OpenGL ES on the Beagle Board Mud D. Montgomery, Representation Programming Engineer September, 2009 Motivation Presentation Design APIs OpenGL ES 1.1 OpenGL ES 2.0 OpenVG 1.1 Illustrations SDK Compositing Beagle Board Workshop Presentation
Transcripts
Slide 1

Prologue to 2D/3D Graphics Development with OpenGL ES on the Beagle Board Clay D. Montgomery, Graphics Software Engineer September, 2009

Slide 2

Agenda Introduction Graphics APIs OpenGL ES 1.1 OpenGL ES 2.0 OpenVG 1.1 Graphics SDK Compositing Beagle Board Workshop

Slide 3

Introduction Applications PowerVR SGX Core

Slide 4

Graphics Applications Accelerated 3D GUIs are pervasive today Custom GUIs give the best item separation Larger showcase sizes require quicker representation Hardware quickening agents utilize less power than programming usage Desktop advances are quickly moving to the portable space (programmable shaders) Major applications are: Scalable User Interfaces Navigation Games Visualizations (Music) Automotive

Slide 5

ARM Cortex-A8 + NEON VFP + SGX ARM ® Cortex ™ - A8 with NEON VFP PowerVR SGX Graphics C64x+ DSP Display Subsystem Other Peripherals The best blend for superior versatile design ARM Cortex-A8 is 2X speedier than ARM11 NEON is a SIMD vector coasting point processor (VFP) Accelerates numerous estimations in illustrations applications another 2X to 4X Ideal for shading space change, picture channels, amusement material science, and so on. OMAP3530 Comparison of NEON to ARM11 VFP Calculation ARM 11 VFP NEON 4 x 4 * 4x1 grid mult 22 cycles/vertex 8 cycles/vertex Vector normalization 30 cycles/vertex 6 cycles/vertex 3 term dab product 5.1 cycles/product 3 cycles/item 3 term cross product 11.7 cycles/product 3 cycles/item Division by W 17 cycles/vertex 3.5 cycles/vertex Data gave by ARM, Ltd.

Slide 6

PowerVR SGX Core Combination of hard-wired pipelines and programmable USSE (Universal Scalable Shader Engine) Multithreaded Runs Vertex Shader Programs Runs Fragment Shader Programs SIMD execution 32-bit IEEE coasting point Fine-grained errand exchanging Advanced geometry DMA High quality antialiasing Deferred rendering Tiled-based structural planning ~10M Polygons/sec. 275 Million Pixels/sec. ~0.9 GFLOPS

Slide 7

PowerVR SGX Core The SGX is excessively mind boggling, making it impossible to program at the register level! In this manner, utilize the standard programming APIs: OpenGL ES 1.1 OpenGL ES 2.0 OpenVG 1.1 Industry Standard APIs were characterized by the Khronos Group Protects your product advancement speculation!

Slide 8

Graphics APIs The OpenGL Pipeline OpenGL ES 1.1 Porting from Desktop Programming Example OpenGL ES 2.0 Evolution GLSL ES Shader Programming Example OpenVG

Slide 9

The OpenGL Graphics Pipeline C A B A C E F B D G E D C A B State Variables Front Buffer Fragment Pipeline Geometry Pipeline Camera Position Light Sources Etc. Back Buffer GL_TRIANGLES GL_TRIANLE_FAN Texture Maps GL_TRIANGLE_STRIP

Slide 10

OpenGL ES – Porting from Desktop Applications can be ported from desktop OpenGL Features expelled from desktop OpenGL: glBegin/glEnd and glVertex (See the accompanying code porting illustration) Advanced: imaging subset, evaluators, showcase records Legacy: Indexed hues, DrawPixels Double accuracy information sorts and passage focuses Features included Fixed-point and byte information Fixed-point just profile accessible (however not upheld for OMAP) Features held Vertex Transforms and Lighting (generally) Multi-texturing (2D just) Full Scene Antialiasing by means of Multisampling Alpha mixing Other porting issues GLU and GLUT Many fantastic assets are accessible for learning OpenGL

Slide 11

OpenGL 1.0 glVertex3fv(&Vertices[5][0]);/right glVertex3fv(&Vertices[4][0]); glVertex3fv(&Vertices[7][0]); glVertex3fv(&Vertices[7][0]); glVertex3fv(&Vertices[4][0]); glVertex3fv(&Vertices[6][0]); glVertex3fv(&Vertices[6][0]);/top glVertex3fv(&Vertices[2][0]); glVertex3fv(&Vertices[7][0]); glVertex3fv(&Vertices[7][0]); glVertex3fv(&Vertices[2][0]); glVertex3fv(&Vertices[3][0]); glVertex3fv(&Vertices[1][0]);/front glVertex3fv(&Vertices[5][0]); glVertex3fv(&Vertices[3][0]); glVertex3fv(&Vertices[3][0]); glVertex3fv(&Vertices[5][0]); glVertex3fv(&Vertices[7][0]); glVertex3fv(&Vertices[0][0]);/base glVertex3fv(&Vertices[4][0]); glVertex3fv(&Vertices[1][0]); glVertex3fv(&Vertices[1][0]); glVertex3fv(&Vertices[4][0]); glVertex3fv(&Vertices[5][0]); glEnd(); } Example of porting old code from desktop OpenGL void DrawCube(void) { static GLfloat Vertices[8][3] = {/x y z {-1.0, - 1.0, - 1.0}, //0 {-1.0, - 1.0, 1.0}, //1 {-1.0, 1.0, - 1.0}, //2 {-1.0, 1.0, 1.0}, //3 { 1.0, - 1.0, - 1.0}, //4 { 1.0, - 1.0, 1.0}, //5 { 1.0, 1.0, - 1.0}, //6 { 1.0, 1.0, 1.0} //7 }; glBegin(GL_TRIANGLES); glVertex3fv(&Vertices[1][0]);/left glVertex3fv(&Vertices[3][0]); glVertex3fv(&Vertices[0][0]); glVertex3fv(&Vertices[0][0]); glVertex3fv(&Vertices[3][0]); glVertex3fv(&Vertices[2][0]); glVertex3fv(&Vertices[0][0]);/back glVertex3fv(&Vertices[2][0]); glVertex3fv(&Vertices[4][0]); glVertex3fv(&Vertices[4][0]); glVertex3fv(&Vertices[2][0]); glVertex3fv(&Vertices[6][0]);

Slide 12

OpenGL ES 1.1 Embedded code with no lighting void DrawCube(void) { static GLfloat Vertices[8][3] = {/x y z {-1.0, - 1.0, - 1.0}, //0 {-1.0, - 1.0, 1.0}, //1 {-1.0, 1.0, - 1.0}, //2 {-1.0, 1.0, 1.0}, //3 { 1.0, - 1.0, - 1.0}, //4 { 1.0, - 1.0, 1.0}, //5 { 1.0, 1.0, - 1.0}, //6 { 1.0, 1.0, 1.0} //7 }; static GLuint Indices[6][6] = { {0, 1, 3, 3, 2, 0},/left {0, 2, 4, 4, 2, 6},/back {5, 4, 7, 7, 4, 6},/right {2, 3, 7, 7, 6, 2},/top {1, 5, 3, 3, 5, 7},/front {0, 4, 1, 1, 4, 5}/base }; glVertexPointer(3, GL_FLOAT, 0, Vertices); glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, Indices); }

Slide 13

OpenGL ES 1.1 Embedded code with lighting (Smooth Shaded) void DrawCube(void) { static GLfloat Vertices[8][3] = {/x y z {-1.0, - 1.0, - 1.0}, //0 {-1.0, - 1.0, 1.0}, //1 {-1.0, 1.0, - 1.0}, //2 {-1.0, 1.0, 1.0}, //3 { 1.0, - 1.0, - 1.0}, //4 { 1.0, - 1.0, 1.0}, //5 { 1.0, 1.0, - 1.0}, //6 { 1.0, 1.0, 1.0} //7 }; static GLuint Indices[6][6] = { {0, 1, 3, 3, 2, 0},/left {0, 2, 4, 4, 2, 6},/back {5, 4, 7, 7, 4, 6},/right {2, 3, 7, 7, 6, 2},/top {1, 5, 3, 3, 5, 7},/front {0, 4, 1, 1, 4, 5}/base }; glVertexPointer(3, GL_FLOAT, 0, Vertices); glNormalPointer(GL_FLOAT, 0, NormalsPerVertex); glDrawElements(GL_TRIANGLES, 36, GL_UNSIGNED_INT, Indices); } Surface Normal Vectors/One typical per vertex. static GLfloat NormalsPerVertex[8][3] = {/x y z {-0.5, - 0.5, - 0.5},/0 {-0.5, - 0.5, 0.5},/1 {-0.5, 0.5, - 0.5},/2 {-0.5, 0.5, 0.5},/3 { 0.5, - 0.5, - 0.5},/4 { 0.5, - 0.5, 0.5},/5 { 0.5, 0.5, - 0.5},/6 { 0.5, 0.5, 0.5}/7 };

Slide 14

OpenGL ES 1.1 …and whatever is left of the project primary() { Allocate casing cradles stuck DDR Imbroglio the cushions to be shown on the DSS (by means of EGL) glEnable(GL_LIGHTING); //Setup a light for the scene. glEnable(GL_LIGHT0); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, Position); glViewport(0, 0, Width, Height); //Setup the viewport to the scene (camera). for (Degrees = 0; Degrees < 360; Degrees++) { glClearColor(0.0, 0.0, 0.0, 1.0); //Clear attracting cradle to dark. glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glRotatef(Degrees, 1.0, 1.0, 0.0); //Rotate the block model. glColor3ub(0, 0, 255); //Set attracting shading to blue. DrawCube(); //Draw the Cube! glPopMatrix(); eglSwapBuffers(eglDisplay, eglSurface); //Swap pointers to front and back supports }

Slide 15

Evolution of Embedded OpenGL 1.0 – 2.0 (Desktop) Large and unreasonable for installed gadgets Customers are porting applications from these variants to OMAP OpenGL ES 1.1 Embedded form for settled capacity shading equipment Subset of desktop OpenGL Standard made by the Khronos Group Industry consortium in 2003 Rapidly turned into the overwhelming standard for inserted 3D Also prominent for adaptable 2D applications OpenGL ES 2.0 Replaces 2 noteworthy segments of the 3D pipeline with shader programs Vertex Shader – Distort, transform and/or vivify vertex positions Fragment Shader – Calculate pixel hues for shadows and/or reflections Smaller, more memory proficient OpenGL library and less composition maps Shaders are modified with new GLSL ES Language Programmable centers as of now command 3D representation on the desktop Will get to be rule in implanted gadgets too

Slide 16

OpenGL ES 1.1 Fixed-Function Pipeline for Vertex Shading API Triangles/Lines/Points Primitive Processing Transform and Lighting Primitive Assembly Rasterizer Vertices Vertex Buffer Objects Texture Environment Color Sum Fog Alpha Test Depth Stencil Color Buffer Blend Dither Frame Buffer

Slide 17

OpenGL ES 2.0 Programmable Pipeline for Vertex and/or Fragment Shading API Triangles/Lines/Points Primitive Processing Vertex Shader Primitive Assembly Rasterizer Vertices Vertex Buffer Objects Fragment Shader Depth Stencil Color Buffer Blend Dither Frame Buffer

Slide 18

OpenGL ES 1.1 - Programming Example/Enable altered capacity shading (smooth or level) glShadeModel(GL_SMOOTH);/Define the presence of triangle surfaces glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, fMaterialAmbient); g

Recommended
View more...