OpenGL ES and OpenVG DMP Yokohama Dec09.pdf - Khronos Group

35
Eisaku Ohbuchi Digital Media Professionals Inc. OpenGL ES update

Transcript of OpenGL ES and OpenVG DMP Yokohama Dec09.pdf - Khronos Group

Eisaku Ohbuchi

Digital Media Professionals Inc.

OpenGL ES update

What is OpenGL ES?

• OpenGL for mobile devices

– Gets rid of redundant / legacy features

– Extensions to make it mobile-friendly

– All the functionality of the desktop API

• Versions

– ES 1.0 / 1.1: fixed function

– ES 2.0: shader-based via GLSL ES

• A huge success!

– The dominant native 3D API for mobile devices

– Products from every major cell phone manufacturer

– Moving rapidly into other embedded markets

– >> 200M units shipped

What’s New in 2009

• OpenGL ES 2.0 platforms are shipping!

– Available in several popular handsets

– Coming soon to set-top boxes, navigation devices,

etc.

– SDKs, books available

Working Group Activities

• Conformance Tests

– OpenGL ES 1.1 and 2.0 CTS upgrades released

• Now preparing the next update with some bug fixes.

• KTX file format

– Standard file format for ETC1 compressed textures

– Extended to handle all GL ES formats

– Pixel data payloads can be passed directly to GL

– Specification & sample loader code are coming very soon.

• New technology

– Extensions to ES 2.0 performance / functionality

– Extensions to expose next-generation hardware features

Improving GL / GL ES Interoperability

• The Dream

– GL Everywhere

– Seamless portability

• The Reality

– Relationship between GL

and ES is a bit messy

– Porting code is more difficult

than it needs to be

– Keeping the APIs in sync is

becoming more difficult

OpenGL

OpenGL ES 1.x

OpenGL ES 2.0

OpenGL Development Model

Cool New

Tech ARB

Extensions GL Specs

OpenGL

ES WG

ES Specs

The Model

The Emerging Reality

Cool New

Tech

ARBGL

Specs

OpenGL

ES WG

ES Specs

The ARB / ES Convergence TSG

• Introducing the ARB / ES Convergence TSG

– Joint subcommittee of the ARB and the OpenGL ES WG

• Charter

– Encourage information sharing and communication

– Produce joint technology and specification roadmap

– Recommend ways to reduce existing differences over time

– Recommend ways to minimize or avoid divergence in future

• The Future

– Could OpenGL ES become a profile of OpenGL?

• Not a goal at present, but something to explore

The Serialization TSG

• Serialization is a TSG under OpenGL ES

– Just kicked off

• Use cases

– External displays, server and client come from different vendors

– Communicating across processes

– Better allocation of tasks with off-chip graphics HW

– Tools for development, debugging, profiling

– Networked gaming

Questions?

Eisaku Ohbuchi

Digital Media Professionals Inc.

DMP solutions and

SweetsUI engine

Company overview

Digital Media Professionals Inc.(DMP)

www.dmprof.com

Location: Tokyo, JAPAN.

Incorporated: July/2002

Products:– Graphics hardware IP cores

– Training services

– Software for our graphics hardware IPs

DMP graphics hardware IPs

Advanced 3D

graphics core(OpenGL ES 1.1 +

DMP extension)

PICA200

Vector graphics

IP core (OpenVG1.1)

SMAPH-F

Tiny 3D graphics

core(OpenGL ES1.1)

PICA200 Lite

PICA200 for

FPGA

Programmable

graphics IP core(OpenGLES1.1, 2.0,

OpenVG1.1)

SMAPH-S

DMP Training services

Location – DMP Inc. Seminar Room

(2 minutes walk from JR Mitaka station)

Schedule

OpenGL ES programming training I

January 14 - 15 2010

OpenGL ES programming training II

January 21 - 22 2010

GLSL Programming training course (getting started)

February 18 - 19 2010

See details - www.dmprof.com or

http://www.khronos.org/news/events/

OpenGL ES programming training I

Curriculum

Goal To understand architecture of OpenGL ES and overview of some implementations.

To be able to read programs using OpenGL ES 1.1.

To be able to write 3D graphics applications for embedded systems with OpenGL ES 1.1.

Capacity – 12 people

Tuition Fee 49,560 Yen (taxes included, for 1 person, 2 days)

Khronos Member: 45,000 Yen (taxes included, for 1 person, 2 days)

SIGGRAPH Asia開催記念キャンペーン! 特別価格 ¥37,800

Day 1IntroductionOpenGL ES OverviewEGL InterfaceDrawing PrimitivesSetting ViewportTransformationDepth BufferDrawing SceneAnimation

