SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
Use of shader on cocos2d

                  version cocos2d v2.0-rc1




12年7月13日金曜日
My Profile
                                                     FREE!




              •   xionchannel

              •   @ajinotataki

              •   Technical Artist
                                     ElectroMaster   HungryMaster
                                       0.18M DL       0.05M DL



12年7月13日金曜日
What does shader do?

              • To calculate Rendering effects by GPU
              • VertexShader and FragmentShader
              • Use of GLSL language on OpenGL
              • Shader arguments (e.g. Attribute, Uniform)

12年7月13日金曜日
Flow on OpenGL ES 2.0

                 glCreateShader()

                 glShaderSource()   glCreateProgram()

                glCompileShader()   glAttachShader()

                                     glLinkProgram()



              destructible later

                                                 Usable later
                                     glUseProgram()



12年7月13日金曜日
1. Create VertexShader, FragmentShader
                 objects by glCreateShader()
              2. Load shader program into object by
                 glShaderSource()
              3. Compile shader program by
                 glCompileShader()




12年7月13日金曜日
4. Create program object by
                 glCreateProgram()

              5. Attach shader program to program object
                 by glAttachShader()
                 ( At this time, you can destroy shader as object)

              6. Link shader program by glLinkProgram()
                 ( These steps are preprocessing )

              7. Apply shader program by glUseProgram()

12年7月13日金曜日
Use in cocos2d




12年7月13日金曜日
Flow on cocos2d 2.0
       self.shaderProgram = [[CCShaderCache sharedShaderCache]
                             programForKey:kCCShader_PositionTextureColor];


                   glCreateShader()

                   glShaderSource()                     glCreateProgram()

                   glCompileShader()                    glAttachShader()

                                                         glLinkProgram()


                      Destroy                                               Initialize



                                   CC_NODE_DRAW_SETUP();

                                       glUseProgram()                  draw


12年7月13日金曜日
Flow of initialization
       self.shaderProgram = [[CCShaderCache sharedShaderCache]
                             programForKey:kCCShader_PositionTextureColor];

        [CCShaderCache sharedShaderCache]

          [[CCShaderCache alloc] init];

              [self loadDefaultShaders];

               [[CCGLProgram alloc]
               initWithVertexShaderByteArray:fragmentShaderByteArray:];

                      glCreateShader()              glCreateProgram()
                      glShaderSource()               glAttachShader()
                      glCompileShader()           Preparation of Attribute,
                                                          Uniform

                                  Destroy             glLinkProgram()




12年7月13日金曜日
Flow of initialization

              1. Call [CCShaderCache sharedShaderCache]

              2. In step1, call [[CCShaderCache alloc] init]

              3. In step 2, call [self loadDefaultShaders]

              4. In step 3, call [[CCGLProgram alloc]
                 initWithVertexShaderByteArray:
                 fragmentShaderByteArray: ], to compile shader
                 and keep them in array.



12年7月13日金曜日
5. Prepare identifiers of Attribute for Uniform
                 ( see updateUniforms() )

              6. Link shader program and destroy programs that
                 are created by step4.

              7. Identifiers (e.g. attribute, uniform) pass
                 self.shaderProgram which is a part of CCNode.
                 This is due to cocos2d using shaders for
                 CCNode that are kept in array by step4.



12年7月13日金曜日
Flow of drawing
       CC_NODE_DRAW_SETUP();


                       glUseProgram()

                         glUniform*()         Update dynamic uniform



                      glBindTexture2d()       Specify texture

                    glVertexAttribPointer()   Specify attribute positions

                       glDrawArrays()         Draw polygons




12年7月13日金曜日
Flow of drawing


              1. In CC_NODE_DRAW_SETUP() macro,
                 execute glUseProgram(). Enable to use shader.
              2. Update dynamic Uniform parameters.
              3. Bind texture.
              4. Setup positions of Attribute parameters.
              5. Draw polygons.




12年7月13日金曜日
Attribute, Uniform

              • Attribute is parameter for VertexShader.
                ★ Requires the number of vertexes data.
                  (vertex positions, normal vectors, vertex colors)

              • Uniform is parameter of both sides.
                ★ does not require the number of pixels
                  data.
                ★ Same data for all pixels.
                  (Texture, value of calculation)



12年7月13日金曜日
How to use our original
               shader on cocos2d?



12年7月13日金曜日
Modify-initialize method
       self.shaderProgram = [[CCShaderCache sharedShaderCache]
                             programForKey:kCCShader_PositionTextureColor];

        [CCShaderCache sharedShaderCache]

          [[CCShaderCache alloc] init];             Replace with our original code.
              [self loadDefaultShaders];

               [[CCGLProgram alloc]
               initWithVertexShaderByteArray:fragmentShaderByteArray:];

                      glCreateShader()              glCreateProgram()
                      glShaderSource()               glAttachShader()
                      glCompileShader()           Preparation of Attribute,
                                                          Uniform

                                  Destroy             glLinkProgram()




