Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

weex-gcanvas

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weex-gcanvas - npm Package Compare versions

Comparing version 0.4.2 to 0.4.3

7

gcanvas.js

@@ -148,4 +148,3 @@ /**

config.push(GSupport.sameLevel);
GBridge.callEnable(el.ref,config,function(e){});
GCanvas.enableRet = GBridge.callEnable(el.ref, config);
var canvas = new GCanvas(el.ref);

@@ -182,3 +181,3 @@ GCanvas.canvasMap.put(el.ref, canvas);

if (contextID.match(/webgl/i)){
context = new GContextWebGL();
context = new GContextWebGL(GCanvas.enableRet);
context_type = 1;

@@ -237,3 +236,3 @@ }else{

fps = parseFloat(fps) || 16;
fps = parseInt(fps) || 16;
if(!this.context.timer){

@@ -240,0 +239,0 @@ this.context.timer = setInterval(this.render.bind(this),fps);

@@ -11,9 +11,2 @@ /////////////////////////////////////////////////////////////////

/*
WX_EXPORT_METHOD(@selector(render:componentId:));
WX_EXPORT_METHOD(@selector(preLoadImage:componentId:callback:));
WX_EXPORT_METHOD(@selector(setContextType:componentId:));
WX_EXPORT_METHOD(@selector(setLogLevel:componentId:));
WX_EXPORT_METHOD(@selector(resetComponent:));
*/
canvasModule = (typeof weex!=='undefined'&&weex.requireModule) ? ( weex.requireModule('gcanvas') ) : (__weex_require__('@weex-module/gcanvas') );

@@ -101,6 +94,9 @@

};
canvasModule.enable(params, function (e) {
GLog.d('bridge#callEnable() return val:' + JSON.stringify(e));
callback && callback(e);
});
return canvasModule.enable && canvasModule.enable(params);
// canvasModule.enable(params, function (e) {
// GLog.d('bridge#callEnable() return val:' + JSON.stringify(e));
// callback && callback(e);
// });
},