Day 2Field of View Lighting(I)BlendingPixel OperationTexture Mapping(I)FogFrame Buffer OperationConclusions

OpenGL ES programming training II

Curriculum

Goal To be able to implement some visual effects using OpenGL ES 1.1 standard.

To be able to give consideration to performance aspects of OpenGL ES 1.1 application.

To understand basic concept of OpenGL ES 2.0

Capacity – 12 people

Tuition Fee 49,560 Yen (taxes included, for 1 person, 2 days)

Khronos Member: 45,000 Yen (taxes included, for 1 person, 2 days)

SIGGRAPH Asia開催記念キャンペーン! 特別価格 ¥37,800

Day 1IntroductionLighting(II)Buffer ObjectPoint Sprite ExtensionMatrix Palette ExtensionTexture Mapping(II)Compressed TextureDraw Texture

Day 2Dynamic Cube MappingPlaner ReflectionDot3 Bump MappingStencil ShadowHint for Performance EvaluationOther TipsOverview of OpenGL ES 2.0Conclusions

GLSL Programming training course

(getting started)Curriculum

Goal To understand architecture of OpenGL ES 2.0.

To be able to read shader programs using GLSL 1.1.

To be able to write simple shader programs using GLSL 1.1.

Capacity – 12 people

Tuition Fee 99,750 Yen (taxes included, for 1 person, 2 days)

Khronos Member: 94,500 Yen (taxes included, for 1 person, 2 days)

SIGGRAPH Asia開催記念キャンペーン! 特別価格 ¥76,650

Day 1IntroductionChapter I: Overview of OpenGL ES 2.0OpenGL ES 2.0 OverviewProgrammable Shader OverviewChapter II: GLSL 1.1.0Basics of the Shader APIMixed ModeShading Language Grammar

Day 2VariablesFunctionsVertex ShaderFragment ShaderDebugging and Tips for DevelopmentChapter III: GLSL ES 1.00OpenGL ES Shader Language

Software for our graphics HW core –

Sweets solution

• 3D graphics applications in embedded

systems

– Expanding from 3D gaming to user

interface applications

• DMP can provide a simple SW solution

for demonstration and user interface

development

SweetsUI engine.

(Small and Wonder graphics

Engine for Embedded sysTemS.)

Customer application and tools

SDK

OpenGLES1.1, 2.0

Driver

Target HW Desktop emulator

OS

SweetsUI Engine

Graphics engine

Lua script

SweetsUI 3D workflow overview

Target HWorPC emulator

DMPEngine

DMP Binary

ConverterColladafile

3D tools(Maya, Max, SoftimageXSI …)

Sweets3D

Sweets3D

User definition

App.

SweetsUI 3D features

Optimized 3D graphics engine for the embedded system.

• C-based light weight graphics engine

• OpenGL ES1.1 and DMP extension support

• Script based control with Lua file

– Run-time script execution support by DMP engine.

• Collada file import

– De-facto 3D authoring tool interchange format support

• Optimized binary format export for Engine

• Dynamic scene and animation control

– Scene graph and animation manipulation using Lua scripting and C

programming.

Sweets 3D demo

• Simple UI application for photo exploration

Questions?

Eisaku Ohbuchi

Digital Media Professionals Inc.

How to make

an OpenVG application

(not "Tiger")

DMP graphics hardware IPs

Advanced 3D

graphics core(OpenGL ES 1.1 +

DMP extension)

PICA200

Vector grapgics

IP core (OpenVG1.1)

SMAPH-F

Tiny 3D graphics

core(OpenGL ES1.1)

PICA200 Lite

PICA200 for

FPGA

Programmable

graphics IP core(OpenGLES1.1, 2.0,

OpenVG1.1)

SMAPH-S

What is Tiger

• Major vector graphics sample

– Khronos OpenVG reference implementation also includes this

tiger sample.

– Major functions of Tiger sample.

• Path rendering

• Antialiasing

• No bitmaps

• No animations

• No masks

A not “Tiger” application - pdot_img

• Pseudo 3D vector graphics rendering

– Functions

• Path rendering

• Bitmap

• Masking

• Font rendering

• Rotating dots in 3D space

• Select and preview interactions

• You can try by downloading the source code

from our web site:

www.dmprof.com

Overall structure: main()

main(){// Parameter and variavble initialization....

// Init displayif (!initDisplay(windowWidth, windowHeight, egldisplay, eglsurface)) {cout << "Failed to initialize window" << endl;return 0;

}

// Init appinitApp();

// Display loopwhile (!quit) {

// Key event handling....// Repaintrepaint();

}

