| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 define([ | 5 define([ |
| 6 'console', | 6 'console', |
| 7 'mojo/apps/js/bindings/connector', | 7 'mojo/apps/js/bindings/connector', |
| 8 'mojo/apps/js/bindings/core', | 8 'mojo/apps/js/bindings/core', |
| 9 'mojo/apps/js/bindings/gl', | 9 'mojo/apps/js/bindings/gl', |
| 10 'mojo/apps/js/bindings/threading', | 10 'mojo/apps/js/bindings/threading', |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 var pipe = core.createMessagePipe(); | 173 var pipe = core.createMessagePipe(); |
| 174 new connector.Connection(pipe.handle0, GLES2ClientImpl, gles2.GLES2Proxy); | 174 new connector.Connection(pipe.handle0, GLES2ClientImpl, gles2.GLES2Proxy); |
| 175 | 175 |
| 176 this.remote_.open(); | 176 this.remote_.open(); |
| 177 this.remote_.createGLES2Context(pipe.handle1); | 177 this.remote_.createGLES2Context(pipe.handle1); |
| 178 } | 178 } |
| 179 NativeViewportClientImpl.prototype = | 179 NativeViewportClientImpl.prototype = |
| 180 Object.create(nativeViewport.NativeViewportClientStub.prototype); | 180 Object.create(nativeViewport.NativeViewportClientStub.prototype); |
| 181 | 181 |
| 182 NativeViewportClientImpl.prototype.onCreated = function() { | 182 NativeViewportClientImpl.prototype.onCreated = function() { |
| 183 console.log(['NativeViewportClientImpl.prototype.OnCreated']); | 183 console.log('NativeViewportClientImpl.prototype.OnCreated'); |
| 184 }; | 184 }; |
| 185 NativeViewportClientImpl.prototype.didOpen = function() { | 185 NativeViewportClientImpl.prototype.didOpen = function() { |
| 186 console.log(['NativeViewportClientImpl.prototype.DidOpen']); | 186 console.log('NativeViewportClientImpl.prototype.DidOpen'); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 | 189 |
| 190 function GLES2ClientImpl(remote) { | 190 function GLES2ClientImpl(remote) { |
| 191 this.remote_ = remote; | 191 this.remote_ = remote; |
| 192 } | 192 } |
| 193 GLES2ClientImpl.prototype = | 193 GLES2ClientImpl.prototype = |
| 194 Object.create(gles2.GLES2ClientStub.prototype); | 194 Object.create(gles2.GLES2ClientStub.prototype); |
| 195 | 195 |
| 196 GLES2ClientImpl.prototype.didCreateContext = function(encoded, | 196 GLES2ClientImpl.prototype.didCreateContext = function(encoded, |
| 197 width, | 197 width, |
| 198 height) { | 198 height) { |
| 199 var gl = new gljs.Context(encoded, width, height); | 199 var gl = new gljs.Context(encoded, width, height); |
| 200 var program = loadProgram(gl); | 200 var program = loadProgram(gl); |
| 201 var positionLocation = gl.getAttribLocation(program, 'a_position'); | 201 var positionLocation = gl.getAttribLocation(program, 'a_position'); |
| 202 var mvpLocation = gl.getUniformLocation(program, 'u_mvpMatrix'); | 202 var mvpLocation = gl.getUniformLocation(program, 'u_mvpMatrix'); |
| 203 var numIndices = generateCube(gl); | 203 var numIndices = generateCube(gl); |
| 204 var mvpMatrix = new ESMatrix(); | 204 var mvpMatrix = new ESMatrix(); |
| 205 | 205 |
| 206 gl.clearColor(0, 0, 0, 0); | 206 gl.clearColor(0, 0, 0, 0); |
| 207 mvpMatrix.loadIdentity(); | 207 mvpMatrix.loadIdentity(); |
| 208 drawCube(gl, width, height, program, positionLocation, mvpLocation, | 208 drawCube(gl, width, height, program, positionLocation, mvpLocation, |
| 209 numIndices, mvpMatrix); | 209 numIndices, mvpMatrix); |
| 210 gl.swapBuffers(); | 210 gl.swapBuffers(); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 GLES2ClientImpl.prototype.contextLost = function() { | 213 GLES2ClientImpl.prototype.contextLost = function() { |
| 214 console.log(['GLES2ClientImpl.prototype.contextLost']); | 214 console.log('GLES2ClientImpl.prototype.contextLost'); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 | 217 |
| 218 return function(handle) { | 218 return function(handle) { |
| 219 new connector.Connection(handle, SampleApp, shell.ShellProxy); | 219 new connector.Connection(handle, SampleApp, shell.ShellProxy); |
| 220 }; | 220 }; |
| 221 }); | 221 }); |
| OLD | NEW |