12年7月13日金曜日
Modify-draw method
       CC_NODE_DRAW_SETUP();
                                                                              Specify texture

                       glUseProgram()                                         Specify attribute positi

                         glUniform*()         Update dynamic uniform          Draw polygons




                         glUniform*()         Add code that updates our original dynamic
      この辺に自                                   uniform.
       Add our
      前パラメー
        original      glBindTexture2d()       Bind texture. And also add others you want to use.
      parameters
       タを追加                                   Specify attribute positions. And also add others
                    glVertexAttribPointer()
                                              that you want to use.

                       glDrawArrays()         Draw polygons.




12年7月13日金曜日
Demo




12年7月13日金曜日
e.g. Directional lighting by using normal mapping.



12年7月13日金曜日
e.g. Point lighting by using normal mapping.



12年7月13日金曜日
GLSL references

              •   Reference site( 床井研究室 )
                  http://marina.sys.wakayama-u.ac.jp/~tokoi/?
                  date=20051006
              •   Today’s source code
                  http://xionchannel.no-ip.org/
                  cocos2d_shaderTest.zip
              •   Today’s keynote
                  http://xionchannel.no-ip.org/
                  cocos2dShader20120621.pdf



12年7月13日金曜日
Special Thanks(Translation correction)

                 Tomohisa Takaoka http://twitter.com/tomohisa
               Nicholas Salerno at http://salernodesignstudio.com/




12年7月13日金曜日

Mais conteúdo relacionado

Semelhante a Cocos2dshader devcon jp_20120621_en

はじめてのぽりごん
はじめてのぽりごんはじめてのぽりごん
はじめてのぽりごんnaohito maeda
 
Cocos2d x-sprite3d
Cocos2d x-sprite3dCocos2d x-sprite3d
Cocos2d x-sprite3daktsk
 
3DCG(3Dコンピュータグラフィック)をWebGLで始めよう
3DCG(3Dコンピュータグラフィック)をWebGLで始めよう3DCG(3Dコンピュータグラフィック)をWebGLで始めよう
3DCG(3Dコンピュータグラフィック)をWebGLで始めようAdvancedTechNight
 
Flashup13 Basic Training of Flare3D
Flashup13 Basic Training of Flare3DFlashup13 Basic Training of Flare3D
Flashup13 Basic Training of Flare3DKatsushi Suzuki
 
cocos2d-xにおけるBox2Dの利用方法および便利なツール
cocos2d-xにおけるBox2Dの利用方法および便利なツールcocos2d-xにおけるBox2Dの利用方法および便利なツール
cocos2d-xにおけるBox2Dの利用方法および便利なツールTomoaki Shimizu
 
GameKitを使ったBluetoothプログラミング
GameKitを使ったBluetoothプログラミングGameKitを使ったBluetoothプログラミング
GameKitを使ったBluetoothプログラミングtaiko19xx
 
Three.jsで3D気分
Three.jsで3D気分 Three.jsで3D気分
Three.jsで3D気分 Toshio Ehara
 
Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法
Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法
Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法Hiroshi Yoshida
 
Groovyで楽にSQLを実行してみよう
Groovyで楽にSQLを実行してみようGroovyで楽にSQLを実行してみよう
Groovyで楽にSQLを実行してみようAkira Shimosako
 
㉒初期プロジェクトを改造!
㉒初期プロジェクトを改造!㉒初期プロジェクトを改造!
㉒初期プロジェクトを改造!Nishida Kansuke
 
Gws 20130315 gradle_handson
Gws 20130315 gradle_handsonGws 20130315 gradle_handson
Gws 20130315 gradle_handsonNobuhiro Sue
 
3次元図形をSchemeで造ろう!
3次元図形をSchemeで造ろう!3次元図形をSchemeで造ろう!
3次元図形をSchemeで造ろう!vi-iv
 
MacRubyとHotCocoaでMacのアプリを作ってみた
MacRubyとHotCocoaでMacのアプリを作ってみたMacRubyとHotCocoaでMacのアプリを作ってみた
MacRubyとHotCocoaでMacのアプリを作ってみたYukimitsu Izawa
 
Groovy base gradle_20130309
Groovy base gradle_20130309Groovy base gradle_20130309
Groovy base gradle_20130309Nobuhiro Sue
 
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_cccPivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_cccMasatoshi Tada
 
Eclipse ADTとAndroidStudio両方で動かせる開発環境構築
Eclipse ADTとAndroidStudio両方で動かせる開発環境構築Eclipse ADTとAndroidStudio両方で動かせる開発環境構築
Eclipse ADTとAndroidStudio両方で動かせる開発環境構築kimukou_26 Kimukou
 
