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

View File

@@ -8,7 +8,7 @@ import {fragment, vertex} from '../webgl/texturereplay/defaultshader.js';
import Locations from '../webgl/texturereplay/defaultshader/Locations.js';
import WebGLReplay from '../webgl/Replay.js';
import _ol_webgl_ from '../../webgl.js';
import WebGLContext from '../../webgl/Context.js';
import {createTexture} from '../../webgl/Context.js';
/**
* @constructor
@@ -257,7 +257,7 @@ WebGLTextureReplay.prototype.createTextures = function(textures, images, texture
if (uid in texturePerImage) {
texture = texturePerImage[uid];
} else {
texture = WebGLContext.createTexture(
texture = createTexture(
gl, image, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE);
texturePerImage[uid] = texture;
}

View File

@@ -12,7 +12,7 @@ import RendererType from '../Type.js';
import WebGLLayerRenderer from '../webgl/Layer.js';
import _ol_transform_ from '../../transform.js';
import _ol_webgl_ from '../../webgl.js';
import WebGLContext from '../../webgl/Context.js';
import {createTexture} from '../../webgl/Context.js';
/**
* @constructor
@@ -88,7 +88,7 @@ WebGLImageLayerRenderer.prototype.createTexture_ = function(image) {
const imageElement = image.getImage();
const gl = this.mapRenderer.getGL();
return WebGLContext.createTexture(
return createTexture(
gl, imageElement, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE);
};

View File

@@ -314,9 +314,8 @@ WebGLContext.prototype.useProgram = function(program) {
* @param {number=} opt_wrapS wrapS.
* @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture.
* @private
*/
WebGLContext.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
function createTextureInternal(gl, opt_wrapS, opt_wrapT) {
const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
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;
};
}
/**
@@ -343,15 +342,15 @@ WebGLContext.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
* @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture.
*/
WebGLContext.createEmptyTexture = function(
export function createEmptyTexture(
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.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE,
null);
return texture;
};
}
/**
@@ -361,11 +360,12 @@ WebGLContext.createEmptyTexture = function(
* @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture.
*/
WebGLContext.createTexture = function(gl, image, opt_wrapS, opt_wrapT) {
const texture = WebGLContext.createTexture_(gl, opt_wrapS, opt_wrapT);
export function createTexture(gl, image, opt_wrapS, opt_wrapT) {
const texture = createTextureInternal(gl, opt_wrapS, opt_wrapT);
gl.texImage2D(
gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
return texture;
};
}
export default WebGLContext;