SlideShare a Scribd company logo
The Titanium OpenGL Module:
  Sophisticated Graphics for the Ti Programmer




               Richard Salter
Richard M. Salter
Logical Labs
—  What   is OpenGL?
  ◦  An API for managing a 3D graphics
     environment.
   –  not OO
   –  OpenGL “pipeline”
—    Getting Ti/Javascript and OpenGL to play nicely
      together
      ◦  “Objectify” the OpenGL API with respect to a
         drawing surface
        –  Create a natural extension to the Titanium object model.
        –  Ti.OpenGL.View

      ◦  Compensate for inefficiencies introduced by moving
         programming level to Javascript.
        –  Cope with the large volume of data associated with a given
            OpenGL model.
        –  Ti.OpenGL.DataBuffer
Richard Salter: Using the Titanium OpenGL Module
var Ti.Opengl = require('Ti.OpenGL');	

            var view = Ti.Opengl.createView({	
              	backgroundColor:"#aaa",	
              	top:0,	
              	left:0	
              	width:’100%’,	
              	height:’100%’,	
            }),	


—    Creates OpenGL context and view
—    Initializes Framebuffers and Renderbuffers
—    Optionally: can specify
      ◦  depthbuffer
      ◦  multisampling
var squareVertices = [	                  (5, 33)
                           (-.5, .33)
  	-0.5, -0.33,	
  	 0.5, -0.33,	
  	-0.5, 0.33,	
  	 0.5, 0.33,	            (-.5, -.33)   (5, -.33)
],	

var squareColors = [	
   	255, 255,   0, 255,	
   	0,   255, 255, 255,	
   	0,     0,   0,   0,	
   	255,   0, 255, 255,	
],
view.setFrameBuffer();	
view.clear();	
view.glVertexPointer(2, Ti.Opengl.GL_FLOAT, 0, squareVertices);	
view.glColorPointer(4, Ti.Opengl.GL_UNSIGNED_BYTE, 	
   	  	   	   	   	  	0, squareColors);	
view.glEnableClientState(Ti.Opengl.GL_VERTEX_ARRAY);	
view.glEnableClientState(Ti.Opengl.GL_COLOR_ARRAY);	
view.glDrawArrays(Ti.Opengl.GL_TRIANGLE_STRIP, 0, 4);	
view.presentFrameBuffer()	


   —    OpenGL convenience instructions
         ◦  setFrameBuffer/clear initialize framebuffer
         ◦  presentFrameBuffer submits framebuffer for
            rendering
setInterval(	
         	function(e){	
         	   	drawframe(view, new Date().getTime());	
         	}, 	
         	interval	
      );

var drawframe = function(view, timestamp) { 	
   	view.setFrameBuffer();	
   	view.clear();	
   	view.glLoadIdentity();	
   	view.glTranslatef(0.0, 	
   	   	  	Math.sin(mover.iterate(timestamp))/2.0, 	
   	   	  	0.0);	
   	view.glDrawArrays(Ti.Opengl.GL_TRIANGLE_STRIP, 0, 4); 	
   	view.presentFrameBuffer();	
};
var vertexDB = Ti.Opengl.createDataBuffer({	
        	data : Demo.data.squareVertices,	
        	type : Ti.Opengl.GL_FLOAT	
      });	

      var colorDB = Ti.Opengl.createDataBuffer({	
        	data : Demo.data.squareColors,	
        	type : Ti.Opengl.GL_UNSIGNED_BYTE	
      });

—    A databuffer is a compact opaque representation of an array of data
—    Databuffer properties
      ◦  data
      ◦  type
      ◦  size
view.glVertexPointer(2, Ti.Opengl.GL_FLOAT, 	
  	 	 	 	 	 	 	0, vertexDB);	
view.glColorPointer(4, Ti.Opengl.GL_UNSIGNED_BYTE, 	
  	 	 	 	 	 	 	0, colorDB);	



 —  Vertex   Buffers
   ◦  Databuffers are also used as a bridge to
      facilitating greater efficiency through using
      OpenGL vertex buffers directly.