@@ -192,3 +188,4 @@

},
exeSyncCmd: function (action,args){
exeSyncCmd: function (componentId, action, args){
GLog.d('bridge#exeSyncCmd(): action: ' + action + ',args:' + args);

@@ -195,0 +192,0 @@ return canvasModule.execGcanvaSyncCMD(action,args);

var GBridge = require("./gutil").GBridge;
var GLog = require("./gutil").GLog;
var GCanvas = require("./gcanvas");
function GContextWebGL(){
function GContextWebGL(params){
GInitWebGLFuncId(this);
GInitWebGLEnum(this);
GInitWebGLParams(params);

@@ -36,12 +39,20 @@ this._drawCommands = "";

this.componentId = null;
}
function GInitWebGLParams(params)
{
// if( !params || params.length == 0 )
// return;
//////////////////////////////////////////////////////////////////////////
// var u8ar = Gbase64ToArr(params);
// GCanvas._glParams = new Int32Array(u8ar.buffer);
// console.log("GInitWebGLParams:"+GCanvas._glParams);
}
function GInitWebGLEnum(obj){
//////////////////////////////////////////////////////////////////////////
//GUtil.setConfig("encode_type", 1);
function GInitWebGLFuncId(obj){
var i=1;

@@ -179,136 +190,313 @@ obj.activeTextureId=(i++)+",";

//extension for OES_vertex_array_object
obj.bindVertexArrayOESId=(i++)+",";
obj.deleteVertexArraysOESId=(i++)+",";
obj.genVertexArraysOESId=(i++)+","
obj.isVertexArrayOESId=(i++)+","
}
obj.COMPILE_STATUS = 11;
function GInitWebGLEnum(obj){
//GL Constant Define
obj.NONE = 0x0;
obj.ONE = 0x1;
obj.LINE_LOOP = 0x2;
obj.LINE_STRIP = 0x3;
obj.TRIANGLES = 0x4;
obj.TRIANGLE_STRIP = 0x5;
obj.TRIANGLE_FAN = 0x6;
obj.DEPTH_BUFFER_BIT = 0x100;
obj.NEVER = 0x200;
obj.LESS = 0x201;
obj.EQUAL = 0x202;
obj.LEQUAL = 0x203;
obj.GREATER = 0x204;
obj.NOTEQUAL = 0x205;
obj.GEQUAL = 0x206;
obj.ALWAYS = 0x207;
obj.SRC_COLOR = 0x300;
obj.ONE_MINUS_SRC_COLOR = 0x301;
obj.SRC_ALPHA = 0x302;
obj.ONE_MINUS_SRC_ALPHA = 0x303;
obj.DST_ALPHA = 0x304;
obj.ONE_MINUS_DST_ALPHA = 0x305;
obj.DST_COLOR = 0x306;
obj.ONE_MINUS_DST_COLOR = 0x307;
obj.SRC_ALPHA_SATURATE = 0x308;
obj.STENCIL_BUFFER_BIT = 0x400;
obj.FRONT = 0x404;
obj.BACK = 0x405;
obj.FRONT_AND_BACK = 0x408;
obj.INVALID_ENUM = 0x500;
obj.INVALID_VALUE = 0x501;
obj.INVALID_OPERATION = 0x502;
obj.OUT_OF_MEMORY = 0x505;
obj.INVALID_FRAMEBUFFER_OPERATION = 0x506;
obj.CW = 0x900;
obj.CCW = 0x901;
obj.LINE_WIDTH = 0xB21;
obj.CULL_FACE = 0xB44;
obj.CULL_FACE_MODE = 0xB45;
obj.FRONT_FACE = 0xB46;
obj.DEPTH_RANGE = 0xB70;
obj.DEPTH_TEST = 0xB71;
obj.DEPTH_WRITEMASK = 0xB72;
obj.DEPTH_CLEAR_VALUE = 0xB73;
obj.DEPTH_FUNC = 0xB74;
obj.STENCIL_TEST = 0xB90;
obj.STENCIL_CLEAR_VALUE = 0xB91;
obj.STENCIL_FUNC = 0xB92;
obj.STENCIL_VALUE_MASK = 0xB93;
obj.STENCIL_FAIL = 0xB94;
obj.STENCIL_PASS_DEPTH_FAIL = 0xB95;
obj.STENCIL_PASS_DEPTH_PASS = 0xB96;
obj.STENCIL_REF = 0xB97;
obj.STENCIL_WRITEMASK = 0xB98;
obj.VIEWPORT = 0xBA2;
obj.DITHER = 0xBD0;
obj.BLEND = 0xBE2;
obj.SCISSOR_BOX = 0xC10;
obj.SCISSOR_TEST = 0xC11;
obj.COLOR_CLEAR_VALUE = 0xC22;
obj.COLOR_WRITEMASK = 0xC23;
obj.UNPACK_ALIGNMENT = 0xCF5;
obj.PACK_ALIGNMENT = 0xD05;
obj.MAX_TEXTURE_SIZE = 0xD33;
obj.MAX_VIEWPORT_DIMS = 0xD3A;
obj.SUBPIXEL_BITS = 0xD50;
obj.RED_BITS = 0xD52;
obj.GREEN_BITS = 0xD53;
obj.BLUE_BITS = 0xD54;
obj.ALPHA_BITS = 0xD55;
obj.DEPTH_BITS = 0xD56;
obj.STENCIL_BITS = 0xD57;
obj.TEXTURE_2D = 0xDE1;
obj.DONT_CARE = 0x1100;
obj.FASTEST = 0x1101;
obj.NICEST = 0x1102;
obj.BYTE = 0x1400;
obj.UNSIGNED_BYTE = 0x1401;
obj.SHORT = 0x1402;
obj.UNSIGNED_SHORT = 0x1403;
obj.INT = 0x1404;
obj.UNSIGNED_INT = 0x1405;
obj.FLOAT = 0x1406;
obj.INVERT = 0x150A;
obj.TEXTURE = 0x1702;
obj.STENCIL_INDEX = 0x1901;
obj.DEPTH_COMPONENT = 0x1902;
obj.ALPHA = 0x1906;
obj.RGB = 0x1907;
obj.RGBA = 0x1908;
obj.LUMINANCE = 0x1909;
obj.LUMINANCE_ALPHA = 0x190A;
obj.KEEP = 0x1E00;
obj.REPLACE = 0x1E01;
obj.INCR = 0x1E02;
obj.DECR = 0x1E03;
obj.VENDOR = 0x1F00;
obj.RENDERER = 0x1F01;
obj.VERSION = 0x1F02;
obj.NEAREST = 0x2600;
obj.LINEAR = 0x2601;
obj.NEAREST_MIPMAP_NEAREST = 0x2700;
obj.LINEAR_MIPMAP_NEAREST = 0x2701;
obj.NEAREST_MIPMAP_LINEAR = 0x2702;
obj.LINEAR_MIPMAP_LINEAR = 0x2703;
obj.TEXTURE_MAG_FILTER = 0x2800;
obj.TEXTURE_MIN_FILTER = 0x2801;
obj.TEXTURE_WRAP_S = 0x2802;
obj.TEXTURE_WRAP_T = 0x2803;
obj.REPEAT = 0x2901;
obj.POLYGON_OFFSET_UNITS = 0x2A00;
obj.COLOR_BUFFER_BIT = 0x4000;
obj.CONSTANT_COLOR = 0x8001;
obj.ONE_MINUS_CONSTANT_COLOR = 0x8002;
obj.CONSTANT_ALPHA = 0x8003;
obj.ONE_MINUS_CONSTANT_ALPHA = 0x8004;
obj.BLEND_COLOR = 0x8005;
obj.FUNC_ADD = 0x8006;
obj.BLEND_EQUATION_RGB = 0x8009;
obj.FUNC_SUBTRACT = 0x800A;
obj.FUNC_REVERSE_SUBTRACT = 0x800B;
obj.UNSIGNED_SHORT_4_4_4_4 = 0x8033;
obj.UNSIGNED_SHORT_5_5_5_1 = 0x8034;
obj.POLYGON_OFFSET_FILL = 0x8037;
obj.POLYGON_OFFSET_FACTOR = 0x8038;
obj.RGBA4 = 0x8056;
obj.RGB5_A1 = 0x8057;
obj.TEXTURE_BINDING_2D = 0x8069;
obj.SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
obj.SAMPLE_COVERAGE = 0x80A0;
obj.SAMPLE_BUFFERS = 0x80A8;
obj.SAMPLES = 0x80A9;
obj.SAMPLE_COVERAGE_VALUE = 0x80AA;
obj.SAMPLE_COVERAGE_INVERT = 0x80AB;
obj.BLEND_DST_RGB = 0x80C8;
obj.BLEND_SRC_RGB = 0x80C9;
obj.BLEND_DST_ALPHA = 0x80CA;
obj.BLEND_SRC_ALPHA = 0x80CB;
obj.CLAMP_TO_EDGE = 0x812F;
obj.GENERATE_MIPMAP_HINT = 0x8192;
obj.DEPTH_COMPONENT16 = 0x81A5;
obj.DEPTH_STENCIL_ATTACHMENT = 0x821A;
obj.UNSIGNED_SHORT_5_6_5 = 0x8363;
obj.MIRRORED_REPEAT = 0x8370;
obj.ALIASED_POINT_SIZE_RANGE = 0x846D;
obj.ALIASED_LINE_WIDTH_RANGE = 0x846E;
obj.TEXTURE0 = 0x84C0;
obj.TEXTURE1 = 0x84C1;
obj.TEXTURE2 = 0x84C2;
obj.TEXTURE3 = 0x84C3;
obj.TEXTURE4 = 0x84C4;
obj.TEXTURE5 = 0x84C5;
obj.TEXTURE6 = 0x84C6;
obj.TEXTURE7 = 0x84C7;
obj.TEXTURE8 = 0x84C8;
obj.TEXTURE9 = 0x84C9;
obj.TEXTURE10 = 0x84CA;
obj.TEXTURE11 = 0x84CB;
obj.TEXTURE12 = 0x84CC;
obj.TEXTURE13 = 0x84CD;
obj.TEXTURE14 = 0x84CE;
obj.TEXTURE15 = 0x84CF;
obj.TEXTURE16 = 0x84D0;
obj.TEXTURE17 = 0x84D1;
obj.TEXTURE18 = 0x84D2;
obj.TEXTURE19 = 0x84D3;
obj.TEXTURE20 = 0x84D4;
obj.TEXTURE21 = 0x84D5;
obj.TEXTURE22 = 0x84D6;
obj.TEXTURE23 = 0x84D7;
obj.TEXTURE24 = 0x84D8;
obj.TEXTURE25 = 0x84D9;
obj.TEXTURE26 = 0x84DA;
obj.TEXTURE27 = 0x84DB;
obj.TEXTURE28 = 0x84DC;
obj.TEXTURE29 = 0x84DD;
obj.TEXTURE30 = 0x84DE;
obj.TEXTURE31 = 0x84DF;
obj.ACTIVE_TEXTURE = 0x84E0;
obj.MAX_RENDERBUFFER_SIZE = 0x84E8;
obj.DEPTH_STENCIL = 0x84F9;
obj.INCR_WRAP = 0x8507;
obj.DECR_WRAP = 0x8508;
obj.TEXTURE_CUBE_MAP = 0x8513;
obj.TEXTURE_BINDING_CUBE_MAP = 0x8514;
obj.TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
obj.TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
obj.TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
obj.TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
obj.TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
obj.TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
obj.MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
obj.VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
obj.VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
obj.VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
obj.VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
obj.CURRENT_VERTEX_ATTRIB = 0x8626;
obj.VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
obj.NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
obj.COMPRESSED_TEXTURE_FORMATS = 0x86A3;
obj.BUFFER_SIZE = 0x8764;
obj.BUFFER_USAGE = 0x8765;
obj.STENCIL_BACK_FUNC = 0x8800;
obj.STENCIL_BACK_FAIL = 0x8801;
obj.STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
obj.STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
obj.BLEND_EQUATION_ALPHA = 0x883D;
obj.MAX_VERTEX_ATTRIBS = 0x8869;
obj.VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
obj.MAX_TEXTURE_IMAGE_UNITS = 0x8872;
obj.ARRAY_BUFFER = 0x8892;
obj.ELEMENT_ARRAY_BUFFER = 0x8893;
obj.ARRAY_BUFFER_BINDING = 0x8894;
obj.ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
obj.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
obj.STREAM_DRAW = 0x88E0;
obj.STATIC_DRAW = 0x88E4;
obj.DYNAMIC_DRAW = 0x88E8;
obj.FRAGMENT_SHADER = 0x8B30;
obj.VERTEX_SHADER = 0x8B31;
obj.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
obj.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
obj.SHADER_TYPE = 0x8B4F;
obj.FLOAT_VEC2 = 0x8B50;
obj.FLOAT_VEC3 = 0x8B51;
obj.FLOAT_VEC4 = 0x8B52;
obj.INT_VEC2 = 0x8B53;
obj.INT_VEC3 = 0x8B54;
obj.INT_VEC4 = 0x8B55;
obj.BOOL = 0x8B56;
obj.BOOL_VEC2 = 0x8B57;
obj.BOOL_VEC3 = 0x8B58;
obj.BOOL_VEC4 = 0x8B59;
obj.FLOAT_MAT2 = 0x8B5A;
obj.FLOAT_MAT3 = 0x8B5B;
obj.FLOAT_MAT4 = 0x8B5C;
obj.SAMPLER_2D = 0x8B5E;
obj.SAMPLER_CUBE = 0x8B60;
obj.DELETE_STATUS = 0x8B80;
obj.COMPILE_STATUS = 0x8B81;
obj.LINK_STATUS = 0x8B82;
obj.VALIDATE_STATUS = 0x8B83;
obj.INFO_LOG_LENGTH = 0x8B84;
obj.ATTACHED_SHADERS = 0x8B85;
obj.ACTIVE_UNIFORMS = 0x8B86;
obj.ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87;
obj.SHADER_SOURCE_LENGTH = 0x8B88;
obj.ACTIVE_ATTRIBUTES = 0x8B89;
obj.ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A;
obj.SHADING_LANGUAGE_VERSION = 0x8B8C;
obj.CURRENT_PROGRAM = 0x8B8D;
obj.STENCIL_BACK_REF = 0x8CA3;
obj.STENCIL_BACK_VALUE_MASK = 0x8CA4;
obj.STENCIL_BACK_WRITEMASK = 0x8CA5;
obj.FRAMEBUFFER_BINDING = 0x8CA6;
obj.RENDERBUFFER_BINDING = 0x8CA7;
obj.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
obj.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
obj.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
obj.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
obj.FRAMEBUFFER_COMPLETE = 0x8CD5;
obj.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
obj.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
obj.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
obj.FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
obj.COLOR_ATTACHMENT0 = 0x8CE0;
obj.DEPTH_ATTACHMENT = 0x8D00;
obj.STENCIL_ATTACHMENT = 0x8D20;
obj.FRAMEBUFFER = 0x8D40;
obj.RENDERBUFFER = 0x8D41;
obj.RENDERBUFFER_WIDTH = 0x8D42;
obj.RENDERBUFFER_HEIGHT = 0x8D43;
obj.RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
obj.STENCIL_INDEX8 = 0x8D48;
obj.RENDERBUFFER_RED_SIZE = 0x8D50;
obj.RENDERBUFFER_GREEN_SIZE = 0x8D51;
obj.RENDERBUFFER_BLUE_SIZE = 0x8D52;
obj.RENDERBUFFER_ALPHA_SIZE = 0x8D53;
obj.RENDERBUFFER_DEPTH_SIZE = 0x8D54;
obj.RENDERBUFFER_STENCIL_SIZE = 0x8D55;
obj.RGB565 = 0x8D62;
obj.LOW_FLOAT = 0x8DF0;
obj.MEDIUM_FLOAT = 0x8DF1;
obj.HIGH_FLOAT = 0x8DF2;
obj.LOW_INT = 0x8DF3;
obj.MEDIUM_INT = 0x8DF4;
obj.HIGH_INT = 0x8DF5;
obj.SHADER_COMPILER = 0x8DFA;
obj.MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
obj.MAX_VARYING_VECTORS = 0x8DFC;
obj.MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
obj.DEPTH_BUFFER_BIT=1;
obj.STENCIL_BUFFER_BIT=2;
obj.COLOR_BUFFER_BIT=4;
obj.UNPACK_FLIP_Y_WEBGL = 0x9240;
// obj.UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
// obj.CONTEXT_LOST_WEBGL = 0x9242;
// obj.UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
// obj.BROWSER_DEFAULT_WEBGL = 0x9244;
//used for:texParameteri
//native variable:s_texture_target
obj.TEXTURE_2D=0;
obj.TEXTURE_CUBE_MAP=1;
obj.TEXTURE_CUBE_MAP_POSITIVE_X=1;
obj.TEXTURE_CUBE_MAP_NEGATIVE_X=2;
obj.TEXTURE_CUBE_MAP_POSITIVE_Y=3;
obj.TEXTURE_CUBE_MAP_NEGATIVE_Y=4;
obj.TEXTURE_CUBE_MAP_POSITIVE_Z=5;
obj.TEXTURE_CUBE_MAP_NEGATIVE_Z=6;
i=0;
obj.VERTEX_SHADER = i++;//
obj.FRAGMENT_SHADER = i++;
obj.ARRAY_BUFFER = i++;//
obj.ELEMENT_ARRAY_BUFFER=i++;
obj.FLOAT = i++;//
obj.FIXED = i++;
obj.POINTS=i++;//
obj.LINES=i++;
obj.LINE_STRIP=i++;
obj.LINE_LOOP=i++;
obj.TRIANGLES=i++;
obj.TRIANGLE_STRIP=i++;
obj.TRIANGLE_FAN=i++;
obj.STREAM_DRAW=i++;//
obj.STATIC_DRAW=i++;
obj.DYNAMIC_DRAW=i++;
obj.UNSIGNED_BYTE=i++;//
obj.UNSIGNED_SHORT = i++;
obj.CW=i++;//
obj.CCW=i++;
obj.FRONT = i++;//
obj.BACK=i++;
obj.FRONT_AND_BACK=i++;
obj.NEVER=i++;//
obj.LESS=i++;
obj.EQUAL=i++;
obj.LEQUAL=i++;
obj.GREATER=i++;
obj.NOTEQUAL=i++;
obj.GEQUAL=i++;
obj.ALWAYS=i++;
obj.BLEND=i++;//
obj.CULL_FACE=i++;
obj.DEPTH_TEST=i++;
obj.POLYGON_OFFSET_FILL=i++;
obj.SCISSOR_TEST=i++;
obj.NEAREST=i++;//
obj.LINEAR=i++;
obj.NEAREST_MIPMAP_NEAREST=i++;
obj.LINEAR_MIPMAP_NEAREST=i++;
obj.NEAREST_MIPMAP_LINEAR=i++;
obj.LINEAR_MIPMAP_LINEAR=i++;
obj.REPEAT=i++;
obj.CLAMP_TO_EDGE=i++;
obj.MIRRORED_REPEAT=i++;
obj.ZERO=i++;//func:blendFunc
obj.ONE=i++;
obj.SRC_COLOR=i++;
obj.DST_COLOR=i++;
obj.SRC_ALPHA=i++;
obj.DST_ALPHA=i++;
obj.ONE_MINUS_SRC_COLOR=i++;
obj.ONE_MINUS_DST_COLOR=i++;
obj.ONE_MINUS_SRC_ALPHA=i++;
obj.ONE_MINUS_DST_ALPHA=i++;
obj.SRC_ALPHA_SATURATE=i++;
obj.FUNC_ADD=i++;//
obj.FUNC_SUBTRACT=i++;
obj.FUNC_REVERSE_SUBTRACT=i++;
obj.ALPHA=i++;//
obj.LUMINANCE=i++;
obj.LUMINANCE_ALPHA=i++;
obj.RGB=i++;
obj.RGBA=i++;
obj.TEXTURE_MIN_FILTER=i++;//
obj.TEXTURE_MAG_FILTER=i++;
obj.TEXTURE_WRAP_S=i++;
obj.TEXTURE_WRAP_T=i++;
obj.RGBA4=i++;//
obj.RGB565=i++;
obj.RGB5_A1=i++;
obj.DEPTH_COMPONENT16=i++;
obj.DEPTH_STENCIL=i++;
obj.COLOR_ATTACHMENT0=i++;//
obj.DEPTH_ATTACHMENT=i++;
obj.STENCIL_ATTACHMENT=i++;
obj.DEPTH_STENCIL_ATTACHMENT=i++;
obj.TEXTURE0=i++;//
obj.TEXTURE1=i++;
obj.TEXTURE2=i++;
obj.TEXTURE3=i++;
obj.TEXTURE4=i++;
obj.TEXTURE5=i++;
obj.TEXTURE6=i++;
obj.TEXTURE7=i++;
obj.TEXTURE8=i++;
obj.TEXTURE9=i++;
obj.TEXTURE10=i++;
obj.TEXTURE11=i++;
obj.TEXTURE12=i++;
obj.TEXTURE13=i++;
obj.TEXTURE14=i++;
obj.TEXTURE15=i++;
obj.TEXTURE16=i++;
obj.TEXTURE17=i++;
obj.TEXTURE18=i++;
obj.TEXTURE19=i++;
obj.TEXTURE20=i++;
obj.TEXTURE21=i++;
obj.TEXTURE22=i++;
obj.TEXTURE23=i++;
obj.TEXTURE24=i++;
obj.TEXTURE25=i++;
obj.TEXTURE26=i++;
obj.TEXTURE27=i++;
obj.TEXTURE28=i++;
obj.TEXTURE29=i++;
obj.TEXTURE30=i++;
obj.TEXTURE31=i++;
obj.GL_ACTIVE_TEXTURE=i++;
obj.PACK_ALIGNMENT=i++;
obj.UNPACK_ALIGNMENT=i++;
obj.UNPACK_FLIP_Y_WEBGL=i++;
//extsion
obj.OES_vertex_array_object = 1;
obj.OES_texture_float = 1;
obj.OES_element_index_uint = 1;
}

@@ -365,13 +553,43 @@

//todo
function GarrToBase64(buffer) {
var binary = ''
//var bytes = new Uint8Array( buffer );
var bytes = new Array(buffer);
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] )
function GarrToBase64(array)
{
var str = '';
if( array.join === 'function' )
{
str = array.join();
}
return btoa( binary );
else
{
for (var i = 0; i < array.length; i++)
{
if( i < array.length - 1 )
{
str = str + array[i] + ',';
}
else
{
str = str + array[i];
}
}
}
GLog.d("GarrToBase64(), before: "+ str);
GLog.d("GarrToBase64(), after : "+ btoa(str));
return btoa(str);
}
function Gbase64ToArr(base64)
{
GLog.d("base64:" + base64);
var binary_string = atob(base64);
GLog.d("binary_string:" + binary_string);
var array = binary_string.slice();
return array;
// var len = binary_string.length;
// var bytes = new Uint8Array( len );
// for (var i = 0; i < len; i++) {
// bytes[i] = binary_string.charCodeAt(i);
// }
// return bytes.buffer;
}
//////////////////////////////////////////////////////////////////////////

@@ -384,4 +602,4 @@

this._drawCommands = "";
GLog.d("GContextWebGL#render() called, commands is "+ commands);
if (commands != null && commands != "") {
GLog.d("GContextWebGL#render() called, commands is "+ commands);
//GCanvas._toNative(null, null, 'GCanvas', 'render', [ commands ]);

@@ -413,3 +631,2 @@ GBridge.callRender(this.componentId, commands)

GContextWebGL.prototype.FRAMEBUFFER = 0;
GContextWebGL.prototype.bindFramebuffer = function(target, buf){

@@ -419,3 +636,2 @@ this._drawCommands += (this.bindFramebufferId + target + "," + ((null == buf)?-1:buf.id) + ";");

GContextWebGL.prototype.RENDERBUFFER = 0;
GContextWebGL.prototype.bindRenderbuffer = function(target, buf){

@@ -446,16 +662,9 @@ this._drawCommands += (this.bindRenderbufferId + target + "," + ((null == buf)?-1:buf.id) + ";");

//todo
GContextWebGL.prototype.bufferData = function(target, param, usage){
//GLog.d("[bufferData] before:_drawCommands.length=" + this._drawCommands.length);
this._drawCommands += (this.bufferDataId + target + "," + GarrToBase64(param.buffer) + "," + usage + ";");
//GLog.d("[bufferData] after :_drawCommands.length=" + this._drawCommands.length);
//if (this._drawCommands.length > 10240)
// this.render();
// TODO: param is " number or ArrayBuffer"
GContextWebGL.prototype.bufferData = function(target, array, usage){
GLog.d("[bufferData] before:_drawCommands.length=" + this._drawCommands.length);
GLog.d("[bufferData] array.length=" + array.length);
this._drawCommands += (this.bufferDataId + target + "," + array.BYTES_PER_ELEMENT + "," + GarrToBase64(array) + "," + usage + ";");
GLog.d("[bufferData] after :_drawCommands.length=" + this._drawCommands.length);
};
GContextWebGL.prototype.FRAMEBUFFER_COMPLETE = 0;
GContextWebGL.prototype.checkFramebufferStatus_ = function(target){

@@ -565,3 +774,2 @@ return this.FRAMEBUFFER_COMPLETE;// TODO:

GContextWebGL.prototype.disableVertexAttribArray = function(index){

@@ -571,4 +779,2 @@ this._drawCommands += (this.disableVertexAttribArrayId + index + ";");

GContextWebGL.prototype.drawArrays = function(mode, first, count){

@@ -635,13 +841,3 @@ this._drawCommands += (this.drawArraysId + mode + "," + first + "," + count + ";");

GContextWebGL.prototype.OFFSET = 24;
GContextWebGL.prototype.MAX_TEXTURE_IMAGE_UNITS = GContextWebGL.prototype.OFFSET+0;
GContextWebGL.prototype.MAX_VERTEX_TEXTURE_IMAGE_UNITS = GContextWebGL.prototype.OFFSET+1;
GContextWebGL.prototype.MAX_TEXTURE_SIZE = GContextWebGL.prototype.OFFSET+2;
GContextWebGL.prototype.MAX_CUBE_MAP_TEXTURE_SIZE = GContextWebGL.prototype.OFFSET+3;
GContextWebGL.prototype.MAX_TEXTURE_MAX_ANISOTROPY_EXT = GContextWebGL.prototype.OFFSET+4;
GContextWebGL.prototype.COMPRESSED_TEXTURE_FORMATS = GContextWebGL.prototype.OFFSET+5;
GContextWebGL.prototype.MAX_VERTEX_UNIFORM_VECTORS=GContextWebGL.prototype.OFFSET+6;
GContextWebGL.prototype.ALIASED_POINT_SIZE_RANGE=GContextWebGL.prototype.OFFSET+7;
//TODO

@@ -667,3 +863,3 @@ GContextWebGL.prototype.getParameter = function(name) {

GContextWebGL.prototype.getProgramParameter = function(id,type){
GContextWebGL.prototype.getProgramParameter = function(id, type){
var args = id + ',' + type;

@@ -909,3 +1105,3 @@ var result = GBridge.exeSyncCmd('getProgramParameter',args);

this._drawCommands += (cmd + id + ","
+ GarrToBase64(value.buffer) + ";");
+ GarrToBase64(value) + ";");
};

@@ -987,13 +1183,3 @@

this._drawCommands += (apiId + location.id + "," + (transpose?1:0));
// if (0 == GUtil.encode_type){
this._drawCommands += ",";
this._drawCommands += (GarrToBase64(value.buffer));
// }
// else {
// for (var i = 0; i < value.length; i++) {
// this._drawCommands += ",";
// this._drawCommands += value[i].toFixed(3);
// }
// }
this._drawCommands += (";");
this._drawCommands += "," + GarrToBase64(value) + (";");
};

@@ -1042,4 +1228,26 @@

GContextWebGL.prototype.getString = function(name) {
var args = name;
var result = GBridge.exeSyncCmd('getString',args);
return result;
}
//extension for OES_vertex_array_object
GContextWebGL.prototype.bindVertexArrayOES = function(array) {
this._drawCommands += (this.bindVertexArrayOESId + array + ";");
};
GContextWebGL.prototype.deleteVertexArraysOES = function(size, arrayRef) {
this._drawCommands += (this.deleteVertexArraysOESId + size + "," + arrayRef + ";");
};
GContextWebGL.prototype.genVertexArraysOES = function(size, arrayRef) {
this._drawCommands += (this.genVertexArraysOESId + size + "," + arrayRef + ";");
};
GContextWebGL.prototype.isVertexArrayOES = function(array) {
var args = array;
var result = GBridge.exeSyncCmd('isVertexArrayOES',args);
return result;
};
//function autoInjectMetaViewport(){

@@ -1046,0 +1254,0 @@ // var metas = document.getElementsByTagName("meta");

{
"name": "weex-gcanvas",
"version": "0.4.2",
"version": "0.4.3",
"main":"gcanvas.js",

@@ -5,0 +5,0 @@ "platform": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc