Merge pull request #7815 from bjornharrtell/webgl-rm-private-statics

Remove private statics from webgl related modules
This commit is contained in:
Tim Schaub
2018-02-11 11:17:31 -07:00
committed by GitHub
3 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ import {fragment, vertex} from '../webgl/texturereplay/defaultshader.js';
import Locations from '../webgl/texturereplay/defaultshader/Locations.js'; import Locations from '../webgl/texturereplay/defaultshader/Locations.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import WebGLContext from '../../webgl/Context.js'; import {createTexture} from '../../webgl/Context.js';
/** /**
* @constructor * @constructor
@@ -257,7 +257,7 @@ WebGLTextureReplay.prototype.createTextures = function(textures, images, texture
if (uid in texturePerImage) { if (uid in texturePerImage) {
texture = texturePerImage[uid]; texture = texturePerImage[uid];
} else { } else {
texture = WebGLContext.createTexture( texture = createTexture(
gl, image, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE); gl, image, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE);
texturePerImage[uid] = texture; texturePerImage[uid] = texture;
} }
+2 -2
View File
@@ -12,7 +12,7 @@ import RendererType from '../Type.js';
import WebGLLayerRenderer from '../webgl/Layer.js'; import WebGLLayerRenderer from '../webgl/Layer.js';
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import WebGLContext from '../../webgl/Context.js'; import {createTexture} from '../../webgl/Context.js';
/** /**
* @constructor * @constructor
@@ -88,7 +88,7 @@ WebGLImageLayerRenderer.prototype.createTexture_ = function(image) {
const imageElement = image.getImage(); const imageElement = image.getImage();
const gl = this.mapRenderer.getGL(); const gl = this.mapRenderer.getGL();
return WebGLContext.createTexture( return createTexture(
gl, imageElement, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE); gl, imageElement, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE);
}; };
+9 -9
View File
@@ -314,9 +314,8 @@ WebGLContext.prototype.useProgram = function(program) {
* @param {number=} opt_wrapS wrapS. * @param {number=} opt_wrapS wrapS.
* @param {number=} opt_wrapT wrapT. * @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture. * @return {WebGLTexture} The texture.
* @private
*/ */
WebGLContext.createTexture_ = function(gl, opt_wrapS, opt_wrapT) { function createTextureInternal(gl, opt_wrapS, opt_wrapT) {
const texture = gl.createTexture(); const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture); gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
@@ -332,7 +331,7 @@ WebGLContext.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
} }
return texture; return texture;
}; }
/** /**
@@ -343,15 +342,15 @@ WebGLContext.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
* @param {number=} opt_wrapT wrapT. * @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture. * @return {WebGLTexture} The texture.
*/ */
WebGLContext.createEmptyTexture = function( export function createEmptyTexture(
gl, width, height, opt_wrapS, opt_wrapT) { gl, width, height, opt_wrapS, opt_wrapT) {
const texture = WebGLContext.createTexture_(gl, opt_wrapS, opt_wrapT); const texture = createTextureInternal(gl, opt_wrapS, opt_wrapT);
gl.texImage2D( gl.texImage2D(
gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE,
null); null);
return texture; return texture;
}; }
/** /**
@@ -361,11 +360,12 @@ WebGLContext.createEmptyTexture = function(
* @param {number=} opt_wrapT wrapT. * @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture. * @return {WebGLTexture} The texture.
*/ */
WebGLContext.createTexture = function(gl, image, opt_wrapS, opt_wrapT) { export function createTexture(gl, image, opt_wrapS, opt_wrapT) {
const texture = WebGLContext.createTexture_(gl, opt_wrapS, opt_wrapT); const texture = createTextureInternal(gl, opt_wrapS, opt_wrapT);
gl.texImage2D( gl.texImage2D(
gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
return texture; return texture;
}; }
export default WebGLContext; export default WebGLContext;