—  Loading    from files
  ◦  Easiest
    –  Use the pvrtc file format with
        glCompressedTexImage2D and a Ti.Filesystem.File
        argument
  ◦  Alternatively
    –  Use jpg, png, etc. with convenience function
        texImage2D and a Ti.Filesystem.File argument.
—    Using a blob
           var txtr = Ti.Opengl.createTexture({	
              	filter : Ti.Opengl.GL_LINEAR,	
              	view : opengl,	
              	image : blob	
           })


  —    To bind this texture:

view.glBindTexture(Ti.Opengl.GL_TEXTURE_2D, txtr.name);
—  Shaders
  ◦  Creating shader programs using Javascript
    –  reproduce Objective C template
  ◦  Matrix operations
    –  Build Javascript library
    –  Core animation matrix operations (Phase 3)
—  Building   reusable OpenGL abstractions
  ◦  VBBuffers : function(view, dataBufs)
    –  Returns 1 or 2 vertex buffers built from
        DataBuffers contained in dataBufs
  ◦  Shaders : function(vpath, fpath)
    –  Load and compile vertex and fragment shaders
        from files found at vpath and fpath
  ◦  defaultInit : function(view)
    –  Initializes view with a default orthographic
        projection, etc.
—  (As   many as we have time for)
Ad

More Related Content

What's hot (20)

실시간 인벤트 처리
실시간 인벤트 처리실시간 인벤트 처리
실시간 인벤트 처리
Byeongweon Moon
 
Kapacitor Alert Topic handlers
Kapacitor Alert Topic handlersKapacitor Alert Topic handlers
Kapacitor Alert Topic handlers
InfluxData
 
Inc decsourcefile
Inc decsourcefileInc decsourcefile
Inc decsourcefile
heartplusbrain
 
vbscript-reference book
vbscript-reference bookvbscript-reference book
vbscript-reference book
Anand Dhana
 
Measuring SGX Texturing Performance
Measuring SGX Texturing PerformanceMeasuring SGX Texturing Performance
Measuring SGX Texturing Performance
Prabindh Sundareson
 
OpenGL L03-Utilities
OpenGL L03-UtilitiesOpenGL L03-Utilities
OpenGL L03-Utilities
Mohammad Shaker
 
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Nikita Koksharov
 
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
OdessaJS Conf
 
RedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with Redisson
Redis Labs
 
201801 CSE240 Lecture 12
201801 CSE240 Lecture 12201801 CSE240 Lecture 12
201801 CSE240 Lecture 12
Javier Gonzalez-Sanchez
 
Multi qubit entanglement
Multi qubit entanglementMulti qubit entanglement
Multi qubit entanglement
Vijayananda Mohire
 
Openstack taskflow 簡介
Openstack taskflow 簡介Openstack taskflow 簡介
Openstack taskflow 簡介
kao kuo-tung
 
The State of JavaScript
The State of JavaScriptThe State of JavaScript
The State of JavaScript
Domenic Denicola
 
What they don't tell you about JavaScript
What they don't tell you about JavaScriptWhat they don't tell you about JavaScript
What they don't tell you about JavaScript
Raphael Cruzeiro
 
Reactive x
Reactive xReactive x
Reactive x
Gabriel Araujo
 
Nicety of java 8 multithreading for advanced, Max Voronoy
Nicety of java 8 multithreading for advanced, Max VoronoyNicety of java 8 multithreading for advanced, Max Voronoy
Nicety of java 8 multithreading for advanced, Max Voronoy
Sigma Software
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
Michael Lehmann
 
Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4
Synapseindiappsdevelopment
 
Cpp
Cpp Cpp
Cpp
Ankit Dubey
 
OpenGL Starter L02
OpenGL Starter L02OpenGL Starter L02
OpenGL Starter L02
Mohammad Shaker
 
실시간 인벤트 처리
실시간 인벤트 처리실시간 인벤트 처리
실시간 인벤트 처리
Byeongweon Moon
 
Kapacitor Alert Topic handlers
Kapacitor Alert Topic handlersKapacitor Alert Topic handlers
Kapacitor Alert Topic handlers
InfluxData
 