Windows 8 ストア アプリ 開発 Tips
Windows 8 ストア アプリ 開発 TipsWindows 8 ストア アプリ 開発 Tips
Windows 8 ストア アプリ 開発 TipsFujio Kojima
 

Semelhante a Cocos2dshader devcon jp_20120621_en (20)

Cocos2d Shaders
Cocos2d ShadersCocos2d Shaders
Cocos2d Shaders
 
はじめてのぽりごん
はじめてのぽりごんはじめてのぽりごん
はじめてのぽりごん
 
Cocos2d x-sprite3d
Cocos2d x-sprite3dCocos2d x-sprite3d
Cocos2d x-sprite3d
 
3DCG(3Dコンピュータグラフィック)をWebGLで始めよう
3DCG(3Dコンピュータグラフィック)をWebGLで始めよう3DCG(3Dコンピュータグラフィック)をWebGLで始めよう
3DCG(3Dコンピュータグラフィック)をWebGLで始めよう
 
Flashup13 Basic Training of Flare3D
Flashup13 Basic Training of Flare3DFlashup13 Basic Training of Flare3D
Flashup13 Basic Training of Flare3D
 
cocos2d-xにおけるBox2Dの利用方法および便利なツール
cocos2d-xにおけるBox2Dの利用方法および便利なツールcocos2d-xにおけるBox2Dの利用方法および便利なツール
cocos2d-xにおけるBox2Dの利用方法および便利なツール
 
GameKitを使ったBluetoothプログラミング
GameKitを使ったBluetoothプログラミングGameKitを使ったBluetoothプログラミング
GameKitを使ったBluetoothプログラミング
 
Three.jsで3D気分
Three.jsで3D気分 Three.jsで3D気分
Three.jsで3D気分
 
Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法
Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法
Android上での3D(OpenGL)描画の基礎とNDKによる実践的高速化手法
 
Web GLの話
Web GLの話Web GLの話
Web GLの話
 
Dsl&Builder
Dsl&BuilderDsl&Builder
Dsl&Builder
 
Groovyで楽にSQLを実行してみよう
Groovyで楽にSQLを実行してみようGroovyで楽にSQLを実行してみよう
Groovyで楽にSQLを実行してみよう
 
㉒初期プロジェクトを改造!
㉒初期プロジェクトを改造!㉒初期プロジェクトを改造!
㉒初期プロジェクトを改造!
 
Gws 20130315 gradle_handson
Gws 20130315 gradle_handsonGws 20130315 gradle_handson
Gws 20130315 gradle_handson
 
3次元図形をSchemeで造ろう!
3次元図形をSchemeで造ろう!3次元図形をSchemeで造ろう!
3次元図形をSchemeで造ろう!
 
MacRubyとHotCocoaでMacのアプリを作ってみた
MacRubyとHotCocoaでMacのアプリを作ってみたMacRubyとHotCocoaでMacのアプリを作ってみた
MacRubyとHotCocoaでMacのアプリを作ってみた
 
Groovy base gradle_20130309
Groovy base gradle_20130309Groovy base gradle_20130309
Groovy base gradle_20130309
 
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_cccPivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
Pivotal認定講師によるSpring Framework 5.1 & Spring Boot 2.1ハンズオン! #jjug_ccc
 
Eclipse ADTとAndroidStudio両方で動かせる開発環境構築
Eclipse ADTとAndroidStudio両方で動かせる開発環境構築Eclipse ADTとAndroidStudio両方で動かせる開発環境構築
Eclipse ADTとAndroidStudio両方で動かせる開発環境構築
 
Windows 8 ストア アプリ 開発 Tips
Windows 8 ストア アプリ 開発 TipsWindows 8 ストア アプリ 開発 Tips
Windows 8 ストア アプリ 開発 Tips
 

Último

論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 

Último (9)

論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 

