mirror of
https://github.com/photonstorm/phaser
synced 2025-02-01 06:43:35 +00:00
Removed the read of constant values from the WebGLRenderingContext object. Now they are read from an instance of webgl context.
This commit is contained in:
parent
50c79c14af
commit
abfe7536e9
3 changed files with 13 additions and 12 deletions
|
@ -97,10 +97,11 @@ module.exports = {
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} attributes - [description]
|
||||
* @param {WebGLRenderingContext} glContext - [description]
|
||||
*
|
||||
* @return {number} [description]
|
||||
*/
|
||||
getComponentCount: function (attributes)
|
||||
getComponentCount: function (attributes, glContext)
|
||||
{
|
||||
var count = 0;
|
||||
|
||||
|
@ -108,7 +109,7 @@ module.exports = {
|
|||
{
|
||||
var element = attributes[index];
|
||||
|
||||
if (element.type === WebGLRenderingContext.FLOAT)
|
||||
if (element.type === glContext.FLOAT)
|
||||
{
|
||||
count += element.size;
|
||||
}
|
||||
|
|
|
@ -185,7 +185,7 @@ var WebGLPipeline = new Class({
|
|||
* @type {integer}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.vertexComponentCount = Utils.getComponentCount(config.attributes);
|
||||
this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl);
|
||||
|
||||
/**
|
||||
* Indicates if the current pipeline is flushing the contents to the GPU.
|
||||
|
|
|
@ -179,15 +179,6 @@ var WebGLRenderer = new Class({
|
|||
encoder: null
|
||||
};
|
||||
|
||||
for (var i = 0; i <= 16; i++)
|
||||
{
|
||||
this.blendModes.push({ func: [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ], equation: WebGLRenderingContext.FUNC_ADD });
|
||||
}
|
||||
|
||||
this.blendModes[1].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.DST_ALPHA ];
|
||||
this.blendModes[2].func = [ WebGLRenderingContext.DST_COLOR, WebGLRenderingContext.ONE_MINUS_SRC_ALPHA ];
|
||||
this.blendModes[3].func = [ WebGLRenderingContext.ONE, WebGLRenderingContext.ONE_MINUS_SRC_COLOR ];
|
||||
|
||||
// Internal Renderer State (Textures, Framebuffers, Pipelines, Buffers, etc)
|
||||
|
||||
/**
|
||||
|
@ -389,6 +380,15 @@ var WebGLRenderer = new Class({
|
|||
|
||||
this.gl = gl;
|
||||
|
||||
for (var i = 0; i <= 16; i++)
|
||||
{
|
||||
this.blendModes.push({ func: [ gl.ONE, gl.ONE_MINUS_SRC_ALPHA ], equation: gl.FUNC_ADD });
|
||||
}
|
||||
|
||||
this.blendModes[1].func = [ gl.ONE, gl.DST_ALPHA ];
|
||||
this.blendModes[2].func = [ gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA ];
|
||||
this.blendModes[3].func = [ gl.ONE, gl.ONE_MINUS_SRC_COLOR ];
|
||||
|
||||
// Load supported extensions
|
||||
this.supportedExtensions = gl.getSupportedExtensions();
|
||||
|
||||
|
|
Loading…
Reference in a new issue