vbscript-reference book
vbscript-reference bookvbscript-reference book
vbscript-reference book
Anand Dhana
 
Measuring SGX Texturing Performance
Measuring SGX Texturing PerformanceMeasuring SGX Texturing Performance
Measuring SGX Texturing Performance
Prabindh Sundareson
 
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Nikita Koksharov
 
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
OdessaJS Conf
 
RedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with Redisson
Redis Labs
 
Openstack taskflow 簡介
Openstack taskflow 簡介Openstack taskflow 簡介
Openstack taskflow 簡介
kao kuo-tung
 
What they don't tell you about JavaScript
What they don't tell you about JavaScriptWhat they don't tell you about JavaScript
What they don't tell you about JavaScript
Raphael Cruzeiro
 
Nicety of java 8 multithreading for advanced, Max Voronoy
Nicety of java 8 multithreading for advanced, Max VoronoyNicety of java 8 multithreading for advanced, Max Voronoy
Nicety of java 8 multithreading for advanced, Max Voronoy
Sigma Software
 
Full-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.jsFull-Stack JavaScript with Node.js
Full-Stack JavaScript with Node.js
Michael Lehmann
 
Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4Synapse india dotnet development overloading operater part 4
Synapse india dotnet development overloading operater part 4
Synapseindiappsdevelopment
 

Similar to Richard Salter: Using the Titanium OpenGL Module (20)

Opengl (1)
Opengl (1)Opengl (1)
Opengl (1)
ch samaram
 
BYO3D 2011: Rendering
BYO3D 2011: RenderingBYO3D 2011: Rendering
BYO3D 2011: Rendering
Matt Hirsch - MIT Media Lab
 
Open gles
Open glesOpen gles
Open gles
sarmisthadas
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
HIMANKMISHRA2
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
HIMANKMISHRA2
 
CS 354 Viewing Stuff
CS 354 Viewing StuffCS 354 Viewing Stuff
CS 354 Viewing Stuff
Mark Kilgard
 
Lab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer GraphicsLab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer Graphics
Rup Chowdhury
 
UNIT 1 OPENGL_UPDATED .pptx
UNIT 1 OPENGL_UPDATED               .pptxUNIT 1 OPENGL_UPDATED               .pptx
UNIT 1 OPENGL_UPDATED .pptx
miteshchaudhari4466
 
The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180
Mahmoud Samir Fayed
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
 
The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185
Mahmoud Samir Fayed
 
18csl67 vtu lab manual
18csl67 vtu lab manual18csl67 vtu lab manual
18csl67 vtu lab manual
NatsuDragoneel5
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
💻 Anton Gerdelan
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
pushpa latha
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.
Girish Ghate
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
Mohammed Romi
 
Bai 1
Bai 1Bai 1
Bai 1
Châu Thanh Chương
 
COLLADA & WebGL
COLLADA & WebGLCOLLADA & WebGL
COLLADA & WebGL
Remi Arnaud
 
Building Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
Building Native Apps- A Digital Canvas for Coders and Designers with Walter LuhBuilding Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
Building Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
FITC
 
openGL basics for sample program.ppt
openGL basics for sample program.pptopenGL basics for sample program.ppt
openGL basics for sample program.ppt
HIMANKMISHRA2
 
openGL basics for sample program (1).ppt
openGL basics for sample program (1).pptopenGL basics for sample program (1).ppt
openGL basics for sample program (1).ppt
HIMANKMISHRA2
 
CS 354 Viewing Stuff
CS 354 Viewing StuffCS 354 Viewing Stuff
CS 354 Viewing Stuff
Mark Kilgard
 
Lab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer GraphicsLab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer Graphics
Rup Chowdhury
 
The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180The Ring programming language version 1.5.1 book - Part 7 of 180
The Ring programming language version 1.5.1 book - Part 7 of 180
Mahmoud Samir Fayed
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
ICS
 
The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184The Ring programming language version 1.5.3 book - Part 8 of 184
The Ring programming language version 1.5.3 book - Part 8 of 184
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185The Ring programming language version 1.5.4 book - Part 8 of 185
The Ring programming language version 1.5.4 book - Part 8 of 185
Mahmoud Samir Fayed
 