Cocos2dshader devcon jp_20120621_en

  • 1. Use of shader on cocos2d version cocos2d v2.0-rc1 12年7月13日金曜日
  • 2. My Profile FREE! • xionchannel • @ajinotataki • Technical Artist ElectroMaster HungryMaster 0.18M DL 0.05M DL 12年7月13日金曜日
  • 3. What does shader do? • To calculate Rendering effects by GPU • VertexShader and FragmentShader • Use of GLSL language on OpenGL • Shader arguments (e.g. Attribute, Uniform) 12年7月13日金曜日
  • 4. Flow on OpenGL ES 2.0 glCreateShader() glShaderSource() glCreateProgram() glCompileShader() glAttachShader() glLinkProgram() destructible later Usable later glUseProgram() 12年7月13日金曜日
  • 5. 1. Create VertexShader, FragmentShader objects by glCreateShader() 2. Load shader program into object by glShaderSource() 3. Compile shader program by glCompileShader() 12年7月13日金曜日
  • 6. 4. Create program object by glCreateProgram() 5. Attach shader program to program object by glAttachShader() ( At this time, you can destroy shader as object) 6. Link shader program by glLinkProgram() ( These steps are preprocessing ) 7. Apply shader program by glUseProgram() 12年7月13日金曜日
  • 8. Flow on cocos2d 2.0 self.shaderProgram = [[CCShaderCache sharedShaderCache] programForKey:kCCShader_PositionTextureColor]; glCreateShader() glShaderSource() glCreateProgram() glCompileShader() glAttachShader() glLinkProgram() Destroy Initialize CC_NODE_DRAW_SETUP(); glUseProgram() draw 12年7月13日金曜日
  • 9. Flow of initialization self.shaderProgram = [[CCShaderCache sharedShaderCache] programForKey:kCCShader_PositionTextureColor]; [CCShaderCache sharedShaderCache] [[CCShaderCache alloc] init]; [self loadDefaultShaders]; [[CCGLProgram alloc] initWithVertexShaderByteArray:fragmentShaderByteArray:]; glCreateShader() glCreateProgram() glShaderSource() glAttachShader() glCompileShader() Preparation of Attribute, Uniform Destroy glLinkProgram() 12年7月13日金曜日
  • 10. Flow of initialization 1. Call [CCShaderCache sharedShaderCache] 2. In step1, call [[CCShaderCache alloc] init] 3. In step 2, call [self loadDefaultShaders] 4. In step 3, call [[CCGLProgram alloc] initWithVertexShaderByteArray: fragmentShaderByteArray: ], to compile shader and keep them in array. 12年7月13日金曜日
  • 11. 5. Prepare identifiers of Attribute for Uniform ( see updateUniforms() ) 6. Link shader program and destroy programs that are created by step4. 7. Identifiers (e.g. attribute, uniform) pass self.shaderProgram which is a part of CCNode. This is due to cocos2d using shaders for CCNode that are kept in array by step4. 12年7月13日金曜日
  • 12. Flow of drawing CC_NODE_DRAW_SETUP(); glUseProgram() glUniform*() Update dynamic uniform glBindTexture2d() Specify texture glVertexAttribPointer() Specify attribute positions glDrawArrays() Draw polygons 12年7月13日金曜日
  • 13. Flow of drawing 1. In CC_NODE_DRAW_SETUP() macro, execute glUseProgram(). Enable to use shader. 2. Update dynamic Uniform parameters. 3. Bind texture. 4. Setup positions of Attribute parameters. 5. Draw polygons. 12年7月13日金曜日
  • 14. Attribute, Uniform • Attribute is parameter for VertexShader. ★ Requires the number of vertexes data. (vertex positions, normal vectors, vertex colors) • Uniform is parameter of both sides. ★ does not require the number of pixels data. ★ Same data for all pixels. (Texture, value of calculation) 12年7月13日金曜日
  • 15. How to use our original shader on cocos2d? 12年7月13日金曜日
  • 16. Modify-initialize method self.shaderProgram = [[CCShaderCache sharedShaderCache] programForKey:kCCShader_PositionTextureColor]; [CCShaderCache sharedShaderCache] [[CCShaderCache alloc] init]; Replace with our original code. [self loadDefaultShaders]; [[CCGLProgram alloc] initWithVertexShaderByteArray:fragmentShaderByteArray:]; glCreateShader() glCreateProgram() glShaderSource() glAttachShader() glCompileShader() Preparation of Attribute, Uniform Destroy glLinkProgram() 12年7月13日金曜日
  • 17. Modify-draw method CC_NODE_DRAW_SETUP(); Specify texture glUseProgram() Specify attribute positi glUniform*() Update dynamic uniform Draw polygons glUniform*() Add code that updates our original dynamic この辺に自 uniform. Add our 前パラメー original glBindTexture2d() Bind texture. And also add others you want to use. parameters タを追加 Specify attribute positions. And also add others glVertexAttribPointer() that you want to use. glDrawArrays() Draw polygons. 12年7月13日金曜日
  • 19. e.g. Directional lighting by using normal mapping. 12年7月13日金曜日
  • 20. e.g. Point lighting by using normal mapping. 12年7月13日金曜日
  • 21. GLSL references • Reference site( 床井研究室 ) http://marina.sys.wakayama-u.ac.jp/~tokoi/? date=20051006 • Today’s source code http://xionchannel.no-ip.org/ cocos2d_shaderTest.zip • Today’s keynote http://xionchannel.no-ip.org/ cocos2dShader20120621.pdf 12年7月13日金曜日
  • 22. Special Thanks(Translation correction) Tomohisa Takaoka http://twitter.com/tomohisa Nicholas Salerno at http://salernodesignstudio.com/ 12年7月13日金曜日