Main loop

Display

initialization

Key event

Repaint

3D transformation

• OpenVG 1.1 supports

transformation with 3x3 matrix.

• but it works in 2D space => No

actual z value

• Here is pseudo 3D transformation

for each dot.

– Rotation about x-, y-, and z-axis

– Perspective transformation

void trans(int k){float persX = dotData[k][0];float persY = dotData[k][1];float persZ = 150;float xR,yR,zR;

// rotation about x-axis:yR = persY * cos(rotX) - persZ * sin(rotX);zR = persY * sin(rotX) + persZ * cos(rotX);persY = yR; persZ = zR;// rotation about y-axis:xR = persX * cos(rotY) + persZ * sin(rotY);zR = persZ * cos(rotY) - persX * sin(rotY);persX = xR; persZ = zR;if (useRZ) {

// rotation about z-axis:xR = persX * cos(rotZ) - persY * sin(rotZ);yR = persY * cos(rotZ) + persX * sin(rotZ);persX = xR; persY = yR;

}

float z = persZ + distZo;float souziK = (distScreen)/(z);

transData[k][0] = persX * souziK;transData[k][1] = persY * souziK;transData[k][2] = souziK;

}

Path rendering (drawing of stars)

float stUnit = strokeWidth;//starSegs[0] = VG_MOVE_TO_ABS;starSegs[1] = VG_MOVE_TO_REL;for(int k=2; k<6; k++) starSegs[k] = VG_LINE_TO_REL;starSegs[6] = VG_CLOSE_PATH;//starData[0] = orignX; starData[1] = orignY;starData[2] = -(stUnit / 2.0); starData[3] = stUnit / 6.0;starData[4] = stUnit; starData[5] = 0.0;starData[6] = -stUnit; starData[7] = -(2.0 * stUnit) / 3.0;starData[8] = stUnit / 2.0; starData[9] = stUnit;starData[10] = stUnit / 2.0; starData[11] = -stUnit;

// Append path datavgAppendPathData(myPath, 7, starSegs, starData);

Append

path data

Path rendering (drawing of stars)

(orgX, orgY)

1. VG_MOVE_TO_ABS

(orgX, orgY)

2. VG_MOVE_TO_REL

(-(stUnit / 2.0), stUnit / 6.0)

3. VG_LINE_TO_REL

(stUnit, 0.0)

4. VG_LINE_TO_REL

(-stUnit, 2.0*stUnit/3.0)

5. VG_LINE_TO_REL

(stUnit/2.0, stUnit)

6. VG_LINE_TO_REL

(stUnit/2.0, -stUnit)

7. VG_CLOSE_PATH

Path rendering (drawing of stars)

// Append path datavgAppendPathData(myPath, 7, starSegs, starData);// Transform matrix generationvgSeti(VG_MATRIX_MODE, VG_MATRIX_FILL_PAINT_TO_USER);vgLoadIdentity();vgTranslate(tmpData[0]-(zsc*swo2), tmpData[1]-(zsc*swo2));vgScale(zsc*swoD, zsc*swoD);// Blend mode configurationvgSeti(VG_BLEND_MODE, spec ? VG_BLEND_ADDITIVE :

VG_BLEND_SRC_OVER);// Paint pattern setvgPaintPattern(imgPaint, img[imgIndx]);

// Draw pathvgDrawPath(myPath, fShape ? VG_FILL_PATH : VG_STROKE_PATH);vgClearPath(myPath, VG_PATH_CAPABILITY_ALL);

Append

path data

Transform

matrix

Blending

mode

Draw path

Paint

pattern

Draw image, blending and masking

int imgIndx = (5 + vOffs) % numImg;vgSeti(VG_MASKING, VG_TRUE);vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);

float fAlpha = (float)fCount/(float)fStep;float ctVal_w[8] = { 1.0,1.0,1.0,(1.0-fAlpha), 0.0,0.0,0.0,0.0};vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, ctVal_w);vgDrawImage(img[(imgIndx==0) ? (numImg-1) : (imgIndx-1)]);ctVal_w[3] = fAlpha;vgSetfv(VG_COLOR_TRANSFORM_VALUES, 8, ctVal_w);vgDrawImage(img[imgIndx]);

if (++fCount==fStep) fading = false;

Set masking

and blend

mode

Color

transform

Draw

image

Color transformation

Benefit of vector graphics

• Scalable, high quality rendering with lightweight graphics

core

– Font rendering

– 2D or 2.5D user interface

– Map rendering

• Native OpenVG application can be fast !

– Few overhead

– Seamless programming with native application.

• Let’s develop graphics applications with OpenVG API !

Questions?