Computer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming IComputer Graphics - Lecture 01 - 3D Programming I
Computer Graphics - Lecture 01 - 3D Programming I
💻 Anton Gerdelan
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.
Girish Ghate
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
Mohammed Romi
 
Building Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
Building Native Apps- A Digital Canvas for Coders and Designers with Walter LuhBuilding Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
Building Native Apps- A Digital Canvas for Coders and Designers with Walter Luh
FITC
 
Ad

More from Axway Appcelerator (20)

Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie
Axway Appcelerator
 
Making the Mobile Mind Shift
Making the Mobile Mind ShiftMaking the Mobile Mind Shift
Making the Mobile Mind Shift
Axway Appcelerator
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start Measuring
Axway Appcelerator
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)
Axway Appcelerator
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really Means
Axway Appcelerator
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation Template
Axway Appcelerator
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Axway Appcelerator
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Axway Appcelerator
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten app
Axway Appcelerator
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trends
Axway Appcelerator
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
Axway Appcelerator
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Axway Appcelerator
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...
Axway Appcelerator
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titanium
Axway Appcelerator
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructure
Axway Appcelerator
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplace
Axway Appcelerator
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testing
Axway Appcelerator
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Axway Appcelerator
 
Codestrong 2012 breakout session i os internals and best practices
Codestrong 2012 breakout session   i os internals and best practicesCodestrong 2012 breakout session   i os internals and best practices
Codestrong 2012 breakout session i os internals and best practices
Axway Appcelerator
 
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & RoadmapAxway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator - Titanium SDK 6.1.0 - Status, Releases & Roadmap
Axway Appcelerator
 
2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie2014 Dublin Web Summit by Jeff Haynie
2014 Dublin Web Summit by Jeff Haynie
Axway Appcelerator
 
Stop Debating, Start Measuring
Stop Debating, Start MeasuringStop Debating, Start Measuring
Stop Debating, Start Measuring
Axway Appcelerator
 
Mobile & The New Experience Economy (And What it Means for IT)
Mobile & The New Experience Economy  (And What it Means for IT)Mobile & The New Experience Economy  (And What it Means for IT)
Mobile & The New Experience Economy (And What it Means for IT)
Axway Appcelerator
 
Apps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really MeansApps, APIs & Analytics: What "Mobile First" Really Means
Apps, APIs & Analytics: What "Mobile First" Really Means
Axway Appcelerator
 
Appcelerator Presentation Template
Appcelerator Presentation TemplateAppcelerator Presentation Template
Appcelerator Presentation Template
Axway Appcelerator
 
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote   jonathan rende, appcelerator's vp of productsCodestrong 2012 keynote   jonathan rende, appcelerator's vp of products
Codestrong 2012 keynote jonathan rende, appcelerator's vp of products
Axway Appcelerator
 
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Codestrong 2012 keynote   jeff haynie, appcelerator's ceoCodestrong 2012 keynote   jeff haynie, appcelerator's ceo
Codestrong 2012 keynote jeff haynie, appcelerator's ceo
Axway Appcelerator
 
Codestrong 2012 keynote how to build a top ten app
Codestrong 2012 keynote   how to build a top ten appCodestrong 2012 keynote   how to build a top ten app
Codestrong 2012 keynote how to build a top ten app
Axway Appcelerator
 
Codestrong 2012 breakout session at&t api platform and trends
Codestrong 2012 breakout session  at&t api platform and trendsCodestrong 2012 breakout session  at&t api platform and trends
Codestrong 2012 breakout session at&t api platform and trends
Axway Appcelerator
 
Codestrong 2012 breakout session what's new in titanium studio
Codestrong 2012 breakout session   what's new in titanium studioCodestrong 2012 breakout session   what's new in titanium studio
Codestrong 2012 breakout session what's new in titanium studio
Axway Appcelerator
 
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Codestrong 2012 breakout session   using appcelerator cloud services in your ...Codestrong 2012 breakout session   using appcelerator cloud services in your ...
Codestrong 2012 breakout session using appcelerator cloud services in your ...
Axway Appcelerator
 
Codestrong 2012 breakout session the role of cloud services in your next ge...
Codestrong 2012 breakout session   the role of cloud services in your next ge...Codestrong 2012 breakout session   the role of cloud services in your next ge...
Codestrong 2012 breakout session the role of cloud services in your next ge...
Axway Appcelerator
 
Codestrong 2012 breakout session new device platform support for titanium
Codestrong 2012 breakout session   new device platform support for titaniumCodestrong 2012 breakout session   new device platform support for titanium
Codestrong 2012 breakout session new device platform support for titanium
Axway Appcelerator
 
Codestrong 2012 breakout session mobile platform and infrastructure
Codestrong 2012 breakout session   mobile platform and infrastructureCodestrong 2012 breakout session   mobile platform and infrastructure
Codestrong 2012 breakout session mobile platform and infrastructure
Axway Appcelerator
 
Codestrong 2012 breakout session making money on appcelerator's marketplace
Codestrong 2012 breakout session   making money on appcelerator's marketplaceCodestrong 2012 breakout session   making money on appcelerator's marketplace
Codestrong 2012 breakout session making money on appcelerator's marketplace
Axway Appcelerator
 
Codestrong 2012 breakout session live multi-platform testing
Codestrong 2012 breakout session   live multi-platform testingCodestrong 2012 breakout session   live multi-platform testing
Codestrong 2012 breakout session live multi-platform testing
Axway Appcelerator
 
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Codestrong 2012 breakout session   leveraging titanium as part of your mobile...Codestrong 2012 breakout session   leveraging titanium as part of your mobile...
Codestrong 2012 breakout session leveraging titanium as part of your mobile...
Axway Appcelerator
 
Codestrong 2012 breakout session i os internals and best practices
Codestrong 2012 breakout session   i os internals and best practicesCodestrong 2012 breakout session   i os internals and best practices
Codestrong 2012 breakout session i os internals and best practices
Axway Appcelerator
 
Ad

Recently uploaded (20)

Understanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdfUnderstanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdf
Fulcrum Concepts, LLC
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
accessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electricaccessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electric
UXPA Boston
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Best 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat PlatformsBest 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat Platforms
Soulmaite
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdfGoogle DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
derrickjswork
 
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Gary Arora
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
UXPA Boston
 
Top Hyper-Casual Game Studio Services
Top  Hyper-Casual  Game  Studio ServicesTop  Hyper-Casual  Game  Studio Services
Top Hyper-Casual Game Studio Services
Nova Carter
 
Understanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdfUnderstanding SEO in the Age of AI.pdf
Understanding SEO in the Age of AI.pdf
Fulcrum Concepts, LLC
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
accessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electricaccessibility Considerations during Design by Rick Blair, Schneider Electric
accessibility Considerations during Design by Rick Blair, Schneider Electric
UXPA Boston
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Best 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat PlatformsBest 10 Free AI Character Chat Platforms
Best 10 Free AI Character Chat Platforms
Soulmaite
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdfGoogle DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
derrickjswork
 
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Harmonizing Multi-Agent Intelligence | Open Data Science Conference | Gary Ar...
Gary Arora
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
May Patch Tuesday
May Patch TuesdayMay Patch Tuesday
May Patch Tuesday
Ivanti
 
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdfICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
ICDCC 2025: Securing Agentic AI - Eryk Budi Pratama.pdf
Eryk Budi Pratama
 
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
UXPA Boston
 
Top Hyper-Casual Game Studio Services
Top  Hyper-Casual  Game  Studio ServicesTop  Hyper-Casual  Game  Studio Services
Top Hyper-Casual Game Studio Services
Nova Carter
 

Richard Salter: Using the Titanium OpenGL Module

  • 1. The Titanium OpenGL Module: Sophisticated Graphics for the Ti Programmer Richard Salter
  • 3. —  What is OpenGL? ◦  An API for managing a 3D graphics environment. –  not OO –  OpenGL “pipeline”
  • 4. —  Getting Ti/Javascript and OpenGL to play nicely together ◦  “Objectify” the OpenGL API with respect to a drawing surface –  Create a natural extension to the Titanium object model. –  Ti.OpenGL.View ◦  Compensate for inefficiencies introduced by moving programming level to Javascript. –  Cope with the large volume of data associated with a given OpenGL model. –  Ti.OpenGL.DataBuffer
  • 6. var Ti.Opengl = require('Ti.OpenGL'); var view = Ti.Opengl.createView({ backgroundColor:"#aaa", top:0, left:0 width:’100%’, height:’100%’, }), —  Creates OpenGL context and view —  Initializes Framebuffers and Renderbuffers —  Optionally: can specify ◦  depthbuffer ◦  multisampling
  • 7. var squareVertices = [ (5, 33) (-.5, .33) -0.5, -0.33, 0.5, -0.33, -0.5, 0.33, 0.5, 0.33, (-.5, -.33) (5, -.33) ], var squareColors = [ 255, 255, 0, 255, 0, 255, 255, 255, 0, 0, 0, 0, 255, 0, 255, 255, ],
  • 8. view.setFrameBuffer(); view.clear(); view.glVertexPointer(2, Ti.Opengl.GL_FLOAT, 0, squareVertices); view.glColorPointer(4, Ti.Opengl.GL_UNSIGNED_BYTE, 0, squareColors); view.glEnableClientState(Ti.Opengl.GL_VERTEX_ARRAY); view.glEnableClientState(Ti.Opengl.GL_COLOR_ARRAY); view.glDrawArrays(Ti.Opengl.GL_TRIANGLE_STRIP, 0, 4); view.presentFrameBuffer() —  OpenGL convenience instructions ◦  setFrameBuffer/clear initialize framebuffer ◦  presentFrameBuffer submits framebuffer for rendering
  • 9. setInterval( function(e){ drawframe(view, new Date().getTime()); }, interval ); var drawframe = function(view, timestamp) { view.setFrameBuffer(); view.clear(); view.glLoadIdentity(); view.glTranslatef(0.0, Math.sin(mover.iterate(timestamp))/2.0, 0.0); view.glDrawArrays(Ti.Opengl.GL_TRIANGLE_STRIP, 0, 4); view.presentFrameBuffer(); };
  • 10. var vertexDB = Ti.Opengl.createDataBuffer({ data : Demo.data.squareVertices, type : Ti.Opengl.GL_FLOAT }); var colorDB = Ti.Opengl.createDataBuffer({ data : Demo.data.squareColors, type : Ti.Opengl.GL_UNSIGNED_BYTE }); —  A databuffer is a compact opaque representation of an array of data —  Databuffer properties ◦  data ◦  type ◦  size
  • 11. view.glVertexPointer(2, Ti.Opengl.GL_FLOAT, 0, vertexDB); view.glColorPointer(4, Ti.Opengl.GL_UNSIGNED_BYTE, 0, colorDB); —  Vertex Buffers ◦  Databuffers are also used as a bridge to facilitating greater efficiency through using OpenGL vertex buffers directly.
  • 12. —  Loading from files ◦  Easiest –  Use the pvrtc file format with glCompressedTexImage2D and a Ti.Filesystem.File argument ◦  Alternatively –  Use jpg, png, etc. with convenience function texImage2D and a Ti.Filesystem.File argument.
  • 13. —  Using a blob var txtr = Ti.Opengl.createTexture({ filter : Ti.Opengl.GL_LINEAR, view : opengl, image : blob }) —  To bind this texture: view.glBindTexture(Ti.Opengl.GL_TEXTURE_2D, txtr.name);
  • 14. —  Shaders ◦  Creating shader programs using Javascript –  reproduce Objective C template ◦  Matrix operations –  Build Javascript library –  Core animation matrix operations (Phase 3)
  • 15. —  Building reusable OpenGL abstractions ◦  VBBuffers : function(view, dataBufs) –  Returns 1 or 2 vertex buffers built from DataBuffers contained in dataBufs ◦  Shaders : function(vpath, fpath) –  Load and compile vertex and fragment shaders from files found at vpath and fpath ◦  defaultInit : function(view) –  Initializes view with a default orthographic projection, etc.
  • 16. —  (As many as we have time for)
  翻译: