<|start_filename|>lib/sphinxapi.js<|end_filename|>
//
// $Id: sphinxapi.js 1094 2013-03-18 16:50:22Z $
//
// Copyright (c) 2013-2020, <NAME>. All rights reserved
//
// This program is free software; you can redistribute it 
// and/or modify it under the terms of the GNU General 
// Public License. You should have received a copy of the 
// GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org/
//

var Assert = require("assert");
var Socket = require("socket").Socket;
var Buffer = require("binary").Buffer;
var packlib = require("bufferpack").BufferPack;
var sprintlib = require("sprintf");

function assert(cond){
	return Assert.equal(cond, true);
}

function is_int(n) {
	return typeof n == "number" && n % 1 == 0;
}

function is_numeric(n) {
	return typeof n == "number";
}

function is_bool(b){
	return typeof b == "boolean";
}

function is_array(a){
	return Object.prototype.toString.call(a) == "[object Array]" ? true : false;
}

function is_hash(h){
	return typeof h == "object";
}

function is_string(s){
	return typeof s == "string";
}

function count(a){
	var c = 0;
	if(is_array(a)){
		c = a.length;	
	}else if(is_hash(a)){
		for(var i in a){
			c += 2;
		}			
	}
	return c;
}

function default_val(arg, val){
	return "undefined" == typeof arg ? val : arg;
}

function in_array(a, b, strict){
	strict = default_val(strict, true);
	if(!is_array(b)){
		if(!is_string(b) && !is_numeric(b)) 
			return false;
		b = [b];
	}
	var _a = {};
	if(is_array(a)){
		for(var i in a){
			_a[a[i]] = i;
		}				
	}else if(!is_hash(a)){
		return false;
	}else{
		_a = a;		
	}
	
	for(var i in b){
		if(strict){
			if(!(b[i] in _a))
				return false
		}else{
			if(!(b[i] in _a) && !(b[i] in a))
				return false			
		}
		/*
		if(strict){
			if("undefined" == typeof _a[b[i]])
				return false
		}else{
			if("undefined" == typeof _a[b[i]] && "undefined" == typeof a[b[i]])
				return false			
		}
		*/
	}

	return true;
}

function values(a){
	var _a = [];
	for(var i in a){
		_a.push(a[i]);
	}
	return _a;
}

function print_buf(buf){
	var str = buf.toSource().replace(/(?:^.*\[)|(?:\].*$)/g,'');
	var a = str.split(', ');
	for(var i in a){
		if("0" == a[i])
			continue;
		a[i] = String.fromCharCode(a[i]);
	}
	return a.join(',');
}

function buf_len(bufs){
	var l = 0;
	for (var i in bufs){
		l += bufs[i].length;
	}
	return l;
}

function buf_join(bufs){
	var pos = 0;	
	var buf = new Buffer(Array(buf_len(bufs)+1).join(String.fromCharCode(0)), "utf8");
	for (var i in bufs){
		buf.copyFrom(bufs[i], 0, pos, pos + bufs[i].length);
		pos += bufs[i].length;
	}
	return buf;
}

/// pack 64-bit signed
function sph_packi64(v){
	v = v+'';
	var r = parseFloat(v, 10);
	var s = parseInt(v, 10);
	if( 0 == r-s)
		return packlib.pack(">LL", [s < 0 ? -1 : 0, s]);//[v>>32, v&0xFFFFFFFF]);

	var q = strlen(v) - 13;
	var p = q > 0 ? q : 0;
	var lo = Math.abs(parseFloat(v.substr(p)));
	var hi = Math.abs(parseFloat(v.substr(0, p)));

	p = lo + hi*1316134912.0; // (10 ^ 13) % (1 << 32) = 1316134912
	q = Math.floor(p/4294967296.0);
	var l = p - (q*4294967296.0);
	var h = hi*2328.0 + q; // (10 ^ 13) / (1 << 32) = 2328

	if ( r<0 ){
		if (l==0){
			h = 4294967296.0 - h;
		}else{
			h = 4294967295.0 - h;
			l = 4294967296.0 - l;
		}
	}

	return packlib.pack(">LL", [h, l]);
}

/// pack 64-bit unsigned
function sph_packu64(v){
	
	v = v+'';
	var r = parseFloat(v, 10);
	var s = parseInt(v, 10);

	if (is_int(r))
		return packlib.pack(">LL", [0, s]);

	var q = strlen(v) - 13;
	var p = q > 0 ? q : 0;
	var lo = parseFloat(v.substr(p));
	var hi = parseFloat(v.substr(0, p));
       
	var m = lo + hi*1316134912.0;
	q = Math.floor(m / 4294967296.0);
	var l = m - (q * 4294967296.0);
	var h = hi*2328.0 + q;

	return packlib.pack(">LL", [h, l]);

}

// unpack 64-bit unsigned
function sph_unpacku64(v, p){
	p = "undefined" == typeof p ? 0 : p;
	var a = values(packlib.unpack(">L*L*", v, p));
	var hi = parseInt(a[0],10); 
	var lo = parseInt(a[1],10);
	
	if (0 == hi){
		if (0<lo)
			return lo;
		return parseFloat(sprintlib.sprintf("%u", lo), 10);
	}

	hi = parseFloat(sprintlib.sprintf("%u", hi), 10);
	lo = parseFloat(sprintlib.sprintf("%u", lo), 10);
       
	var q = Math.floor(hi/10000000.0);
	var r = hi - q*10000000.0;
	var m = lo + r*4967296.0;
	var mq = Math.floor(m/10000000.0);
	var l = m - mq*10000000.0;
	var h = q*4294967296.0 + r*429.0 + mq;

	h = sprintlib.sprintf("%.0f", h);
	l = sprintlib.sprintf("%07.0f", l);
	if ("0"==h)
		return parseFloat(sprintlib.sprintf("%.0f", l), 10);

	return parseFloat(h+""+l, 10);
}

// unpack 64-bit signed
function sph_unpacki64(v, p){
	var a = values(packlib.unpack(">L*L*", v, p));
	var hi = parseInt(a[0], 10);
	var lo = parseInt(a[1], 10);

	if (0==hi){
		if (0<lo)
			return $lo;
		return sprintlib.sprintf("%u", lo);
	}else if (-1==hi){
		if (0>lo)
			return lo;
		return sprintlib.sprintf("%.0f", lo - 4294967296.0);
	}
       
	var neg = "";
	var c = 0;
	if (0>hi){
		hi = ~hi;
		lo = ~lo;
		c = 1;
		neg = "-";
	}      

	hi = parseFloat(sprintlib.sprintf("%u", hi), 10);
	lo = parseFloat(sprintlib.sprintf("%u", lo), 10);

	var q = Math.floor(hi/10000000.0);
	var r = hi - q*10000000.0;
	var m = lo + r*4967296.0;
	var mq = Math.floor(m/10000000.0);
	var l = m - mq*10000000.0 + c;
	var h = q*4294967296.0 + r*429.0 + mq;

	h = sprintlib.sprintf("%.0f", h);
	l = sprintlib.sprintf("%07.0f", l);
    if ("0"==h)
		return parseFloat(neg + "" + sprintlib.sprintf("%.0f", parseFloat(l, 10)), 10);

	return parseFloat(neg+""+h+""+l, 10);

}

function sph_fixuint(value){
	if (0 > value) 
		value += (1<<32);
	return value;	
}


/// sphinx searchd client class
exports.SphinxClient = (function(){

	return function(){
		/// known searchd commands
		this.SEARCHD_COMMAND_SEARCH 		= 0;
		this.SEARCHD_COMMAND_EXCERPT 		= 1;
		this.SEARCHD_COMMAND_UPDATE 		= 2;
		this.SEARCHD_COMMAND_KEYWORDS		= 3;
		this.SEARCHD_COMMAND_PERSIST		= 4;
		this.SEARCHD_COMMAND_STATUS 		= 5;
		this.SEARCHD_COMMAND_FLUSHATTRS 	= 7;

		/// current client-side command implementation versions
		this.VER_COMMAND_SEARCH 		= 0x119;
		this.VER_COMMAND_EXCERPT 		= 0x104;
		this.VER_COMMAND_UPDATE 		= 0x102;
		this.VER_COMMAND_KEYWORDS 		= 0x100;
		this.VER_COMMAND_STATUS 		= 0x100;
		this.VER_COMMAND_QUERY 			= 0x100;
		this.VER_COMMAND_FLUSHATTRS	= 0x100;

		/// known searchd status codes
		this.SEARCHD_OK 					= 0;
		this.SEARCHD_ERROR 				= 1;
		this.SEARCHD_RETRY 				= 2;
		this.SEARCHD_WARNING 			= 3;

		/// known match modes
		this.SPH_MATCH_ALL 				= 0;
		this.SPH_MATCH_ANY 				= 1;
		this.SPH_MATCH_PHRASE 			= 2;
		this.SPH_MATCH_BOOLEAN 			= 3;
		this.SPH_MATCH_EXTENDED 		= 4;
		this.SPH_MATCH_FULLSCAN 		= 5;
		this.SPH_MATCH_EXTENDED2 		= 6;	// extended engine V2 (TEMPORARY, WILL BE REMOVED)

		/// known ranking modes (ext2 only)
		this.SPH_RANK_PROXIMITY_BM25 	= 0;	///< default mode, phrase proximity major factor and BM25 minor one
		this.SPH_RANK_BM25 				= 1;	///< statistical mode, BM25 ranking only (faster but worse quality)
		this.SPH_RANK_NONE 				= 2;	///< no ranking, all matches get a weight of 1
		this.SPH_RANK_WORDCOUNT 		= 3;	///< simple word-count weighting, rank is a weighted sum of per-field keyword occurence counts
		this.SPH_RANK_PROXIMITY 		= 4;
		this.SPH_RANK_MATCHANY 			= 5;
		this.SPH_RANK_FIELDMASK 		= 6;
		this.SPH_RANK_SPH04 				= 7;
		this.SPH_RANK_EXPR 				= 8;
		this.SPH_RANK_TOTAL 				= 9;

		/// known sort modes
		this.SPH_SORT_RELEVANCE 		= 0;
		this.SPH_SORT_ATTR_DESC 		= 1;
		this.SPH_SORT_ATTR_ASC 			= 2;
		this.SPH_SORT_TIME_SEGMENTS  	= 3;
		this.SPH_SORT_EXTENDED  		= 4;
		this.SPH_SORT_EXPR  				= 5;

		/// known filter types
		this.SPH_FILTER_VALUES 			= 0;
		this.SPH_FILTER_RANGE 			= 1;
		this.SPH_FILTER_FLOATRANGE 	= 2;

		/// known attribute types
		this.SPH_ATTR_INTEGER 			= 1;
		this.SPH_ATTR_TIMESTAMP 		= 2;
		this.SPH_ATTR_ORDINAL 			= 3;
		this.SPH_ATTR_BOOL 				= 4;
		this.SPH_ATTR_FLOAT 				= 5;
		this.SPH_ATTR_BIGINT 			= 6;
		this.SPH_ATTR_STRING 			= 7;
		this.SPH_ATTR_MULTI 				= 0x40000001;
		this.SPH_ATTR_MULTI64 			= 0x40000002;

		/// known grouping functions
		this.SPH_GROUPBY_DAY 			= 0;
		this.SPH_GROUPBY_WEEK 			= 1;
		this.SPH_GROUPBY_MONTH 			= 2;
		this.SPH_GROUPBY_YEAR 			= 3;
		this.SPH_GROUPBY_ATTR 			= 4;
		this.SPH_GROUPBY_ATTRPAIR 		= 5;
	
		// per-client-object settings
		this._host		= "localhost";		///< searchd host (default is "localhost")
		this._port		= 9312;				///< searchd port (default is 9312)
		this._path		= false;				
		this._socket	= false;

		// per-query settings
		this._offset	= 0;			///< how many records to seek from result-set start (default is 0)
		this._limit		= 20;			///< how many records to return from result-set starting at offset (default is 20)
		this._min_id	= 0;			///< min ID to match (default is 0, which means no limit)
		this._max_id	= 0;			///< max ID to match (default is 0, which means no limit)
		this._filters	= [];			///< search filters
		this._weights	= [];			///< per-field weights (default is 1 for all fields)
		this._mode		= this.SPH_MATCH_ALL;			///< query matching mode (default is SPH_MATCH_ALL)
		this._sort		= this.SPH_SORT_RELEVANCE;		///< match sorting mode (default is SPH_SORT_RELEVANCE)
		this._sortby	= "";			///< attribute to sort by (defualt is "")
		this._groupby	= "";			///< group-by attribute name
		this._groupdistinct	= "";	///< group-by count-distinct attribute
		this._groupsort	= "@group desc";		///< group-by sorting clause (to sort groups in result set with)
		this._groupfunc	= this.SPH_GROUPBY_DAY;				///< group-by function (to pre-process group-by attribute value with)
		this._ranker		= this.SPH_RANK_PROXIMITY_BM25;	///< ranking mode (default is SPH_RANK_PROXIMITY_BM25)
		this._rankexpr		= "";		///< ranking mode expression (for SPH_RANK_EXPR)
		this._maxmatches	= 100000;	///< max matches to retrieve
		this._cutoff		= 0;		///< cutoff to stop searching at (default is 0)
		this._retrycount	= 0;		///< distributed retries count
		this._retrydelay	= 0;		///< distributed retries delay
		this._anchor		= {};		///< geographical anchor point
		this._indexweights	= {};	///< per-index weights
		this._maxquerytime	= 0;	///< max query time, milliseconds (default is 0, do not limit)
		this._fieldweights	= {};	///< per-field-name weights
		this._overrides 	= {};		///< per-query attribute values overrides
		this._select		= "*";	///< select-list (attributes or expressions, with optional aliases)

		this._error			= ""; 	///< last error message; per-reply fields (for single-query case),
		this._warning		= "";		///< last warning message
		this._connerror	= false;	///< connection error vs remote error flag

		this._reqs			= [];		///< requests array for multi-query, requests storage (for multi-query case)
		this._arrayresult	= false;	///< whether result["matches"] should be a hash or an array
		this._timeout		= 0;		///< connect timeout
	};

})();

exports.SphinxClient.prototype = {
	// may be used within onexit handler
	__destroy : function(){
		if (this._socket)
			this._socket.close();
	},

	/// get last error message (string)
	GetLastError : function(){
		return this._error;
	},

	/// get last warning message (string)
	GetLastWarning : function(){
		return this._warning;
	},

	/// get last error flag (to tell network connection errors from searchd errors or broken responses)
	IsConnectError : function(){
		return this._connerror;
	},

	/// set searchd host name (string) and port (integer)
	SetServer : function(host, port){
		port = default_val(port, 0);
		assert(is_string(host));
		if ("/" == host[0]){
			this._path = "unix://" + host;
			return;
		}
		if ("unix://" == host.substr(0, 7)){
			this._path = host;
			return;
		}
				
		assert(is_int(port));
		this._host = host;
		this._port = port;
		this._path = "";
	},

	/// set server connection timeout (0 to remove)
	SetConnectTimeout : function(timeout){
		assert(is_numeric(timeout));
		this._timeout = timeout;
	},

	_Send : function(handle, data, length){
		if (!handle.send(data)){
			this._error = "connection unexpectedly closed (timed out?)";
			this._connerror = true;
			return false;
		}
		return true;
	},

	
	/// connect to searchd server
	_Connect : function(){

		if (this._socket){
			// we are in persistent connection mode, so we have a socket
			// however, need to check whether it's still alive
			var p = undefined;
			try {
				p = this._socket.getPeerName();
			}catch(e){
				// do nothing
			}
			if ( "undefined" !=typeof p && is_array(p) && 0 != count(p)  )		
				return this._socket;

			// force reopen
			this._socket = false;
		}

		errno = 0;
		errstr = "";
		this._connerror = false;

		if (this._path){
			host = this._path;
			port = 0;
		}else{
			host = this._host;
			port = this._port;
		}

		this._socket = new Socket(2, 1, 6);
		if (!this._socket.connect(host, port)){
			if (this._path)
				location = this._path;
			else
				location = this._host + ":" + this._port;
						
			this._error = "connection to " + location + " failed";
			this._connerror = true;
			return false;
		}

		// send my version
		// this is a subtle part. we must do it before (!) reading back from searchd.
		// because otherwise under some conditions (reported on FreeBSD for instance)
		// TCP stack could throttle write-write-read pattern because of Nagle.
		if (!this._Send(this._socket, packlib.pack(">L", [1]), 4) ){
			this._socket.close();
			this._error = "failed to send client protocol version";
			return false;
		}

		// check version
		var a = packlib.unpack(">L*", this._socket.receive(4));
		var v = parseInt(a[0], 10);
		
		if (1 > v){
			this._socket.close();
			this._error = "expected searchd protocol version 1+, got version '"+v+"'";
			return false;
		}

		return this._socket;
	},

	/// get and check response packet from searchd server
	_GetResponse : function(fp, client_ver){
		var response = new Buffer(0), len = 0, ver = "", status = "", a = [];
		var header = fp.receive(8);
		if (8 == header.length){
			a = packlib.unpack("HHL", header);

			status = a["0"];
			ver = a["1"];
			len = parseInt(a["2"], 10);
			var chunk = "";
			var left = len;
			var max = left;

			while ( left>0 && ( chunk = fp.receive(left < 8192 ? left : 8192) ) && 0 < max-- ){
				if (chunk){
					var tmp = response;
					response = new Buffer(tmp.length + chunk.length);
					tmp.copy(response);
					chunk.copy(response, tmp.length);
					left -= chunk.length;
				}
			}
		}

		// check response
		var read = response.length;
		if (!response || read != len){
			this._error = len
				? "failed to read searchd response (status=" + status + ", ver=" + ver + ", len=" + len + ", read=" + read + ")"
				: "received zero-sized searchd response";
			return false;
		}

		// check status
		if (status == this.SEARCHD_WARNING){
			a = packlib.unpack(">L", response.substr(0, 4));
			var wlen = parseInt(a[0], 10);
			
			this._warning = response.substr(4, wlen);
			return response.response.slice(4, 4 + wlen).toString("utf8");
		}

		if (status == this.SEARCHD_ERROR ){
			this._error = "searchd error: " + response.slice(0, 4).toString("utf8");
			return false;
		}

		if (status == this.SEARCHD_RETRY){
			this._error = "temporary searchd error: " + response.slice(0, 4).toString("utf8");;
			return false;
		}

		if(status != this.SEARCHD_OK){
			this._error = "unknown status code '" + status + "'";
			return false;
		}

		// check version
		if (ver < client_ver){
			this._warning = sprintlib.sprintf("searchd command v.%d.%d older than client's v.%d.%d, some options might not work", ver>>8, ver&0xff, client_ver>>8, client_ver&0xff );
		}

		return response;
	},

	/////////////////////////////////////////////////////////////////////////////
	// searching
	/////////////////////////////////////////////////////////////////////////////

	/// set offset and count into result set,
	/// and optionally set max-matches and cutoff limits
	SetLimits : function(offset, limit, max, cutoff){

		max = default_val(max, 0);
		cutoff = default_val(cutoff, 0);

		assert(is_int(offset) );
		assert(is_int(limit) );
		assert(offset >= 0 );
		assert(limit > 0);
		assert(max >= 0);
		this._offset = offset;
		this._limit = limit;

		if (0 < max)
			this._maxmatches = max;
		if (0 < cutoff)
			this._cutoff = cutoff;
	},

	/// set maximum query time, in milliseconds, per-index
	/// integer, 0 means "do not limit"
	SetMaxQueryTime : function(max){
		assert(is_int(max));
		assert(max >= 0);
		this._maxquerytime = max;
	},

	/// set matching mode
	SetMatchMode : function(mode)
	{
		assert( mode == this.SPH_MATCH_ALL
			|| mode == this.SPH_MATCH_ANY
			|| mode == this.SPH_MATCH_PHRASE
			|| mode == this.SPH_MATCH_BOOLEAN
			|| mode == this.SPH_MATCH_EXTENDED
			|| mode == this.SPH_MATCH_FULLSCAN
			|| mode == this.SPH_MATCH_EXTENDED2 );
		this._mode = mode;
	},

	/// set ranking mode
	SetRankingMode : function(ranker, rankexpr){
	
		rankexpr = default_val(rankexpr, "");

		assert( ranker >= 0 && ranker < this.SPH_RANK_TOTAL );
		assert(is_string(rankexpr));
		this._ranker = ranker;
		this._rankexpr = rankexpr;
	},

	/// set matches sorting mode
	SetSortMode : function(mode, sortby){

		sortby = default_val(sortby, "");

		assert(
			mode == this.SPH_SORT_RELEVANCE ||
			mode == this.SPH_SORT_ATTR_DESC ||
			mode == this.SPH_SORT_ATTR_ASC ||
			mode == this.SPH_SORT_TIME_SEGMENTS ||
			mode == this.SPH_SORT_EXTENDED ||
			mode == this.SPH_SORT_EXPR );
		assert(is_string(sortby));
		assert( mode == this.SPH_SORT_RELEVANCE || sortby.length > 0 );

		this._sort = mode;
		this._sortby = sortby;
	},

	/// bind per-field weights by order
	/// DEPRECATED; use SetFieldWeights() instead
	SetWeights : function(weights)
	{
		assert(is_array(weights));
		for (var name in weights)
			assert(is_int(weights[name]));

		this._weights = weights;
	},

	/// bind per-field weights by name
	SetFieldWeights : function(weights){
		assert (is_hash(weights));
		for (var name in weights){
			assert(is_string(name));
			assert(is_int(weights[name]));
		}
		this._fieldweights = weights;
	},

	/// bind per-index weights by name
	SetIndexWeights : function(weights){
		assert(is_hash(weights));
		
		for (var idx in weights){
			assert(is_string(idx));
			assert(is_int(weights[idx]));
		}
		this._indexweights = weights;
	},

	/// set IDs range to match
	/// only match records if document ID is between min and max (inclusive)
	SetIDRange : function(min, max){
		assert(is_numeric(min));
		assert(is_numeric(max));
		assert(min <= max);
		this._min_id = min;
		this._max_id = max;
	},

	/// set values set filter
	/// only match records where attribute value is in given set
	SetFilter : function(attribute, values, exclude){

		exclude = default_val(exclude, false);

		assert(is_string(attribute));
		assert(is_array(values));
		assert(values.length);

		if (is_array(values) && values.length){
			for (var i in values)
				assert(is_numeric(values[i]));

			this._filters.push( {"type":this.SPH_FILTER_VALUES, "attr":attribute, "exclude":exclude, "values":values} );
		}
	},

	/// set range filter
	/// only match records if attribute value is beetwen min and max (inclusive)
	SetFilterRange : function(attribute, min, max, exclude){

		exclude = default_val(exclude, false);

		assert(is_string(attribute));
		assert(is_numeric(min));
		assert(is_numeric(max));
		assert(min <= max);

		this._filters.push( {"type":this.SPH_FILTER_RANGE, "attr":attribute, "exclude":exclude, "min":min, "max":max} );
	},

	/// set float range filter
	/// only match records if attribute value is beetwen min and max (inclusive)
	SetFilterFloatRange : function(attribute, min, max, exclude){

		exclude = default_val(exclude, false);

		assert(is_string(attribute));
		assert(is_float(min));
		assert(is_float(max));
		assert(min <= max);

		this._filters.push( {"type":this.SPH_FILTER_FLOATRANGE, "attr":attribute, "exclude":exclude, "min":min, "max":max} );
	},

	/// setup anchor point for geosphere distance calculations
	/// required to use @geodist in filters and sorting
	/// latitude and longitude must be in radians
	SetGeoAnchor : function(attrlat, attrlong, lat, long){
		assert(is_string(attrlat));
		assert(is_string(attrlong));
		assert(is_numeric(lat));
		assert(is_numeric(long));

		this._anchor = {"attrlat":attrlat, "attrlong":attrlong, "lat":lat, "long":long};
	},

	/// set grouping attribute and function
	SetGroupBy : function(attribute, func, groupsort){

		groupsort = default_val(groupsort, "@group desc");

		assert (is_string(attribute));
		assert (is_string(groupsort));
		assert (func == this.SPH_GROUPBY_DAY
			|| func == this.SPH_GROUPBY_WEEK
			|| func == this.SPH_GROUPBY_MONTH
			|| func == this.SPH_GROUPBY_YEAR
			|| func == this.SPH_GROUPBY_ATTR
			|| func == this.SPH_GROUPBY_ATTRPAIR);

		this._groupby = attribute;
		this._groupfunc = func;
		this._groupsort = groupsort;
	},

	/// set count-distinct attribute for group-by queries
	SetGroupDistinct : function(attribute){
		assert(is_string(attribute));
		this._groupdistinct = attribute;
	},

	/// set distributed retries count and delay
	SetRetries : function(count, delay){
		delay = default_val(delay, 0);

		assert(is_int(count) && count >= 0);
		assert(is_int(delay) && delay >= 0);
		this._retrycount = count;
		this._retrydelay = delay;
	},

	/// set result set format (hash or array; hash by default)
	/// needed for group-by-MVA result sets that may contain duplicate IDs
	SetArrayResult : function (arrayresult){
		assert(is_bool(arrayresult));
		this._arrayresult = arrayresult;
	},

	/// set attribute values override
	/// there can be only one override per attribute
	/// values must be a hash that maps document IDs to attribute values
	SetOverride : function (attrname, attrtype, values){
		assert(is_string(attrname));
		assert( in_array(attrtype, [this.SPH_ATTR_INTEGER, this.SPH_ATTR_TIMESTAMP, this.SPH_ATTR_BOOL, this.SPH_ATTR_FLOAT, this.SPH_ATTR_BIGINT]) );
		assert(is_array(values));

		this._overrides[attrname] = {"attr":attrname, "type":attrtype, "values":values};
	},

	/// set select-list (attributes or expressions), SQL-like syntax
	SetSelect : function(select){
		assert(is_string(select));
		this._select = select;
	},

	//////////////////////////////////////////////////////////////////////////////

	/// clear all filters (for multi-queries)
	ResetFilters : function(){
		this._filters = [];
		this._anchor = [];
	},

	/// clear groupby settings (for multi-queries)
	ResetGroupBy : function(){
		this._groupby		= "";
		this._groupfunc	= this.SPH_GROUPBY_DAY;
		this._groupsort	= "@group desc";
		this._groupdistinct = "";
	},

	/// clear all attribute value overrides (for multi-queries)
	ResetOverrides : function(){
		this._overrides = {};
	},

	//////////////////////////////////////////////////////////////////////////////

	/// connect to searchd server, run given search query through given indexes,
	/// and return the search results
	Query : function(query, index, comment){

		index = default_val(index, "*");
		comment = default_val(comment, "");

		assert (0 == count(this._reqs));

		this.AddQuery(query, index, comment);
		var results = this.RunQueries();
		this._reqs = []; // just in case it failed too early

		if (!is_array(results))
			return false; // probably network error; error message should be already filled

		this._error = results[0]["error"];
		this._warning = results[0]["warning"];
		if (results[0]["status"] == this.SEARCHD_ERROR)
			return false;
		else
			return results[0];
	},

	/// helper to pack floats in network byte order
	_PackFloat : function(f){
		var t1 = packlib.pack(">f", [f]); // machine order
		var a = packlib.unpack(">L*", t1); // int in machine order
		var t2 = a[0];
		return packlib.pack(">L", [t2]);
	},

	/// add query to multi-query batch
	/// returns index into results array from RunQueries() call
	AddQuery : function (query, index, comment){
		index = default_val(index, "*");
		comment = default_val(comment, "");
				
		var req = [];
		// build request
		req.push(packlib.pack(">LLLL", [this._offset, this._limit, this._mode, this._ranker]));

		if (this._ranker == this.SPH_RANK_EXPR)
			req.push(packlib.pack(">L", [this._rankexpr.length]), new Buffer(this._rankexpr, "utf8"));
		
		req.push(packlib.pack(">L", [this._sort])); // (deprecated) sort mode

		req.push(packlib.pack(">L", [this._sortby.length]), new Buffer(this._sortby, "utf8"));

		req.push(packlib.pack(">L", [query.length]), new Buffer(query, "utf8")); // query itself

		req.push(packlib.pack(">L", [count(this._weights)])); // weights

		for(var i in this._weights)
			req.push(packlib.pack(">L", [parseInt(this._weights[i],10)]));

		req.push(packlib.pack(">L", [index.length]), new Buffer(index, "utf8")); // indexes

		req.push(packlib.pack(">L", [1])); // id64 range marker
		req.push(sph_packu64(this._min_id), sph_packu64(this._max_id)); // id64 range


		// filters
		req.push(packlib.pack(">L", [count(this._filters)] ));
		for (var i in this._filters){

			req.push(packlib.pack(">L", [this._filters[i]["attr"].length]), new Buffer(this._filters[i]["attr"], "utf8"));
			req.push(packlib.pack(">L", [this._filters[i]["type"]]));
			switch (this._filters[i]["type"]){
				case this.SPH_FILTER_VALUES:
					req.push(packlib.pack(">L", [count(this._filters[i]["values"])] ));
					for (var v in this._filters[i]["values"]){
						req.push(sph_packi64(this._filters[i]["values"][v]));
					}
					break;
				case this.SPH_FILTER_RANGE:
					req.push( sph_packi64(this._filters[i]["min"]), sph_packi64(this._filters[i]["max"]) );
					break;
				case this.SPH_FILTER_FLOATRANGE:
					req.push( this._PackFloat(this._filters[i]["min"]), this._PackFloat(this._filters[i]["max"]) );
					break;
				default:
					assert ( 0 && "internal error: unhandled filter type" );
			}
			req.push(packlib.pack(">L", [this._filters[i]["exclude"]]));
		}


		// group-by clause, max-matches count, group-sort clause, cutoff count
		req.push(packlib.pack(">LL", [this._groupfunc, this._groupby.length]), new Buffer(this._groupby, "utf8"));

		req.push(packlib.pack(">L", [this._maxmatches]));
		req.push(packlib.pack(">L", [this._groupsort.length]), new Buffer(this._groupsort, "utf8"));
		req.push(packlib.pack(">LLL", [this._cutoff, this._retrycount, this._retrydelay]));
		req.push(packlib.pack(">L", [this._groupdistinct.length]), new Buffer(this._groupdistinct, "utf8"));

		// anchor point
		if (0 == count(this._anchor)){
			req.push(packlib.pack(">L", [0]));
		} else {
			req.push(packlib.pack(">L", [1]));
			req.push(packlib.pack(">L", [this._anchor["attrlat"].length] ), new Buffer(this._anchor["attrlat"], "utf8"));
			req.push(packlib.pack(">L", [this._anchor["attrlong"].length] ), new Buffer(this._anchor["attrlong"], "utf8"));
			req.push(this._PackFloat(this._anchor["lat"]), this._PackFloat(this._anchor["long"]));
		}

		// per-index weights
		req.push(packlib.pack(">L", [count(this._indexweights)]));
		for (var idx in this._indexweights)
			req.push(packlib.pack(">L", [idx.length]), new Buffer(idx, "utf8"), packlib.pack(">L", this._indexweights[idx]));

		// max query time
		req.push(packlib.pack(">L", [this._maxquerytime]));

		// per-field weights
		req.push(packlib.pack(">L", [count(this._fieldweights)] ));
		for (var field in this._fieldweights)
			req.push(packlib.pack(">L", [field.length] ), new Buffer(field, "utf8"), packlib.pack(">L", this._fieldweights[field]));

		// comment
		req.push(packlib.pack(">L", [comment.length]), new Buffer(comment, "utf8"));

		// attribute overrides
		req.push(packlib.pack(">L", [count(this._overrides)] ));
		for (var key in this._overrides){
			req.push(packlib.pack(">L", [this._overrides[key]["attr"].length]), new Buffer(this._overrides[key]["attr"], "utf8"));
			req.push(packlib.pack(">LL", [this._overrides[key]["type"], count(this._overrides[key]["values"])] ));
			for(var id in this._overrides[key]["values"]){
				assert(is_numeric(id));
				assert(is_numeric(this._overrides[key]["values"][id]));

				req.push(sph_packu64(id));
				switch (this._overrides[key]["type"]){
					case this.SPH_ATTR_FLOAT:
						req.push(this._PackFloat(this._overrides[key]["values"][id]));
						break;
					case this.SPH_ATTR_BIGINT:
						req.push(sph_packi64(this._overrides[key]["values"][id]));
						break;
					default:
						req.push(packlib.pack(">L", [ this._overrides[key]["values"][id] ]));
						break;
				}
			}
		}

		// select-list
		req.push(packlib.pack(">L", [this._select.length]), new Buffer(this._select, "utf8"));

		// store request to requests array
		this._reqs.push(buf_join(req));
		return count(this._reqs)-1;
	},

	/// connect to searchd, run queries batch, and return an array of result sets
	RunQueries : function(){
		if (0 == count(this._reqs)){
			this._error = "no queries defined, issue AddQuery() first";
			return false;
		}

		var fp = this._Connect();
		if (!fp){
			return false;
		}

		// send query, get response
		var nreqs = count(this._reqs);		
		var len = 8+buf_len(this._reqs);
		this._reqs.unshift(packlib.pack(">HHLLL", [this.SEARCHD_COMMAND_SEARCH, this.VER_COMMAND_SEARCH, len, 0, nreqs])); // add header
				
		if (!this._Send(fp, buf_join(this._reqs), len + 8)){
			return false;
		}

		var response = this._GetResponse(fp, this.VER_COMMAND_SEARCH);
		if (!response){
			return false;
		}

		// query sent ok; we can reset reqs now
		this._reqs = [];

		// parse and return response
		return this._ParseSearchResponse(response, nreqs);
	},

	/// parse and return search query (or queries) response
	_ParseSearchResponse : function(response, nreqs){
		var a = [];
		var p = 0; // current position
		var max = response.length; // max position for checks, to protect against broken responses
		var results = [];
		for (var ires=0; ires<nreqs && p<max; ires++){
			results.push({});
			
			results[ires]["error"] = "";
			results[ires]["warning"] = "";
			var len = 0;

			// extract status
			a = packlib.unpack(">LLLL", response, p); 
			var status = a[0];
			p += 4;
			results[ires]["status"] = status;
			if (status != this.SEARCHD_OK){
				a = packlib.unpack(">LLLL", response, p); 
				len = parseInt(a[0], 10);
				p += 4;
				var message = response.slice(p, p + len).toString("utf8");
				p += len;

				if (status == this.SEARCHD_WARNING){
					results[ires]["warning"] = message;
				} else {
					results[ires]["error"] = message;
					continue;
				}
			}

			// read schema
			var fields = [];
			var attrs = {};
			var attrvals = {};
			var attr = "";

			a = packlib.unpack(">LLLL", response, p); 
			var nfields = parseInt(a[0], 10);
			p += 4;
			while (0 < nfields-- && p < max){
				a = packlib.unpack(">LLLL", response, p);
				len = parseInt(a[0],10);
				p += 4;
				fields.push(response.slice(p, p + len).toString("utf8")); 
				p += len;
			}
			results[ires]["fields"] = fields;

			a = packlib.unpack(">LLLL", response, p);
			var nattrs = parseInt(a[0], 10);
			p += 4;		
			while (0 < nattrs-- && p < max){
				a = packlib.unpack(">LLLL", response, p);
				len = parseInt(a[0], 10);
				p += 4;

				attr = response.slice(p, p + len).toString("utf8");
				p += len;
				a = packlib.unpack(">LLLL", response, p);
				p += 4;
				
				attrs[attr] = parseInt(a[0], 10);
			}
			results[ires]["attrs"] = attrs;

			// read match count
			a = packlib.unpack(">LLLL", response, p); 
			var cnt = parseInt(a[0], 10);
			p += 4;
			
			a = packlib.unpack(">LLLL", response, p);
			var id64 = a[0];
			p += 4;

			// read matches
			var weight = 0;
			var doc = 0;
			var idx = -1;
			while (0 < cnt-- && p < max){
				// index into result array
				idx++;
				// parse document id and weight
				if (id64){
					doc = sph_unpacku64(response.slice(p, p + 8), 0);
					p += 8;
					a = packlib.unpack(">LLLL", response.slice(p, p + 4), 0);
					weight = a[0];
					p += 4;
				}else{
					a = values(packlib.unpack(">LL", response.slice(p, p + 8), 0));
					doc = a[0];
					weight = a[1];
					p += 8;
					doc = sph_fixuint(doc);
				}
				weight = sprintlib.sprintf("%u", weight);
				if(!("matches" in results[ires]))
					results[ires]["matches"] = [];
				// create match entry
				if (this._arrayresult)
					results[ires]["matches"][idx] = {"id":doc, "weight":weight};
				else
					results[ires]["matches"][doc]["weight"] = weight;

				// parse and create attributes
				attrvals = {};
				for (attr in attrs){

					// handle 64bit ints
					if (attrs[attr] == this.SPH_ATTR_BIGINT){
						attrvals[attr] = sph_unpacki64(response.slice(p, p + 8), 0); 
						p += 8;
						continue;
					}

					// handle floats
					if (attrs[attr] == this.SPH_ATTR_FLOAT){
						a = packlib.unpack(">L", response.slice(p, p + 4), 0);
						var uval = a[0];
						p += 4;
						a = packlib.unpack(">f", packlib.pack(">L", [uval] ), 0); 
						var fval = a[0];
						attrvals[attr] = fval;
						continue;
					}

					// handle everything else as unsigned ints
					a = packlib.unpack(">L", response.slice(p, p + 4), 0); 
					p += 4;
					var val = a[0];
					if ( attrs[attr] == this.SPH_ATTR_MULTI){
						attrvals[attr] = [];
						nvalues = val;
						while (0 < nvalues-- && p < max){
							a = packlib.unpack(">L", response.slice(p, p + 4), 0); 
							val = a[0];
							p += 4;
							attrvals[attr].push(sph_fixuint(val));
						}
					} else if (attrs[attr] == this.SPH_ATTR_MULTI64){
						attrvals[attr] = [];
						var nvalues = val;
						while (0 < nvalues && p < max){
							attrvals[attr].push(sph_unpacku64(response.slice( p, p + 8), 0));
							p += 8;
							nvalues -= 2;
						}
					} else if (attrs[attr] == this.SPH_ATTR_STRING){
						attrvals[attr] = response.slice(p, p + val).toString("utf8");
						p += val;						
					} else{
						attrvals[attr] = sph_fixuint(val);
					}
				}

				if (this._arrayresult)
					results[ires]["matches"][idx]["attrs"] = attrvals;
				else
					results[ires]["matches"][doc]["attrs"] = attrvals;
			}

			var total, total_found, msecs, words;
			a = values(packlib.unpack(">LLLL", response.slice(p, p + 16)));
			total = a[0];
			total_found = a[1]; 
			msecs = parseInt(a[2], 10); 
			words = parseInt(a[3], 10);
			results[ires]["total"] = sprintlib.sprintf("%u", total);
			results[ires]["total_found"] = sprintlib.sprintf("%u", total_found);
			results[ires]["time"] = sprintlib.sprintf("%.3f", msecs/1000);
			p += 16;

			while (0 < words-- && p < max){
				a = packlib.unpack(">L", response.slice(p, p+4), 0);
				len = a[0];
				p += 4;
				word =  response.slice(p, p + len).toString("utf8");
				p += len;
				a = values(packlib.unpack(">LL", response.slice(p, p + 8, 0))); 
				var docs = a[0];
				var hits = a[1]; 
				p += 8;

				if(!("words" in results[ires]))
					results[ires]["words"] = {};

				results[ires]["words"][word] = {"docs":sprintlib.sprintf("%u", docs), "hits":sprintlib.sprintf("%u", hits)};
			}
		}

		return results;
	},

	/////////////////////////////////////////////////////////////////////////////
	// excerpts generation
	/////////////////////////////////////////////////////////////////////////////

	/// connect to searchd server, and generate exceprts (snippets)
	/// of given documents for given query. returns false on failure,
	/// an array of snippets on success
	BuildExcerpts : function(docs, index, words, opts){

		opts = default_val(opts, {});

		assert(is_array(docs));
		assert(is_string(index));
		assert(is_string(words));
		assert(is_array(opts));

		var fp = this._Connect();
		if (!fp){
			return false;
		}

		/////////////////
		// fixup options
		/////////////////

		if (!("before_match" in opts))
			opts["before_match"] = "<b>";
		if (!("after_match" in opts))
			opts["after_match"] = "</b>";
		if (!("chunk_separator" in opts))
			opts["chunk_separator"] = " ... ";
		if (!("limit" in opts))
			opts["limit"] = 256;
		if (!("limit_passages" in opts))
			opts["limit_passages"] = 0;
		if (!("limit_words" in opts))
			opts["limit_words"] = 0;
		if (!("around" in opts))
			opts["around"] = 5;
		if (!("exact_phrase" in opts))
			opts["exact_phrase"] = false;
		if (!("single_passage" in opts))
			opts["single_passage"] = false;
		if (!("use_boundaries" in opts))
			opts["use_boundaries"] = false;
		if (!("weight_order" in opts))
			opts["weight_order"] = false;
		if (!("query_mode" in opts))
			opts["query_mode"] = false;
		if (!("force_all_words" in opts))
			opts["force_all_words"] = false;
		if (!("start_passage_id" in opts))
			opts["start_passage_id"] = 1;
		if (!("load_files" in opts))
			opts["load_files"] = false;
		if (!("html_strip_mode" in opts))
			opts["html_strip_mode"] = "index";
		if (!("allow_empty" in opts))
			opts["allow_empty"] = false;
		if (!("passage_boundary" in opts))
			opts["passage_boundary"] = "none";
		if (!("emit_zones" in opts))
			opts["emit_zones"] = false;
		if (!("load_files_scattered" in opts))
			opts["load_files_scattered"] = false;
		
		/////////////////
		// build request
		/////////////////

		// v.1.2 req
		var flags = 1; // remove spaces
		if (opts["exact_phrase"])
			flags |= 2;
		if (opts["single_passage"])
			flags |= 4;
		if (opts["use_boundaries"])
			flags |= 8;
		if (opts["weight_order"])
			flags |= 16;
		if (opts["query_mode"])
			flags |= 32;
		if (opts["force_all_words"])
			flags |= 64;
		if (opts["load_files"])
			flags |= 128;
		if (opts["allow_empty"])
			flags |= 256;
		if (opts["emit_zones"])
			flags |= 512;
		if (opts["load_files_scattered"])
			flags |= 1024;
		
		var req = [];
		req.push(packlib.pack(">LL", [0, flags])); // mode=0, flags=flags
		req.push(packlib.pack(">L", index.length), new Buffer(index, "utf8")); // req index
		req.push(packlib.pack(">L", words.length), new Buffer(words, "utf8")); // req words

		// options
		req.push(packlib.pack(">L", [opts["before_match"].length]), new Buffer(opts["before_match"], "utf8"));
		req.push(packlib.pack(">L", [opts["after_match"].length]), new Buffer(opts["after_match"], "utf8"));
		req.push(packlib.pack(">L", [opts["chunk_separator"].length]), new Buffer(opts["chunk_separator"], "utf8"));
		req.push(packlib.pack(">LL", [parseInt(opts["limit"],10), parseInt(opts["around"],10)] ));
		req.push(packlib.pack(">LLL", [parseInt(opts["limit_passages"],10), parseInt(opts["limit_words"],10), parseInt(opts["start_passage_id"],10)] )); // v.1.2
		req.push(packlib.pack(">L", [opts["html_strip_mode"].length]), new Buffer(opts["html_strip_mode"], "utf8"));
		req.push(packlib.pack(">L", [opts["passage_boundary"].length]), new Buffer(opts["passage_boundary"], "utf8"));

		// documents
		req.push(packlib.pack(">L", count(docs)));
		for (var i in docs){
			assert(is_string(docs[i]));
			req.push(packlib.pack(">L", [docs[i].length]), new Buffer(docs[i], "utf8"));
		}

		////////////////////////////
		// send query, get response
		////////////////////////////

		var len = buf_len(req);
		req.unshift(packlib.pack(">HHL", [this.SEARCHD_COMMAND_EXCERPT, this.VER_COMMAND_EXCERPT, len])); // add header
		if (!(this._Send(fp, buf_join(req), len + 8))){
			return false;
		}

		var response = this._GetResponse(fp, this.VER_COMMAND_EXCERPT);
		if(!response){
			return false;
		}

		//////////////////
		// parse response
		//////////////////

		var a = [];
		var pos = 0;
		var res = [];
		var rlen = response.length;
		for (var i=0; i<count(docs); i++){
			a = packlib.unpack(">L", response.slice(pos, pos + 4));
			len = parseInt(a[0], 10);
			pos += 4;

			if (rlen < pos + len){
				this._error = "incomplete reply";
				return false;
			}
			res.push(len ? response.slice(pos, pos + len) : "");
			pos += len;
		}

		return res;
	},


	/////////////////////////////////////////////////////////////////////////////
	// keyword generation
	/////////////////////////////////////////////////////////////////////////////

	/// connect to searchd server, and generate keyword list for a given query
	/// returns false on failure,
	/// an array of words on success
	BuildKeywords : function(query, index, hits){
		assert(is_string(query));
		assert(is_string(index));
		assert(is_bool(hits));

		var fp = this._Connect();
		if (!fp){
			return false;
		}

		/////////////////
		// build request
		/////////////////

		// v.1.0 req
		var req = [];
		req.push(packlib.pack(">L", [query.length]), new Buffer(query, "utf8")); // req query
		req.push(packlib.pack(">L", [index.length]), new Buffer(index, "utf8")); // req index
		req.push(packlib.pack(">L", [parseInt(hits, 10)]));

		////////////////////////////
		// send query, get response
		////////////////////////////

		var len = buf_len(req);
		req.unshift(packlib.pack(">HLL", [this.SEARCHD_COMMAND_KEYWORDS, this.VER_COMMAND_KEYWORDS, len])); // add header
		if (!this._Send (fp, buf_join(req), len + 8)){
			return false;
		}

		var response = this._GetResponse(fp, this.VER_COMMAND_KEYWORDS);
		if(!response){
			return false;
		}

		//////////////////
		// parse response
		//////////////////

		var pos = 0;
		var res = [];
		var rlen = response.length;
		var a = packlib.unpack(">L", response.slice(pos, pos + 4), 0);
		var nwords = parseInt(a[0], 10);
		pos += 4;
		for (var i=0; i<nwords; i++){
			a = packlib.unpack(">L", response.slice(pos, pos + 4), 0);
			len = parseInt(a[0], 10);
			pos += 4;

			tokenized = len ? response.slice(pos, pos + len).toString("utf8") : "";
			pos += len;

			a = packlib.unpack(">L", response.slice(pos, pos + 4), 0);
			len = parseInt(a[0], 10);
			pos += 4;
			
			normalized = len ? response.slice(pos, pos + len).toString("utf8") : "";
			pos += len;

			res.push( {"tokenized":tokenized, "normalized":normalized} );

			if (hits){
				a = values(packlib.unpack(">LL", response.slice(pos, pos + 8)));
				pos += 8;
				res[i]["docs"] = a[0];
				res[i]["hits"] = a[1];
			}

			if (pos > rlen){
				this._error = "incomplete reply";
				return false;
			}
		}

		return res;
	},

	EscapeString : function(str){
		var from = [ '\\', '(',')','|','-','!','@','~','"','&', '/', '^', '$', '=' ];
		var to   = [ '\\\\', '\(','\)','\|','\-','\!','\@','\~','\"', '\&', '\/', '\^', '\$', '\=' ];
		for(var i in from){
			str = str.replace(from[i], to[i]);
		}
		return str;
	},

	/////////////////////////////////////////////////////////////////////////////
	// attribute updates
	/////////////////////////////////////////////////////////////////////////////

	/// batch update given attributes in given rows in given indexes
	/// returns amount of updated documents (0 or more) on success, or -1 on failure
	UpdateAttributes : function(index, attrs, values, mva){

		mva = default_val(mva, false);

		// verify everything
		assert(is_string(index));
		assert(is_bool(mva));
		assert(is_array(attrs));
		for (var i in attrs)
			assert(is_string(attrs[i]));

		assert(is_array(values));
		for (var id in values ){
			assert(is_numeric(id));
			assert(is_array(values[id]));
			assert(count(values[id]) == count(attrs));
			for (var i in values[id]){
				if (mva){
					assert(is_array(values[id][i]));
					for (var ii in values[id][i])
						assert(is_int(values[id][i][ii]));
				} else{
					assert(is_int(values[id][i]));
				}
			}
		}

		// build request
		var req = [];
		req.push(packlib.pack(">L", [index.length]), new Buffer(index, "utf8"));

		req.push(packlib.pack(">L", [count(attrs)] ));
		for (var i in attrs){
			req.push(packlib.pack(">L", [attrs[i].length]), new Buffer(attr[i], "utf8"));
			req.push(packlib.pack(">L", [mva ? 1 : 0]));
		}

		req.push(packlib.pack(">L", [count(values)] ));
		for (var id in values){
			req.push(sph_packu64(id));
			for (var v in values[id]){
				req.push(packlib.pack(">L", [ mva ? count(values[id][v]) : values[id][v] ] ));
				if (mva){
					for (var vv in values[id][v])
						req.push(packlib.pack(">L", [ values[id][v][vv] ] ));
				}
			}
		}

		var fp = this._Connect();
		// connect, send query, get response
		if (!fp){
			return -1;
		}

		var len = buf_len(req);
		req.unshift(packlib.pack(">HLL", [this.SEARCHD_COMMAND_UPDATE, this.VER_COMMAND_UPDATE, len])); // add header
		if (!this._Send(fp, buf_join(req), len + 8)){
			return -1;
		}

		var response = this._GetResponse(fp, this.VER_COMMAND_UPDATE);
		if (!response){
			return -1;
		}

		// parse response
		a = packlib.unpack(">L", response.slice(0, 4), 0);
		return a[0];
	},

	/////////////////////////////////////////////////////////////////////////////
	// persistent connections
	/////////////////////////////////////////////////////////////////////////////

	Open : function(){
		if (false !== this._socket){
			this._error = "already connected";
			return false;
		}

		var fp = this._Connect();
		if (!fp){
			return false;
		}

		// command, command version = 0, body length = 4, body = 1
		var req = packlib.pack(">HHLL", [this.SEARCHD_COMMAND_PERSIST, 0, 4, 1]);
		if (!this._Send(fp, req, 12)){
			return false;
		}

		this._socket = fp;
		return true;
	},

	Close : function(){
		if (false === this._socket){
			this._error = "not connected";
			return false;
		}

		this._socket.close();
		this._socket = false;

		return true;
	},

	//////////////////////////////////////////////////////////////////////////
	// status
	//////////////////////////////////////////////////////////////////////////

	Status : function(){
		var fp = this._Connect();
		if (!fp){
			return false;
		}

		var req = packlib.pack(">HHLL", [this.SEARCHD_COMMAND_STATUS, this.VER_COMMAND_STATUS, 4, 1]); // len=4, body=1
		if (!(this._Send(fp, req, 12))){
			return false;
		}

		var response = this._GetResponse(fp, this.VER_COMMAND_STATUS);
		if(!response){
			return false;
		}		

		var len = 0;
		//var res = response.substr( 4 ); // just ignore length, error handling, etc
		var p = 0;
		var a = values(packlib.unpack(">LL", response.slice(p, p + 8)), 0);
		p += 8;
		
		var rows = parseInt(a[0], 10);
		var cols = parseInt(a[1], 10);
		var val = "";
		var tr = [];
		var res = {};
		for (var i=0; i<rows; i++){
			for ( var j=0; j<cols; j++ ){
				a = packlib.unpack(">L", response.slice(p, p+4), 0); 
				len = parseInt(a[0], 10);
				p += 4;
				val = response.slice(p, p + len).toString('utf8');//values(packlib.unpack("S>", response.slice(p, p + len), 0))[0];
				if("undefined" == typeof tr[i])
					tr[i] = val;
				else	
					res[tr[i]] = val;
			
				p += len;
			}
		}

		return res;
	},

	//////////////////////////////////////////////////////////////////////////
	// flush
	//////////////////////////////////////////////////////////////////////////

	FlushAttributes : function(){
		var fp = this._Connect();
		if (!fp){
			return -1;
		}

		var req = packlib.pack(">hhI", [this.SEARCHD_COMMAND_FLUSHATTRS, this.VER_COMMAND_FLUSHATTRS, 0]); // len=0
		if (!(this._Send(fp, req, 8))){
			return -1;
		}

		var response = this._GetResponse(fp, this.VER_COMMAND_FLUSHATTRS);
		if(!response){
			return -1;
		}		
		
		var a = [-1, -1];
		if (4 == response.length){
			a = packlib.unpack(">L*", response);
		}else{
			this._error = "unexpected response length";
		}
		return a[1];
	},
};



<|start_filename|>src/lib/GL/glbindings/glbind.cpp<|end_filename|>

#include "glbind.h"

#if defined(V8_GL_USE_GLEW)
#include "GL/glew.h"
#elif defined(__APPLE__)
#include <GLUT/glut.h>
#else
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#endif

using namespace v8;

Persistent<Object> GlFactory::self_;


void GLglAccumCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glAccum((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglAlphaFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glAlphaFunc((GLenum) arg0, (GLclampf) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglAreTexturesResidentCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLboolean* arg2 = new GLboolean[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLboolean aux = (GLboolean)arg->Uint32Value();
      arg2[j] = aux; 
  }
    
    
  //make call
  args.GetReturnValue().Set(glAreTexturesResident((GLsizei) arg0, (const GLuint*) arg1, (GLboolean*) arg2));
}




void GLglArrayElementCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glArrayElement((GLint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBeginCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glBegin((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBindTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBindTexture((GLenum) arg0, (GLuint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBitmapCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 7) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();
  double arg5 = args[5]->NumberValue();

    
  Handle<Array> arrHandle6 = Handle<Array>::Cast(args[6]);
   GLubyte* arg6 = new  GLubyte[arrHandle6->Length()];
  for (unsigned j = 0; j < arrHandle6->Length(); j++) {
      Handle<Value> arg(arrHandle6->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg6[j] = aux; 
  }
    
    
  //make call
  glBitmap((GLsizei) arg0, (GLsizei) arg1, (GLfloat) arg2, (GLfloat) arg3, (GLfloat) arg4, (GLfloat) arg5, (const GLubyte*) arg6);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBlendColorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glBlendColor((GLclampf) arg0, (GLclampf) arg1, (GLclampf) arg2, (GLclampf) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBlendEquationCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glBlendEquation((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBlendEquationSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glBlendEquationSeparate((GLenum) arg0, (GLenum) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBlendFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glBlendFunc((GLenum) arg0, (GLenum) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCallListCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glCallList((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClearCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glClear((GLbitfield) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClearAccumCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glClearAccum((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClearColorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glClearColor((GLclampf) arg0, (GLclampf) arg1, (GLclampf) arg2, (GLclampf) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClearDepthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glClearDepth((GLclampd) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClearIndexCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glClearIndex((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClearStencilCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glClearStencil((GLint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClipPlaneCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glClipPlane((GLenum) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3bCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glColor3b((GLbyte) arg0, (GLbyte) arg1, (GLbyte) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3bvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLbyte* arg0 = new  GLbyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLbyte aux = ( GLbyte)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3bv((const GLbyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glColor3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glColor3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glColor3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glColor3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3ubCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glColor3ub((GLubyte) arg0, (GLubyte) arg1, (GLubyte) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3ubvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLubyte* arg0 = new  GLubyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3ubv((const GLubyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3uiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glColor3ui((GLuint) arg0, (GLuint) arg1, (GLuint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3uivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLuint* arg0 = new  GLuint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3uiv((const GLuint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3usCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glColor3us((GLushort) arg0, (GLushort) arg1, (GLushort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor3usvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLushort* arg0 = new  GLushort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLushort aux = ( GLushort)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor3usv((const GLushort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4bCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glColor4b((GLbyte) arg0, (GLbyte) arg1, (GLbyte) arg2, (GLbyte) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4bvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLbyte* arg0 = new  GLbyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLbyte aux = ( GLbyte)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4bv((const GLbyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glColor4d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glColor4f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glColor4i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glColor4s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4ubCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glColor4ub((GLubyte) arg0, (GLubyte) arg1, (GLubyte) arg2, (GLubyte) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4ubvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLubyte* arg0 = new  GLubyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4ubv((const GLubyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4uiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glColor4ui((GLuint) arg0, (GLuint) arg1, (GLuint) arg2, (GLuint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4uivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLuint* arg0 = new  GLuint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4uiv((const GLuint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4usCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glColor4us((GLushort) arg0, (GLushort) arg1, (GLushort) arg2, (GLushort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColor4usvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLushort* arg0 = new  GLushort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLushort aux = ( GLushort)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glColor4usv((const GLushort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColorMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glColorMask((GLboolean) arg0, (GLboolean) arg1, (GLboolean) arg2, (GLboolean) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColorMaterialCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glColorMaterial((GLenum) arg0, (GLenum) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColorTableParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glColorTableParameterfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglColorTableParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glColorTableParameteriv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglConvolutionParameterfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glConvolutionParameterf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglConvolutionParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glConvolutionParameterfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglConvolutionParameteriCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glConvolutionParameteri((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglConvolutionParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glConvolutionParameteriv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyColorSubTableCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glCopyColorSubTable((GLenum) arg0, (GLsizei) arg1, (GLint) arg2, (GLint) arg3, (GLsizei) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyColorTableCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glCopyColorTable((GLenum) arg0, (GLenum) arg1, (GLint) arg2, (GLint) arg3, (GLsizei) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyConvolutionFilter1DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glCopyConvolutionFilter1D((GLenum) arg0, (GLenum) arg1, (GLint) arg2, (GLint) arg3, (GLsizei) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyConvolutionFilter2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();

  //make call
  glCopyConvolutionFilter2D((GLenum) arg0, (GLenum) arg1, (GLint) arg2, (GLint) arg3, (GLsizei) arg4, (GLsizei) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyPixelsCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glCopyPixels((GLint) arg0, (GLint) arg1, (GLsizei) arg2, (GLsizei) arg3, (GLenum) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyTexImage1DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 7) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();
  int arg6 = args[6]->IntegerValue();

  //make call
  glCopyTexImage1D((GLenum) arg0, (GLint) arg1, (GLenum) arg2, (GLint) arg3, (GLint) arg4, (GLsizei) arg5, (GLint) arg6);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyTexImage2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 8) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();
  int arg6 = args[6]->IntegerValue();
  int arg7 = args[7]->IntegerValue();

  //make call
  glCopyTexImage2D((GLenum) arg0, (GLint) arg1, (GLenum) arg2, (GLint) arg3, (GLint) arg4, (GLsizei) arg5, (GLsizei) arg6, (GLint) arg7);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyTexSubImage1DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();

  //make call
  glCopyTexSubImage1D((GLenum) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4, (GLsizei) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyTexSubImage2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 8) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();
  int arg6 = args[6]->IntegerValue();
  int arg7 = args[7]->IntegerValue();

  //make call
  glCopyTexSubImage2D((GLenum) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4, (GLint) arg5, (GLsizei) arg6, (GLsizei) arg7);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCopyTexSubImage3DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 9) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();
  int arg6 = args[6]->IntegerValue();
  int arg7 = args[7]->IntegerValue();
  int arg8 = args[8]->IntegerValue();

  //make call
  glCopyTexSubImage3D((GLenum) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4, (GLint) arg5, (GLint) arg6, (GLsizei) arg7, (GLsizei) arg8);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCullFaceCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glCullFace((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDeleteListsCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

  //make call
  glDeleteLists((GLuint) arg0, (GLsizei) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDeleteTexturesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glDeleteTextures((GLsizei) arg0, (const GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDepthFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glDepthFunc((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDepthMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDepthMask((GLboolean) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDepthRangeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glDepthRange((GLclampd) arg0, (GLclampd) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDisableCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glDisable((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDisableClientStateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glDisableClientState((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDrawArraysCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glDrawArrays((GLenum) arg0, (GLint) arg1, (GLsizei) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDrawBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glDrawBuffer((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEdgeFlagCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glEdgeFlag((GLboolean) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEdgeFlagvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLboolean* arg0 = new  GLboolean[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLboolean aux = ( GLboolean)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glEdgeFlagv((const GLboolean*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEnableCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glEnable((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEnableClientStateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glEnableClientState((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEndCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glEnd();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEndListCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glEndList();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord1dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glEvalCoord1d((GLdouble) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord1dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glEvalCoord1dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glEvalCoord1f((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glEvalCoord1fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glEvalCoord2d((GLdouble) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glEvalCoord2dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glEvalCoord2f((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalCoord2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glEvalCoord2fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalMesh1Callback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glEvalMesh1((GLenum) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalMesh2Callback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glEvalMesh2((GLenum) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalPoint1Callback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glEvalPoint1((GLint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEvalPoint2Callback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glEvalPoint2((GLint) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFeedbackBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glFeedbackBuffer((GLsizei) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFinishCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glFinish();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFlushCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glFlush();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glFogf((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glFogfv((GLenum) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glFogi((GLenum) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glFogiv((GLenum) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFrontFaceCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glFrontFace((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFrustumCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();
  double arg5 = args[5]->NumberValue();

  //make call
  glFrustum((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3, (GLdouble) arg4, (GLdouble) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGenListsCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  args.GetReturnValue().Set(glGenLists((GLsizei) arg0));
}




void GLglGenTexturesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLuint* arg1 = new GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGenTextures((GLsizei) arg0, (GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetBooleanvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLboolean* arg1 = new GLboolean[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLboolean aux = (GLboolean)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetBooleanv((GLenum) arg0, (GLboolean*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetClipPlaneCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLdouble* arg1 = new GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLdouble aux = (GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetClipPlane((GLenum) arg0, (GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetColorTableParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetColorTableParameterfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetColorTableParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetColorTableParameteriv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetConvolutionParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetConvolutionParameterfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetConvolutionParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetConvolutionParameteriv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetDoublevCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLdouble* arg1 = new GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLdouble aux = (GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetDoublev((GLenum) arg0, (GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetErrorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  args.GetReturnValue().Set(glGetError());
}




void GLglGetFloatvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLfloat* arg1 = new GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetFloatv((GLenum) arg0, (GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetHistogramParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetHistogramParameterfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetHistogramParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetHistogramParameteriv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetIntegervCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLint* arg1 = new GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetIntegerv((GLenum) arg0, (GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetLightfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetLightfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetLightivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetLightiv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMapdvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLdouble* arg2 = new GLdouble[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLdouble aux = (GLdouble)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMapdv((GLenum) arg0, (GLenum) arg1, (GLdouble*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMapfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMapfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMapivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMapiv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMaterialfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMaterialfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMaterialivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMaterialiv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMinmaxParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMinmaxParameterfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetMinmaxParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetMinmaxParameteriv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetPixelMapfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLfloat* arg1 = new GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetPixelMapfv((GLenum) arg0, (GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetPixelMapuivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLuint* arg1 = new GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetPixelMapuiv((GLenum) arg0, (GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetPixelMapusvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLushort* arg1 = new GLushort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLushort aux = (GLushort)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGetPixelMapusv((GLenum) arg0, (GLushort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetPolygonStippleCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
  GLubyte* arg0 = new GLubyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLubyte aux = (GLubyte)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glGetPolygonStipple((GLubyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexEnvfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexEnvfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexEnvivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexEnviv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexGendvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLdouble* arg2 = new GLdouble[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLdouble aux = (GLdouble)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexGendv((GLenum) arg0, (GLenum) arg1, (GLdouble*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexGenfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexGenfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexGenivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexGeniv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexLevelParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
  GLfloat* arg3 = new GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glGetTexLevelParameterfv((GLenum) arg0, (GLint) arg1, (GLenum) arg2, (GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexLevelParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
  GLint* arg3 = new GLint[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glGetTexLevelParameteriv((GLenum) arg0, (GLint) arg1, (GLenum) arg2, (GLint*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexParameterfv((GLenum) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetTexParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetTexParameteriv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglHintCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glHint((GLenum) arg0, (GLenum) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglHistogramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glHistogram((GLenum) arg0, (GLsizei) arg1, (GLenum) arg2, (GLboolean) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glIndexMask((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexdCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glIndexd((GLdouble) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexdvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glIndexdv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glIndexf((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glIndexfv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glIndexi((GLint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glIndexiv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexsCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glIndexs((GLshort) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexsvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glIndexsv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexubCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glIndexub((GLubyte) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIndexubvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLubyte* arg0 = new  GLubyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glIndexubv((const GLubyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglInitNamesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glInitNames();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIsEnabledCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  args.GetReturnValue().Set(glIsEnabled((GLenum) arg0));
}




void GLglIsListCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsList((GLuint) arg0));
}




void GLglIsTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsTexture((GLuint) arg0));
}




void GLglLightModelfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glLightModelf((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightModelfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glLightModelfv((GLenum) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightModeliCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glLightModeli((GLenum) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightModelivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glLightModeliv((GLenum) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glLightf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glLightfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glLighti((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLightivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glLightiv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLineStippleCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glLineStipple((GLint) arg0, (GLushort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLineWidthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glLineWidth((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglListBaseCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glListBase((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLoadIdentityCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glLoadIdentity();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLoadMatrixdCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glLoadMatrixd((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLoadMatrixfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glLoadMatrixf((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLoadNameCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glLoadName((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLogicOpCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glLogicOp((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMap1dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

    
  Handle<Array> arrHandle5 = Handle<Array>::Cast(args[5]);
   GLdouble* arg5 = new  GLdouble[arrHandle5->Length()];
  for (unsigned j = 0; j < arrHandle5->Length(); j++) {
      Handle<Value> arg(arrHandle5->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg5[j] = aux; 
  }
    
    
  //make call
  glMap1d((GLenum) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLint) arg3, (GLint) arg4, (const GLdouble*) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMap1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

    
  Handle<Array> arrHandle5 = Handle<Array>::Cast(args[5]);
   GLfloat* arg5 = new  GLfloat[arrHandle5->Length()];
  for (unsigned j = 0; j < arrHandle5->Length(); j++) {
      Handle<Value> arg(arrHandle5->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg5[j] = aux; 
  }
    
    
  //make call
  glMap1f((GLenum) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLint) arg3, (GLint) arg4, (const GLfloat*) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMap2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 10) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  double arg5 = args[5]->NumberValue();
  double arg6 = args[6]->NumberValue();
  int arg7 = args[7]->IntegerValue();
  int arg8 = args[8]->IntegerValue();

    
  Handle<Array> arrHandle9 = Handle<Array>::Cast(args[9]);
   GLdouble* arg9 = new  GLdouble[arrHandle9->Length()];
  for (unsigned j = 0; j < arrHandle9->Length(); j++) {
      Handle<Value> arg(arrHandle9->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg9[j] = aux; 
  }
    
    
  //make call
  glMap2d((GLenum) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLint) arg3, (GLint) arg4, (GLdouble) arg5, (GLdouble) arg6, (GLint) arg7, (GLint) arg8, (const GLdouble*) arg9);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMap2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 10) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  double arg5 = args[5]->NumberValue();
  double arg6 = args[6]->NumberValue();
  int arg7 = args[7]->IntegerValue();
  int arg8 = args[8]->IntegerValue();

    
  Handle<Array> arrHandle9 = Handle<Array>::Cast(args[9]);
   GLfloat* arg9 = new  GLfloat[arrHandle9->Length()];
  for (unsigned j = 0; j < arrHandle9->Length(); j++) {
      Handle<Value> arg(arrHandle9->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg9[j] = aux; 
  }
    
    
  //make call
  glMap2f((GLenum) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLint) arg3, (GLint) arg4, (GLfloat) arg5, (GLfloat) arg6, (GLint) arg7, (GLint) arg8, (const GLfloat*) arg9);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMapGrid1dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glMapGrid1d((GLint) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMapGrid1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glMapGrid1f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMapGrid2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  int arg3 = args[3]->IntegerValue();
  double arg4 = args[4]->NumberValue();
  double arg5 = args[5]->NumberValue();

  //make call
  glMapGrid2d((GLint) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLint) arg3, (GLdouble) arg4, (GLdouble) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMapGrid2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  int arg3 = args[3]->IntegerValue();
  double arg4 = args[4]->NumberValue();
  double arg5 = args[5]->NumberValue();

  //make call
  glMapGrid2f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLint) arg3, (GLfloat) arg4, (GLfloat) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMaterialfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glMaterialf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMaterialfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glMaterialfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMaterialiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glMateriali((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMaterialivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glMaterialiv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMatrixModeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glMatrixMode((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMinmaxCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glMinmax((GLenum) arg0, (GLenum) arg1, (GLboolean) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultMatrixdCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glMultMatrixd((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultMatrixfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glMultMatrixf((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNewListCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

  //make call
  glNewList((GLuint) arg0, (GLenum) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3bCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glNormal3b((GLbyte) arg0, (GLbyte) arg1, (GLbyte) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3bvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLbyte* arg0 = new  GLbyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLbyte aux = ( GLbyte)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glNormal3bv((const GLbyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glNormal3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glNormal3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glNormal3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glNormal3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glNormal3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glNormal3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glNormal3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglNormal3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glNormal3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglOrthoCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();
  double arg5 = args[5]->NumberValue();

  //make call
  glOrtho((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3, (GLdouble) arg4, (GLdouble) arg5);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPassThroughCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glPassThrough((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelMapfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glPixelMapfv((GLenum) arg0, (GLint) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelMapuivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLuint* arg2 = new  GLuint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg2[j] = aux; 
  }
    
    
  //make call
  glPixelMapuiv((GLenum) arg0, (GLint) arg1, (const GLuint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelMapusvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLushort* arg2 = new  GLushort[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLushort aux = ( GLushort)arg->Uint32Value();
      arg2[j] = aux; 
  }
    
    
  //make call
  glPixelMapusv((GLenum) arg0, (GLint) arg1, (const GLushort*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelStorefCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glPixelStoref((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelStoreiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glPixelStorei((GLenum) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelTransferfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glPixelTransferf((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelTransferiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glPixelTransferi((GLenum) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPixelZoomCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glPixelZoom((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPointSizeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glPointSize((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPolygonModeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glPolygonMode((GLenum) arg0, (GLenum) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPolygonOffsetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glPolygonOffset((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPolygonStippleCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLubyte* arg0 = new  GLubyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glPolygonStipple((const GLubyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPopAttribCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glPopAttrib();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPopClientAttribCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glPopClientAttrib();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPopMatrixCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glPopMatrix();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPopNameCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glPopName();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPrioritizeTexturesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLclampf* arg2 = new  GLclampf[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLclampf aux = ( GLclampf)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glPrioritizeTextures((GLsizei) arg0, (const GLuint*) arg1, (const GLclampf*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPushAttribCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glPushAttrib((GLbitfield) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPushClientAttribCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glPushClientAttrib((GLbitfield) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPushMatrixCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glPushMatrix();
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPushNameCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glPushName((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glRasterPos2d((GLdouble) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos2dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glRasterPos2f((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos2fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glRasterPos2i((GLint) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos2iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glRasterPos2s((GLshort) arg0, (GLshort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos2svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos2sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glRasterPos3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glRasterPos3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glRasterPos3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glRasterPos3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glRasterPos4d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos4dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glRasterPos4f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos4fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glRasterPos4i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos4iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glRasterPos4s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRasterPos4svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glRasterPos4sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglReadBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glReadBuffer((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectdCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glRectd((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectdvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glRectdv((const GLdouble*) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glRectf((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glRectfv((const GLfloat*) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glRecti((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glRectiv((const GLint*) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectsCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glRects((GLshort) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRectsvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glRectsv((const GLshort*) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRenderModeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  args.GetReturnValue().Set(glRenderMode((GLenum) arg0));
}




void GLglResetHistogramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glResetHistogram((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglResetMinmaxCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glResetMinmax((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRotatedCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glRotated((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglRotatefCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glRotatef((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglScaledCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glScaled((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglScalefCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glScalef((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglScissorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glScissor((GLint) arg0, (GLint) arg1, (GLsizei) arg2, (GLsizei) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSelectBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLuint* arg1 = new GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glSelectBuffer((GLsizei) arg0, (GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglShadeModelCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glShadeModel((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglStencilFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glStencilFunc((GLenum) arg0, (GLint) arg1, (GLuint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglStencilMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glStencilMask((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglStencilOpCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glStencilOp((GLenum) arg0, (GLenum) arg1, (GLenum) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glTexCoord1d((GLdouble) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord1dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glTexCoord1f((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord1fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glTexCoord1i((GLint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord1iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glTexCoord1s((GLshort) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord1svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord1sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glTexCoord2d((GLdouble) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord2dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glTexCoord2f((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord2fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glTexCoord2i((GLint) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord2iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glTexCoord2s((GLshort) arg0, (GLshort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord2svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord2sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexCoord3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexCoord3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glTexCoord3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glTexCoord3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glTexCoord4d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord4dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glTexCoord4f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord4fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glTexCoord4i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord4iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glTexCoord4s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexCoord4svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glTexCoord4sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexEnvfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexEnvf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexEnvfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexEnvfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexEnviCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glTexEnvi((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexEnvivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexEnviv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexGendCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexGend((GLenum) arg0, (GLenum) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexGendvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLdouble* arg2 = new  GLdouble[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexGendv((GLenum) arg0, (GLenum) arg1, (const GLdouble*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexGenfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexGenf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexGenfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexGenfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexGeniCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glTexGeni((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexGenivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexGeniv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexParameterfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexParameterf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexParameterfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexParameteriCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glTexParameteri((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTexParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glTexParameteriv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTranslatedCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTranslated((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglTranslatefCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glTranslatef((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glVertex2d((GLdouble) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex2dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glVertex2f((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex2fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glVertex2i((GLint) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex2iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glVertex2s((GLshort) arg0, (GLshort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex2svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex2sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glVertex3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glVertex3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glVertex3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glVertex3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glVertex4d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex4dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glVertex4f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex4fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glVertex4i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex4iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glVertex4s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertex4svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glVertex4sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglViewportCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glViewport((GLint) arg0, (GLint) arg1, (GLsizei) arg2, (GLsizei) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSampleCoverageCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glSampleCoverage((GLclampf) arg0, (GLboolean) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLoadTransposeMatrixfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glLoadTransposeMatrixf((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLoadTransposeMatrixdCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glLoadTransposeMatrixd((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultTransposeMatrixfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glMultTransposeMatrixf((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultTransposeMatrixdCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glMultTransposeMatrixd((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglActiveTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glActiveTexture((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglClientActiveTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glClientActiveTexture((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glMultiTexCoord1d((GLenum) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord1dv((GLenum) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glMultiTexCoord1f((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord1fv((GLenum) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glMultiTexCoord1i((GLenum) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord1iv((GLenum) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glMultiTexCoord1s((GLenum) arg0, (GLshort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord1svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord1sv((GLenum) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glMultiTexCoord2d((GLenum) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord2dv((GLenum) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glMultiTexCoord2f((GLenum) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord2fv((GLenum) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glMultiTexCoord2i((GLenum) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord2iv((GLenum) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glMultiTexCoord2s((GLenum) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord2svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord2sv((GLenum) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glMultiTexCoord3d((GLenum) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord3dv((GLenum) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glMultiTexCoord3f((GLenum) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord3fv((GLenum) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glMultiTexCoord3i((GLenum) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord3iv((GLenum) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glMultiTexCoord3s((GLenum) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord3sv((GLenum) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glMultiTexCoord4d((GLenum) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3, (GLdouble) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord4dv((GLenum) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glMultiTexCoord4f((GLenum) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3, (GLfloat) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord4fv((GLenum) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord4iv((GLenum) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glMultiTexCoord4s((GLenum) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3, (GLshort) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiTexCoord4svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glMultiTexCoord4sv((GLenum) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogCoordfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glFogCoordf((GLfloat) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogCoordfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glFogCoordfv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglFogCoorddCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glFogCoordd((GLdouble) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3bCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glSecondaryColor3b((GLbyte) arg0, (GLbyte) arg1, (GLbyte) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3bvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLbyte* arg0 = new  GLbyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLbyte aux = ( GLbyte)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3bv((const GLbyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glSecondaryColor3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glSecondaryColor3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glSecondaryColor3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glSecondaryColor3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3ubCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glSecondaryColor3ub((GLubyte) arg0, (GLubyte) arg1, (GLubyte) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3ubvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLubyte* arg0 = new  GLubyte[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3ubv((const GLubyte*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3uiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glSecondaryColor3ui((GLuint) arg0, (GLuint) arg1, (GLuint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3uivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLuint* arg0 = new  GLuint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3uiv((const GLuint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3usCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glSecondaryColor3us((GLushort) arg0, (GLushort) arg1, (GLushort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglSecondaryColor3usvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLushort* arg0 = new  GLushort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLushort aux = ( GLushort)arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  //make call
  glSecondaryColor3usv((const GLushort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPointParameterfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glPointParameterf((GLenum) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPointParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLfloat* arg1 = new GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glPointParameterfv((GLenum) arg0, (GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPointParameteriCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glPointParameteri((GLenum) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglPointParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLint* arg1 = new GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glPointParameteriv((GLenum) arg0, (GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBlendFuncSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glBlendFuncSeparate((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLenum) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglMultiDrawArraysCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLint* arg1 = new GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLsizei* arg2 = new GLsizei[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLsizei aux = (GLsizei)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
      int arg3 = args[3]->IntegerValue();

  //make call
  glMultiDrawArrays((GLenum) arg0, (GLint*) arg1, (GLsizei*) arg2, (GLsizei) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glWindowPos2d((GLdouble) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos2dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glWindowPos2f((GLfloat) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos2fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glWindowPos2i((GLint) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos2iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glWindowPos2s((GLshort) arg0, (GLshort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos2svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos2sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glWindowPos3d((GLdouble) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLdouble* arg0 = new  GLdouble[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos3dv((const GLdouble*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glWindowPos3f((GLfloat) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLfloat* arg0 = new  GLfloat[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos3fv((const GLfloat*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glWindowPos3i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLint* arg0 = new  GLint[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos3iv((const GLint*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glWindowPos3s((GLshort) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglWindowPos3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

    
  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
   GLshort* arg0 = new  GLshort[arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg0[j] = aux; 
  }
    
    
  //make call
  glWindowPos3sv((const GLshort*) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGenQueriesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLuint* arg1 = new GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGenQueries((GLsizei) arg0, (GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDeleteQueriesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glDeleteQueries((GLsizei) arg0, (const GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIsQueryCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsQuery((GLuint) arg0));
}




void GLglBeginQueryCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBeginQuery((GLenum) arg0, (GLuint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEndQueryCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glEndQuery((GLenum) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetQueryivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetQueryiv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetQueryObjectivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetQueryObjectiv((GLuint) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetQueryObjectuivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLuint* arg2 = new GLuint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetQueryObjectuiv((GLuint) arg0, (GLenum) arg1, (GLuint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglBindBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBindBuffer((GLenum) arg0, (GLuint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDeleteBuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glDeleteBuffers((GLsizei) arg0, (const GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGenBuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLuint* arg1 = new GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glGenBuffers((GLsizei) arg0, (GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIsBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsBuffer((GLuint) arg0));
}




void GLglUnmapBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  args.GetReturnValue().Set(glUnmapBuffer((GLenum) arg0));
}




void GLglGetBufferParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetBufferParameteriv((GLenum) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDrawBuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLenum* arg1 = new  GLenum[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLenum aux = ( GLenum)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glDrawBuffers((GLsizei) arg0, (const GLenum*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib1dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();

  //make call
  glVertexAttrib1d((GLuint) arg0, (GLdouble) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib1dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib1dv((GLuint) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();

  //make call
  glVertexAttrib1f((GLuint) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib1fv((GLuint) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib1sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

  //make call
  glVertexAttrib1s((GLuint) arg0, (GLshort) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib1svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib1sv((GLuint) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib2dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glVertexAttrib2d((GLuint) arg0, (GLdouble) arg1, (GLdouble) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib2dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib2dv((GLuint) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glVertexAttrib2f((GLuint) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib2fv((GLuint) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib2sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glVertexAttrib2s((GLuint) arg0, (GLshort) arg1, (GLshort) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib2svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib2sv((GLuint) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib3dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glVertexAttrib3d((GLuint) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib3dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib3dv((GLuint) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glVertexAttrib3f((GLuint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib3fv((GLuint) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib3sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glVertexAttrib3s((GLuint) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib3svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib3sv((GLuint) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NbvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLbyte* arg1 = new  GLbyte[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLbyte aux = ( GLbyte)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4Nbv((GLuint) arg0, (const GLbyte*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4Niv((GLuint) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NsvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4Nsv((GLuint) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NubCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();
  unsigned int arg4 = args[4]->Uint32Value();

  //make call
  glVertexAttrib4Nub((GLuint) arg0, (GLubyte) arg1, (GLubyte) arg2, (GLubyte) arg3, (GLubyte) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NubvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLubyte* arg1 = new  GLubyte[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4Nubv((GLuint) arg0, (const GLubyte*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NuivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4Nuiv((GLuint) arg0, (const GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4NusvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLushort* arg1 = new  GLushort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLushort aux = ( GLushort)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4Nusv((GLuint) arg0, (const GLushort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4bvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLbyte* arg1 = new  GLbyte[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLbyte aux = ( GLbyte)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4bv((GLuint) arg0, (const GLbyte*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4dCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glVertexAttrib4d((GLuint) arg0, (GLdouble) arg1, (GLdouble) arg2, (GLdouble) arg3, (GLdouble) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4dvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLdouble* arg1 = new  GLdouble[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLdouble aux = ( GLdouble)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4dv((GLuint) arg0, (const GLdouble*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glVertexAttrib4f((GLuint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3, (GLfloat) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4fv((GLuint) arg0, (const GLfloat*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLint* arg1 = new  GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4iv((GLuint) arg0, (const GLint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4sCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glVertexAttrib4s((GLuint) arg0, (GLshort) arg1, (GLshort) arg2, (GLshort) arg3, (GLshort) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4svCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLshort* arg1 = new  GLshort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLshort aux = ( GLshort)arg->IntegerValue();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4sv((GLuint) arg0, (const GLshort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4ubvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLubyte* arg1 = new  GLubyte[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLubyte aux = ( GLubyte)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4ubv((GLuint) arg0, (const GLubyte*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4uivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4uiv((GLuint) arg0, (const GLuint*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglVertexAttrib4usvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLushort* arg1 = new  GLushort[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLushort aux = ( GLushort)arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  glVertexAttrib4usv((GLuint) arg0, (const GLushort*) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglEnableVertexAttribArrayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glEnableVertexAttribArray((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDisableVertexAttribArrayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDisableVertexAttribArray((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetVertexAttribdvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLdouble* arg2 = new GLdouble[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLdouble aux = (GLdouble)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetVertexAttribdv((GLuint) arg0, (GLenum) arg1, (GLdouble*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetVertexAttribfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetVertexAttribfv((GLuint) arg0, (GLenum) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetVertexAttribivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetVertexAttribiv((GLuint) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDeleteShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDeleteShader((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDetachShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glDetachShader((GLuint) arg0, (GLuint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCreateShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  args.GetReturnValue().Set(glCreateShader((GLenum) arg0));
}




void GLglCompileShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glCompileShader((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglCreateProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  args.GetReturnValue().Set(glCreateProgram());
}




void GLglAttachShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glAttachShader((GLuint) arg0, (GLuint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglLinkProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glLinkProgram((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUseProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glUseProgram((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglDeleteProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDeleteProgram((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglValidateProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glValidateProgram((GLuint) arg0);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glUniform1f((GLint) arg0, (GLfloat) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glUniform2f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glUniform3f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glUniform4f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3, (GLfloat) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform1iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glUniform1i((GLint) arg0, (GLint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glUniform2i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glUniform3i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform4iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glUniform4i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform1fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform2fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform3fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform4fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform1ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform1iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform2iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform3iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniform4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glUniform4iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix2fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix3fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix4fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglIsShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsShader((GLuint) arg0));
}




void GLglIsProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsProgram((GLuint) arg0));
}




void GLglGetShaderivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetShaderiv((GLuint) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetProgramivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetProgramiv((GLuint) arg0, (GLenum) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetAttachedShadersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLsizei* arg2 = new GLsizei[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLsizei aux = (GLsizei)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
  GLuint* arg3 = new GLuint[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLuint aux = (GLuint)arg->Uint32Value();
      arg3[j] = aux; 
  }
    
    
  //make call
  glGetAttachedShaders((GLuint) arg0, (GLsizei) arg1, (GLsizei*) arg2, (GLuint*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetUniformfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLfloat* arg2 = new GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetUniformfv((GLuint) arg0, (GLint) arg1, (GLfloat*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglGetUniformivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

    
  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux; 
  }
    
    
  //make call
  glGetUniformiv((GLuint) arg0, (GLint) arg1, (GLint*) arg2);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglStencilFuncSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glStencilFuncSeparate((GLenum) arg0, (GLenum) arg1, (GLint) arg2, (GLuint) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglStencilOpSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glStencilOpSeparate((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLenum) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglStencilMaskSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glStencilMaskSeparate((GLenum) arg0, (GLuint) arg1);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix2x3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix2x3fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix3x2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix3x2fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix2x4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix2x4fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix4x2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix4x2fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix3x4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix3x4fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




void GLglUniformMatrix4x3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

    
  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux; 
  }
    
    
  //make call
  glUniformMatrix4x3fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Local<Object> res = Local<Object>::New(v8::Isolate::GetCurrent(), GlFactory::self_);
  args.GetReturnValue().Set(res);
}




Handle<ObjectTemplate> GlFactory::createGl(void) {
      Handle<ObjectTemplate> Gl = ObjectTemplate::New(v8::Isolate::GetCurrent());
      
      Gl->SetInternalFieldCount(1);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LOGIC_OP"), Uint32::New(v8::Isolate::GetCurrent(), GL_LOGIC_OP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COMPONENTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COMPONENTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_1"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_1_1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_2"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_1_2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_3"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_1_3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_1_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_5"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_1_5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_2_0"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_2_0), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_2_1"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION_2_1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LOAD"), Uint32::New(v8::Isolate::GetCurrent(), GL_LOAD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RETURN"), Uint32::New(v8::Isolate::GetCurrent(), GL_RETURN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MULT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MULT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ADD"), Uint32::New(v8::Isolate::GetCurrent(), GL_ADD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEVER"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEVER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LESS"), Uint32::New(v8::Isolate::GetCurrent(), GL_LESS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_EQUAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LEQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_LEQUAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREATER"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREATER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NOTEQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_NOTEQUAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GEQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_GEQUAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALWAYS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALWAYS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_STIPPLE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_STIPPLE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MODE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MODE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHTING_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHTING_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_BUFFER_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM_BUFFER_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BUFFER_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIEWPORT_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_VIEWPORT_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRANSFORM_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRANSFORM_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ENABLE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_ENABLE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_BUFFER_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HINT_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_HINT_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EVAL_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_EVAL_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIST_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIST_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCISSOR_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SCISSOR_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALL_ATTRIB_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALL_ATTRIB_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINES"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_LOOP"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_LOOP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_STRIP"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_STRIP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRIANGLES"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRIANGLES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRIANGLE_STRIP"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRIANGLE_STRIP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRIANGLE_FAN"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRIANGLE_FAN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "QUADS"), Uint32::New(v8::Isolate::GetCurrent(), GL_QUADS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "QUAD_STRIP"), Uint32::New(v8::Isolate::GetCurrent(), GL_QUAD_STRIP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ZERO"), Uint32::New(v8::Isolate::GetCurrent(), GL_ZERO), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_SRC_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_SRC_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_SRC_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_SRC_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DST_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_DST_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_DST_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_DST_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DST_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_DST_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_DST_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_DST_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC_ALPHA_SATURATE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC_ALPHA_SATURATE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FALSE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FALSE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIP_PLANE0"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIP_PLANE0), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIP_PLANE1"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIP_PLANE1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIP_PLANE2"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIP_PLANE2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIP_PLANE3"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIP_PLANE3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIP_PLANE4"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIP_PLANE4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIP_PLANE5"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIP_PLANE5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BYTE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BYTE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_BYTE"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_BYTE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHORT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHORT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_INT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "2_BYTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_2_BYTES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "3_BYTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_3_BYTES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "4_BYTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_4_BYTES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOUBLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DOUBLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NONE"), Uint32::New(v8::Isolate::GetCurrent(), GL_NONE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT_LEFT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT_LEFT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT_RIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT_RIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BACK_LEFT"), Uint32::New(v8::Isolate::GetCurrent(), GL_BACK_LEFT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BACK_RIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_BACK_RIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BACK"), Uint32::New(v8::Isolate::GetCurrent(), GL_BACK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LEFT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LEFT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_RIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT_AND_BACK"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT_AND_BACK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUX0"), Uint32::New(v8::Isolate::GetCurrent(), GL_AUX0), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUX1"), Uint32::New(v8::Isolate::GetCurrent(), GL_AUX1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUX2"), Uint32::New(v8::Isolate::GetCurrent(), GL_AUX2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUX3"), Uint32::New(v8::Isolate::GetCurrent(), GL_AUX3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NO_ERROR"), Uint32::New(v8::Isolate::GetCurrent(), GL_NO_ERROR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_ENUM"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVALID_ENUM), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVALID_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STACK_OVERFLOW"), Uint32::New(v8::Isolate::GetCurrent(), GL_STACK_OVERFLOW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STACK_UNDERFLOW"), Uint32::New(v8::Isolate::GetCurrent(), GL_STACK_UNDERFLOW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OUT_OF_MEMORY"), Uint32::New(v8::Isolate::GetCurrent(), GL_OUT_OF_MEMORY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "3D"), Uint32::New(v8::Isolate::GetCurrent(), GL_3D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "3D_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_3D_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "3D_COLOR_TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_3D_COLOR_TEXTURE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "4D_COLOR_TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_4D_COLOR_TEXTURE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PASS_THROUGH_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_PASS_THROUGH_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_BITMAP_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_PIXEL_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_PIXEL_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COPY_PIXEL_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_COPY_PIXEL_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_RESET_TOKEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_RESET_TOKEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXP"), Uint32::New(v8::Isolate::GetCurrent(), GL_EXP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXP2"), Uint32::New(v8::Isolate::GetCurrent(), GL_EXP2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CW"), Uint32::New(v8::Isolate::GetCurrent(), GL_CW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CCW"), Uint32::New(v8::Isolate::GetCurrent(), GL_CCW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COEFF"), Uint32::New(v8::Isolate::GetCurrent(), GL_COEFF), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ORDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_ORDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOMAIN"), Uint32::New(v8::Isolate::GetCurrent(), GL_DOMAIN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_NORMAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_NORMAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_TEXTURE_COORDS"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_TEXTURE_COORDS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_TEXTURE_COORDS"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_TEXTURE_COORDS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_POSITION"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_POSITION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_POSITION_VALID"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_POSITION_VALID), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_DISTANCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_DISTANCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SMOOTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SMOOTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SIZE_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SIZE_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SIZE_GRANULARITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SIZE_GRANULARITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_SMOOTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_SMOOTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_WIDTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_WIDTH_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_WIDTH_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_WIDTH_GRANULARITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_WIDTH_GRANULARITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_STIPPLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_STIPPLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_STIPPLE_PATTERN"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_STIPPLE_PATTERN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_STIPPLE_REPEAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_STIPPLE_REPEAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIST_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIST_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_LIST_NESTING"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_LIST_NESTING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIST_BASE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIST_BASE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIST_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIST_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_SMOOTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_SMOOTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_STIPPLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_STIPPLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EDGE_FLAG"), Uint32::New(v8::Isolate::GetCurrent(), GL_EDGE_FLAG), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CULL_FACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CULL_FACE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CULL_FACE_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CULL_FACE_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT_FACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT_FACE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHTING"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHTING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT_MODEL_LOCAL_VIEWER"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT_MODEL_LOCAL_VIEWER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT_MODEL_TWO_SIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT_MODEL_TWO_SIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT_MODEL_AMBIENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT_MODEL_AMBIENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADE_MODEL"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADE_MODEL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_MATERIAL_FACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_MATERIAL_FACE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_MATERIAL_PARAMETER"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_MATERIAL_PARAMETER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_MATERIAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_MATERIAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_DENSITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_DENSITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_START"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_START), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_END"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_END), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_TEST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_WRITEMASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_CLEAR_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_FUNC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM_CLEAR_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_TEST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_CLEAR_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_FUNC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_VALUE_MASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_VALUE_MASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_FAIL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_PASS_DEPTH_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_PASS_DEPTH_FAIL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_PASS_DEPTH_PASS"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_PASS_DEPTH_PASS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_REF"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_REF), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_WRITEMASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MATRIX_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MATRIX_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMALIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMALIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIEWPORT"), Uint32::New(v8::Isolate::GetCurrent(), GL_VIEWPORT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MODELVIEW_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MODELVIEW_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROJECTION_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROJECTION_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MODELVIEW_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_MODELVIEW_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROJECTION_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROJECTION_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ATTRIB_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_ATTRIB_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIENT_ATTRIB_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIENT_ATTRIB_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_TEST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_TEST_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_TEST_FUNC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_TEST_REF"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_TEST_REF), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DITHER"), Uint32::New(v8::Isolate::GetCurrent(), GL_DITHER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_DST"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_DST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_SRC"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_SRC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LOGIC_OP_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LOGIC_OP_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_LOGIC_OP"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_LOGIC_OP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_LOGIC_OP"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_LOGIC_OP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUX_BUFFERS"), Uint32::New(v8::Isolate::GetCurrent(), GL_AUX_BUFFERS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "READ_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_READ_BUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCISSOR_BOX"), Uint32::New(v8::Isolate::GetCurrent(), GL_SCISSOR_BOX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCISSOR_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_SCISSOR_TEST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_CLEAR_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_WRITEMASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_CLEAR_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_WRITEMASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOUBLEBUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_DOUBLEBUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STEREO"), Uint32::New(v8::Isolate::GetCurrent(), GL_STEREO), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDER_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDER_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PERSPECTIVE_CORRECTION_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_PERSPECTIVE_CORRECTION_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SMOOTH_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SMOOTH_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_SMOOTH_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_SMOOTH_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_SMOOTH_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_SMOOTH_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_GEN_S"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_GEN_S), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_GEN_T"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_GEN_T), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_GEN_R"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_GEN_R), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_GEN_Q"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_GEN_Q), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_I"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_I), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_S_TO_S"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_S_TO_S), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_R"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_R), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_G"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_G), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_B"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_B), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_A"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_A), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_R_TO_R"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_R_TO_R), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_G_TO_G"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_G_TO_G), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_B_TO_B"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_B_TO_B), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_A_TO_A"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_A_TO_A), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_I_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_I_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_S_TO_S_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_S_TO_S_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_R_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_R_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_G_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_G_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_B_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_B_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_I_TO_A_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_I_TO_A_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_R_TO_R_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_R_TO_R_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_G_TO_G_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_G_TO_G_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_B_TO_B_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_B_TO_B_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_MAP_A_TO_A_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_MAP_A_TO_A_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_SWAP_BYTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_SWAP_BYTES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_LSB_FIRST"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_LSB_FIRST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_ROW_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_ROW_LENGTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_SKIP_ROWS"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_SKIP_ROWS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_SKIP_PIXELS"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_SKIP_PIXELS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_ALIGNMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_ALIGNMENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_SWAP_BYTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_SWAP_BYTES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_LSB_FIRST"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_LSB_FIRST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_ROW_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_ROW_LENGTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_SKIP_ROWS"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_SKIP_ROWS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_SKIP_PIXELS"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_SKIP_PIXELS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_ALIGNMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_ALIGNMENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP_STENCIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP_STENCIL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_SHIFT"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_SHIFT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_OFFSET"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_OFFSET), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RED_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RED_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RED_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_RED_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ZOOM_X"), Uint32::New(v8::Isolate::GetCurrent(), GL_ZOOM_X), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ZOOM_Y"), Uint32::New(v8::Isolate::GetCurrent(), GL_ZOOM_Y), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREEN_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREEN_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREEN_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREEN_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLUE_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLUE_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLUE_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLUE_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_EVAL_ORDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_EVAL_ORDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_LIGHTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_LIGHTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_CLIP_PLANES"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_CLIP_PLANES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_PIXEL_MAP_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_PIXEL_MAP_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_ATTRIB_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_ATTRIB_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_MODELVIEW_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_MODELVIEW_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_NAME_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_NAME_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_PROJECTION_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_PROJECTION_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VIEWPORT_DIMS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VIEWPORT_DIMS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_CLIENT_ATTRIB_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_CLIENT_ATTRIB_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SUBPIXEL_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_SUBPIXEL_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RED_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_RED_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREEN_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREEN_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLUE_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLUE_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM_RED_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM_RED_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM_GREEN_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM_GREEN_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM_BLUE_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM_BLUE_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM_ALPHA_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACCUM_ALPHA_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NAME_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_NAME_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUTO_NORMAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_AUTO_NORMAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_COLOR_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_COLOR_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_NORMAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_NORMAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_TEXTURE_COORD_1"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_TEXTURE_COORD_1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_TEXTURE_COORD_2"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_TEXTURE_COORD_2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_TEXTURE_COORD_3"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_TEXTURE_COORD_3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_TEXTURE_COORD_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_TEXTURE_COORD_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_VERTEX_3"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_VERTEX_3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_VERTEX_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_VERTEX_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_COLOR_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_COLOR_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_NORMAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_NORMAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_TEXTURE_COORD_1"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_TEXTURE_COORD_1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_TEXTURE_COORD_2"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_TEXTURE_COORD_2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_TEXTURE_COORD_3"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_TEXTURE_COORD_3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_TEXTURE_COORD_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_TEXTURE_COORD_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_VERTEX_3"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_VERTEX_3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_VERTEX_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_VERTEX_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_GRID_DOMAIN"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_GRID_DOMAIN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_GRID_SEGMENTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP1_GRID_SEGMENTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_GRID_DOMAIN"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_GRID_DOMAIN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP2_GRID_SEGMENTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAP2_GRID_SEGMENTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_1D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_1D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FEEDBACK_BUFFER_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_FEEDBACK_BUFFER_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FEEDBACK_BUFFER_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FEEDBACK_BUFFER_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FEEDBACK_BUFFER_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FEEDBACK_BUFFER_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SELECTION_BUFFER_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_SELECTION_BUFFER_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SELECTION_BUFFER_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SELECTION_BUFFER_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_WIDTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_HEIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_HEIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_INTERNAL_FORMAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_INTERNAL_FORMAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BORDER_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BORDER_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BORDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BORDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DONT_CARE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DONT_CARE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FASTEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_FASTEST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NICEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_NICEST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT0"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT0), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT1"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT2"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT3"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT4"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT5"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT6"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT6), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT7"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT7), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AMBIENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_AMBIENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DIFFUSE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DIFFUSE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SPECULAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_SPECULAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POSITION"), Uint32::New(v8::Isolate::GetCurrent(), GL_POSITION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SPOT_DIRECTION"), Uint32::New(v8::Isolate::GetCurrent(), GL_SPOT_DIRECTION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SPOT_EXPONENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SPOT_EXPONENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SPOT_CUTOFF"), Uint32::New(v8::Isolate::GetCurrent(), GL_SPOT_CUTOFF), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPILE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPILE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPILE_AND_EXECUTE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPILE_AND_EXECUTE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLEAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AND"), Uint32::New(v8::Isolate::GetCurrent(), GL_AND), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AND_REVERSE"), Uint32::New(v8::Isolate::GetCurrent(), GL_AND_REVERSE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COPY"), Uint32::New(v8::Isolate::GetCurrent(), GL_COPY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AND_INVERTED"), Uint32::New(v8::Isolate::GetCurrent(), GL_AND_INVERTED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NOOP"), Uint32::New(v8::Isolate::GetCurrent(), GL_NOOP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "XOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_XOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OR"), Uint32::New(v8::Isolate::GetCurrent(), GL_OR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_NOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EQUIV"), Uint32::New(v8::Isolate::GetCurrent(), GL_EQUIV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVERT"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVERT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OR_REVERSE"), Uint32::New(v8::Isolate::GetCurrent(), GL_OR_REVERSE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COPY_INVERTED"), Uint32::New(v8::Isolate::GetCurrent(), GL_COPY_INVERTED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OR_INVERTED"), Uint32::New(v8::Isolate::GetCurrent(), GL_OR_INVERTED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NAND"), Uint32::New(v8::Isolate::GetCurrent(), GL_NAND), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SET"), Uint32::New(v8::Isolate::GetCurrent(), GL_SET), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EMISSION"), Uint32::New(v8::Isolate::GetCurrent(), GL_EMISSION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHININESS"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHININESS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AMBIENT_AND_DIFFUSE"), Uint32::New(v8::Isolate::GetCurrent(), GL_AMBIENT_AND_DIFFUSE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_INDEXES"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_INDEXES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MODELVIEW"), Uint32::New(v8::Isolate::GetCurrent(), GL_MODELVIEW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROJECTION"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROJECTION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_INDEX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_COMPONENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_COMPONENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RED"), Uint32::New(v8::Isolate::GetCurrent(), GL_RED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREEN"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREEN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_BITMAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FILL"), Uint32::New(v8::Isolate::GetCurrent(), GL_FILL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FEEDBACK"), Uint32::New(v8::Isolate::GetCurrent(), GL_FEEDBACK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SELECT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SELECT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SMOOTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_SMOOTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEEP"), Uint32::New(v8::Isolate::GetCurrent(), GL_KEEP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REPLACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_REPLACE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INCR"), Uint32::New(v8::Isolate::GetCurrent(), GL_INCR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DECR"), Uint32::New(v8::Isolate::GetCurrent(), GL_DECR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VENDOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_VENDOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERER"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXTENSIONS"), Uint32::New(v8::Isolate::GetCurrent(), GL_EXTENSIONS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "S"), Uint32::New(v8::Isolate::GetCurrent(), GL_S), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T"), Uint32::New(v8::Isolate::GetCurrent(), GL_T), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "R"), Uint32::New(v8::Isolate::GetCurrent(), GL_R), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Q"), Uint32::New(v8::Isolate::GetCurrent(), GL_Q), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MODULATE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MODULATE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DECAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_DECAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_ENV_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_ENV_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_ENV_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_ENV_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_ENV"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_ENV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EYE_LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_EYE_LINEAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OBJECT_LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_OBJECT_LINEAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SPHERE_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_SPHERE_MAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_GEN_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_GEN_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OBJECT_PLANE"), Uint32::New(v8::Isolate::GetCurrent(), GL_OBJECT_PLANE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EYE_PLANE"), Uint32::New(v8::Isolate::GetCurrent(), GL_EYE_PLANE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEAREST"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEAREST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINEAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEAREST_MIPMAP_NEAREST"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEAREST_MIPMAP_NEAREST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINEAR_MIPMAP_NEAREST"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINEAR_MIPMAP_NEAREST), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEAREST_MIPMAP_LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEAREST_MIPMAP_LINEAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINEAR_MIPMAP_LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINEAR_MIPMAP_LINEAR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MAG_FILTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MAG_FILTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MIN_FILTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MIN_FILTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_WRAP_S"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_WRAP_S), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_WRAP_T"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_WRAP_T), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLAMP"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLAMP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REPEAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_REPEAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIENT_PIXEL_STORE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIENT_PIXEL_STORE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIENT_VERTEX_ARRAY_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIENT_VERTEX_ARRAY_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIENT_ALL_ATTRIB_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIENT_ALL_ATTRIB_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_FACTOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_FACTOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_UNITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_POINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_POINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_LINE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_LINE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_FILL"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_FILL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA4"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA8"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA12"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA16"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE4"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE8"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE12"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE16"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE4_ALPHA4"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE4_ALPHA4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE6_ALPHA2"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE6_ALPHA2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE8_ALPHA8"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE8_ALPHA8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE12_ALPHA4"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE12_ALPHA4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE12_ALPHA12"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE12_ALPHA12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE16_ALPHA16"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE16_ALPHA16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTENSITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_INTENSITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTENSITY4"), Uint32::New(v8::Isolate::GetCurrent(), GL_INTENSITY4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTENSITY8"), Uint32::New(v8::Isolate::GetCurrent(), GL_INTENSITY8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTENSITY12"), Uint32::New(v8::Isolate::GetCurrent(), GL_INTENSITY12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTENSITY16"), Uint32::New(v8::Isolate::GetCurrent(), GL_INTENSITY16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "R3_G3_B2"), Uint32::New(v8::Isolate::GetCurrent(), GL_R3_G3_B2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB4"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB5"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB8"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB10"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB10), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB12"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB16"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA2"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA4"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB5_A1"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB5_A1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA8"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB10_A2"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB10_A2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA12"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA16"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_RED_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_RED_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_GREEN_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_GREEN_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BLUE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BLUE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_ALPHA_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_ALPHA_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_LUMINANCE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_LUMINANCE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_INTENSITY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_INTENSITY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_TEXTURE_1D"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_TEXTURE_1D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_TEXTURE_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_TEXTURE_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_PRIORITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_PRIORITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_RESIDENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_RESIDENT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BINDING_1D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BINDING_1D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BINDING_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BINDING_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BINDING_3D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BINDING_3D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMAL_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COORD_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COORD_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EDGE_FLAG_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_EDGE_FLAG_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ARRAY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ARRAY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMAL_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMAL_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ARRAY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ARRAY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COORD_ARRAY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COORD_ARRAY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COORD_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COORD_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COORD_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COORD_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EDGE_FLAG_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_EDGE_FLAG_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMAL_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COORD_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COORD_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EDGE_FLAG_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_EDGE_FLAG_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "V2F"), Uint32::New(v8::Isolate::GetCurrent(), GL_V2F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "C4UB_V2F"), Uint32::New(v8::Isolate::GetCurrent(), GL_C4UB_V2F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "C4UB_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_C4UB_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "C3F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_C3F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "N3F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_N3F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "C4F_N3F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_C4F_N3F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T2F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T2F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T4F_V4F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T4F_V4F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T2F_C4UB_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T2F_C4UB_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T2F_C3F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T2F_C3F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T2F_N3F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T2F_N3F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T2F_C4F_N3F_V3F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T2F_C4F_N3F_V3F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "T4F_C4F_N3F_V4F"), Uint32::New(v8::Isolate::GetCurrent(), GL_T4F_C4F_N3F_V4F), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BGR"), Uint32::New(v8::Isolate::GetCurrent(), GL_BGR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BGRA"), Uint32::New(v8::Isolate::GetCurrent(), GL_BGRA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONSTANT_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONSTANT_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_CONSTANT_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_CONSTANT_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONSTANT_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONSTANT_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_CONSTANT_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_CONSTANT_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FUNC_ADD"), Uint32::New(v8::Isolate::GetCurrent(), GL_FUNC_ADD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MIN"), Uint32::New(v8::Isolate::GetCurrent(), GL_MIN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FUNC_SUBTRACT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FUNC_SUBTRACT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FUNC_REVERSE_SUBTRACT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FUNC_REVERSE_SUBTRACT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_MATRIX_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_MATRIX_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_COLOR_MATRIX_STACK_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_COLOR_MATRIX_STACK_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_RED_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_RED_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_GREEN_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_GREEN_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_BLUE_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_BLUE_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_ALPHA_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_ALPHA_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_RED_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_RED_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_GREEN_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_GREEN_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_BLUE_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_BLUE_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_ALPHA_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_ALPHA_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_COLOR_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_COLOR_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_COLOR_MATRIX_COLOR_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_COLOR_MATRIX_COLOR_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_COLOR_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_COLOR_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_POST_CONVOLUTION_COLOR_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_POST_CONVOLUTION_COLOR_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_POST_COLOR_MATRIX_COLOR_TABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_FORMAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_FORMAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_WIDTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_RED_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_RED_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_GREEN_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_GREEN_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_BLUE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_BLUE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_ALPHA_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_ALPHA_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_LUMINANCE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_LUMINANCE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_TABLE_INTENSITY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_TABLE_INTENSITY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_1D"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_1D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SEPARABLE_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_SEPARABLE_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_BORDER_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_BORDER_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_FILTER_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_FILTER_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_FILTER_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_FILTER_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REDUCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_REDUCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_FORMAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_FORMAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_WIDTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_HEIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_HEIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_CONVOLUTION_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_CONVOLUTION_WIDTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_CONVOLUTION_HEIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_CONVOLUTION_HEIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_RED_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_RED_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_GREEN_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_GREEN_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_BLUE_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_BLUE_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_ALPHA_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_ALPHA_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_RED_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_RED_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_GREEN_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_GREEN_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_BLUE_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_BLUE_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POST_CONVOLUTION_ALPHA_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POST_CONVOLUTION_ALPHA_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONSTANT_BORDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONSTANT_BORDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REPLICATE_BORDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_REPLICATE_BORDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONVOLUTION_BORDER_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONVOLUTION_BORDER_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_ELEMENTS_VERTICES"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_ELEMENTS_VERTICES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_ELEMENTS_INDICES"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_ELEMENTS_INDICES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_HISTOGRAM"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_HISTOGRAM), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_WIDTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_FORMAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_FORMAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_RED_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_RED_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_GREEN_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_GREEN_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_BLUE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_BLUE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_ALPHA_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_ALPHA_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_LUMINANCE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_LUMINANCE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HISTOGRAM_SINK"), Uint32::New(v8::Isolate::GetCurrent(), GL_HISTOGRAM_SINK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MINMAX"), Uint32::New(v8::Isolate::GetCurrent(), GL_MINMAX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MINMAX_FORMAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MINMAX_FORMAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MINMAX_SINK"), Uint32::New(v8::Isolate::GetCurrent(), GL_MINMAX_SINK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TABLE_TOO_LARGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TABLE_TOO_LARGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_BYTE_3_3_2"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_BYTE_3_3_2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_4_4_4_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_4_4_4_4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_5_5_5_1"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_5_5_5_1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_INT_8_8_8_8"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_INT_8_8_8_8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_INT_10_10_10_2"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_INT_10_10_10_2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_BYTE_2_3_3_REV"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_BYTE_2_3_3_REV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_5_6_5"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_5_6_5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_5_6_5_REV"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_5_6_5_REV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_4_4_4_4_REV"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_4_4_4_4_REV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_1_5_5_5_REV"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_1_5_5_5_REV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_INT_8_8_8_8_REV"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_INT_8_8_8_8_REV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_INT_2_10_10_10_REV"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_INT_2_10_10_10_REV), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RESCALE_NORMAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_RESCALE_NORMAL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LIGHT_MODEL_COLOR_CONTROL"), Uint32::New(v8::Isolate::GetCurrent(), GL_LIGHT_MODEL_COLOR_CONTROL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SINGLE_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_SINGLE_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SEPARATE_SPECULAR_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_SEPARATE_SPECULAR_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_SKIP_IMAGES"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_SKIP_IMAGES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_IMAGE_HEIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_IMAGE_HEIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_SKIP_IMAGES"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_SKIP_IMAGES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_IMAGE_HEIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_IMAGE_HEIGHT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_3D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_3D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_TEXTURE_3D"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_TEXTURE_3D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_WRAP_R"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_WRAP_R), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_3D_TEXTURE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_3D_TEXTURE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLAMP_TO_EDGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLAMP_TO_EDGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLAMP_TO_BORDER"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLAMP_TO_BORDER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MIN_LOD"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MIN_LOD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MAX_LOD"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MAX_LOD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BASE_LEVEL"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BASE_LEVEL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MAX_LEVEL"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MAX_LEVEL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SMOOTH_POINT_SIZE_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SMOOTH_POINT_SIZE_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SMOOTH_POINT_SIZE_GRANULARITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_SMOOTH_POINT_SIZE_GRANULARITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SMOOTH_LINE_WIDTH_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SMOOTH_LINE_WIDTH_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SMOOTH_LINE_WIDTH_GRANULARITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_SMOOTH_LINE_WIDTH_GRANULARITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALIASED_POINT_SIZE_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALIASED_POINT_SIZE_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALIASED_LINE_WIDTH_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALIASED_LINE_WIDTH_RANGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE0"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE0), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE1"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE2"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE3"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE4"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE5"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE6"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE6), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE7"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE7), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE8"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE9"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE9), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE10"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE10), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE11"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE11), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE12"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE13"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE13), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE14"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE14), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE15"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE15), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE16"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE17"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE17), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE18"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE18), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE19"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE19), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE20"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE20), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE21"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE21), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE22"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE22), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE23"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE23), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE24"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE24), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE25"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE25), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE26"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE26), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE27"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE27), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE28"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE28), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE29"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE29), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE30"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE30), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE31"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE31), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_TEXTURE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLIENT_ACTIVE_TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLIENT_ACTIVE_TEXTURE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_UNITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMBINE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMBINE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMBINE_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMBINE_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMBINE_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMBINE_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB_SCALE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB_SCALE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ADD_SIGNED"), Uint32::New(v8::Isolate::GetCurrent(), GL_ADD_SIGNED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTERPOLATE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INTERPOLATE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONSTANT"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONSTANT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PRIMARY_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_PRIMARY_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PREVIOUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_PREVIOUS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SUBTRACT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SUBTRACT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC0_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC0_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC1_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC1_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC2_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC2_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC0_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC0_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC1_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC1_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC2_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC2_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SOURCE0_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SOURCE0_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SOURCE1_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SOURCE1_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SOURCE2_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SOURCE2_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SOURCE0_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SOURCE0_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SOURCE1_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SOURCE1_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SOURCE2_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SOURCE2_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OPERAND0_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_OPERAND0_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OPERAND1_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_OPERAND1_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OPERAND2_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_OPERAND2_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OPERAND0_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_OPERAND0_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OPERAND1_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_OPERAND1_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OPERAND2_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_OPERAND2_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOT3_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_DOT3_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOT3_RGBA"), Uint32::New(v8::Isolate::GetCurrent(), GL_DOT3_RGBA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRANSPOSE_MODELVIEW_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRANSPOSE_MODELVIEW_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRANSPOSE_PROJECTION_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRANSPOSE_PROJECTION_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRANSPOSE_TEXTURE_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRANSPOSE_TEXTURE_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRANSPOSE_COLOR_MATRIX"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRANSPOSE_COLOR_MATRIX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMAL_MAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REFLECTION_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_REFLECTION_MAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BINDING_CUBE_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BINDING_CUBE_MAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_POSITIVE_X"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_POSITIVE_X), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_POSITIVE_Y"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_POSITIVE_Y), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_POSITIVE_Z"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_POSITIVE_Z), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PROXY_TEXTURE_CUBE_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_PROXY_TEXTURE_CUBE_MAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_CUBE_MAP_TEXTURE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_CUBE_MAP_TEXTURE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_LUMINANCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_LUMINANCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_LUMINANCE_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_LUMINANCE_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_INTENSITY"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_INTENSITY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_RGBA"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_RGBA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COMPRESSION_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COMPRESSION_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COMPRESSED_IMAGE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COMPRESSED_IMAGE_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COMPRESSED"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COMPRESSED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_COMPRESSED_TEXTURE_FORMATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_NUM_COMPRESSED_TEXTURE_FORMATS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_TEXTURE_FORMATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_TEXTURE_FORMATS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MULTISAMPLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MULTISAMPLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_ALPHA_TO_COVERAGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_ALPHA_TO_COVERAGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_ALPHA_TO_ONE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_ALPHA_TO_ONE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_COVERAGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_COVERAGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_BUFFERS"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_BUFFERS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLES"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_COVERAGE_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_COVERAGE_VALUE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_COVERAGE_INVERT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_COVERAGE_INVERT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MULTISAMPLE_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MULTISAMPLE_BIT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_COMPONENT16"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_COMPONENT16), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_COMPONENT24"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_COMPONENT24), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_COMPONENT32"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_COMPONENT32), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_DEPTH_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_DEPTH_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_TEXTURE_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_TEXTURE_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COMPARE_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COMPARE_MODE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COMPARE_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COMPARE_FUNC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPARE_R_TO_TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPARE_R_TO_TEXTURE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "QUERY_COUNTER_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_QUERY_COUNTER_BITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_QUERY"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_QUERY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "QUERY_RESULT"), Uint32::New(v8::Isolate::GetCurrent(), GL_QUERY_RESULT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "QUERY_RESULT_AVAILABLE"), Uint32::New(v8::Isolate::GetCurrent(), GL_QUERY_RESULT_AVAILABLE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLES_PASSED"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLES_PASSED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD_SRC"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD_SRC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAGMENT_DEPTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAGMENT_DEPTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_FOG_COORD"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_FOG_COORD), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE_SOURCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE_SOURCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_FOG_COORDINATE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_FOG_COORDINATE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_SUM"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_SUM), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_SECONDARY_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_SECONDARY_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SECONDARY_COLOR_ARRAY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SECONDARY_COLOR_ARRAY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SECONDARY_COLOR_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SECONDARY_COLOR_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SECONDARY_COLOR_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SECONDARY_COLOR_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SECONDARY_COLOR_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_SECONDARY_COLOR_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SECONDARY_COLOR_ARRAY"), Uint32::New(v8::Isolate::GetCurrent(), GL_SECONDARY_COLOR_ARRAY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SIZE_MIN"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SIZE_MIN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SIZE_MAX"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SIZE_MAX), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_FADE_THRESHOLD_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_FADE_THRESHOLD_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_DST_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_DST_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_SRC_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_SRC_RGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_DST_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_DST_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_SRC_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_SRC_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GENERATE_MIPMAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_GENERATE_MIPMAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GENERATE_MIPMAP_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_GENERATE_MIPMAP_HINT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INCR_WRAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_INCR_WRAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DECR_WRAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_DECR_WRAP), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MIRRORED_REPEAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MIRRORED_REPEAT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_LOD_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_LOD_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_FILTER_CONTROL"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_FILTER_CONTROL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_LOD_BIAS"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_LOD_BIAS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ARRAY_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_ARRAY_BUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ELEMENT_ARRAY_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_ELEMENT_ARRAY_BUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ELEMENT_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_ELEMENT_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_NORMAL_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_INDEX_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_COORD_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EDGE_FLAG_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_EDGE_FLAG_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SECONDARY_COLOR_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORD_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORD_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WEIGHT_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_WEIGHT_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STREAM_DRAW"), Uint32::New(v8::Isolate::GetCurrent(), GL_STREAM_DRAW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STREAM_READ"), Uint32::New(v8::Isolate::GetCurrent(), GL_STREAM_READ), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STREAM_COPY"), Uint32::New(v8::Isolate::GetCurrent(), GL_STREAM_COPY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DYNAMIC_DRAW"), Uint32::New(v8::Isolate::GetCurrent(), GL_DYNAMIC_DRAW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DYNAMIC_READ"), Uint32::New(v8::Isolate::GetCurrent(), GL_DYNAMIC_READ), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DYNAMIC_COPY"), Uint32::New(v8::Isolate::GetCurrent(), GL_DYNAMIC_COPY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "READ_ONLY"), Uint32::New(v8::Isolate::GetCurrent(), GL_READ_ONLY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WRITE_ONLY"), Uint32::New(v8::Isolate::GetCurrent(), GL_WRITE_ONLY), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "READ_WRITE"), Uint32::New(v8::Isolate::GetCurrent(), GL_READ_WRITE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_USAGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_USAGE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_ACCESS"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_ACCESS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_MAPPED"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_MAPPED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_MAP_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_MAP_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FOG_COORDINATE_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_PROGRAM"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_PROGRAM), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADER_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADER_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DELETE_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_DELETE_STATUS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPILE_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPILE_STATUS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINK_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINK_STATUS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VALIDATE_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_VALIDATE_STATUS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INFO_LOG_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_INFO_LOG_LENGTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ATTACHED_SHADERS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ATTACHED_SHADERS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_UNIFORMS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_UNIFORMS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_UNIFORM_MAX_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_UNIFORM_MAX_LENGTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADER_SOURCE_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADER_SOURCE_LENGTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_VEC2"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_VEC2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_VEC3"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_VEC3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_VEC4"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_VEC4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT_VEC2"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT_VEC2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT_VEC3"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT_VEC3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT_VEC4"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT_VEC4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL_VEC2"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL_VEC2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL_VEC3"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL_VEC3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL_VEC4"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL_VEC4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT2"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT3"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT4"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_1D"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_1D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_2D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_3D"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_3D), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_CUBE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_CUBE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_1D_SHADOW"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_1D_SHADOW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_2D_SHADOW"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_2D_SHADOW), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADING_LANGUAGE_VERSION"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADING_LANGUAGE_VERSION), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_SHADER"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_SHADER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VERTEX_UNIFORM_COMPONENTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VERTEX_UNIFORM_COMPONENTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VARYING_FLOATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VARYING_FLOATS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VERTEX_TEXTURE_IMAGE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_COMBINED_TEXTURE_IMAGE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_ATTRIBUTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_ATTRIBUTES), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_ATTRIBUTE_MAX_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAGMENT_SHADER"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAGMENT_SHADER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_FRAGMENT_UNIFORM_COMPONENTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_FRAGMENT_UNIFORM_COMPONENTS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VERTEX_ATTRIBS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VERTEX_ATTRIBS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_ENABLED"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_ENABLED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_STRIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_TYPE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_NORMALIZED"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_NORMALIZED), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_VERTEX_ATTRIB"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_VERTEX_ATTRIB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_POINTER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_PROGRAM_POINT_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_PROGRAM_POINT_SIZE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_PROGRAM_TWO_SIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_PROGRAM_TWO_SIDE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_COORDS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_COORDS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_IMAGE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_IMAGE_UNITS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_DRAW_BUFFERS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_DRAW_BUFFERS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER0"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER0), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER1"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER1), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER2"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER3"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER4"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER5"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER5), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER6"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER6), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER7"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER7), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER8"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER9"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER9), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER10"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER10), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER11"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER11), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER12"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER12), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER13"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER13), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER14"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER14), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DRAW_BUFFER15"), Uint32::New(v8::Isolate::GetCurrent(), GL_DRAW_BUFFER15), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SPRITE"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SPRITE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COORD_REPLACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COORD_REPLACE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT_SPRITE_COORD_ORIGIN"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINT_SPRITE_COORD_ORIGIN), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LOWER_LEFT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LOWER_LEFT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UPPER_LEFT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UPPER_LEFT), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_FUNC), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_VALUE_MASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_VALUE_MASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_REF"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_REF), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_FAIL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_PASS_DEPTH_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_PASS_DEPTH_FAIL), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_PASS_DEPTH_PASS"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_PASS_DEPTH_PASS), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_WRITEMASK), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_RASTER_SECONDARY_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_RASTER_SECONDARY_COLOR), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_PACK_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_PACK_BUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_UNPACK_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_UNPACK_BUFFER), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_PACK_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_PACK_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PIXEL_UNPACK_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_PIXEL_UNPACK_BUFFER_BINDING), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT2x3"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT2x3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT2x4"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT2x4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT3x2"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT3x2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT3x4"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT3x4), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT4x2"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT4x2), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT4x3"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT4x3), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRGB8"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRGB8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRGB_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRGB_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRGB8_ALPHA8"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRGB8_ALPHA8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SLUMINANCE_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SLUMINANCE_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SLUMINANCE8_ALPHA8"), Uint32::New(v8::Isolate::GetCurrent(), GL_SLUMINANCE8_ALPHA8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SLUMINANCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SLUMINANCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SLUMINANCE8"), Uint32::New(v8::Isolate::GetCurrent(), GL_SLUMINANCE8), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_SRGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_SRGB), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_SRGB_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_SRGB_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_SLUMINANCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_SLUMINANCE), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_SLUMINANCE_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_SLUMINANCE_ALPHA), ReadOnly);

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Accum"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglAccumCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AlphaFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglAlphaFuncCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AreTexturesResident"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglAreTexturesResidentCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ArrayElement"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglArrayElementCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Begin"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBeginCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBindTextureCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Bitmap"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBitmapCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendColor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBlendColorCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendEquation"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBlendEquationCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendEquationSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBlendEquationSeparateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBlendFuncCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CallList"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCallListCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Clear"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClearCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearAccum"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClearAccumCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearColor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClearColorCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearDepth"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClearDepthCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearIndex"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClearIndexCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearStencil"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClearStencilCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClipPlane"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClipPlaneCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3b"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3bCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3bv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3bvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3ub"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3ubCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3ubv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3ubvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3ui"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3uiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3uiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3uivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3us"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3usCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color3usv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor3usvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4b"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4bCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4bv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4bvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4ub"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4ubCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4ubv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4ubvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4ui"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4uiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4uiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4uivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4us"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4usCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Color4usv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColor4usvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ColorMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColorMaskCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ColorMaterial"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColorMaterialCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ColorTableParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColorTableParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ColorTableParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglColorTableParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ConvolutionParameterf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglConvolutionParameterfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ConvolutionParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglConvolutionParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ConvolutionParameteri"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglConvolutionParameteriCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ConvolutionParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglConvolutionParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyColorSubTable"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyColorSubTableCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyColorTable"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyColorTableCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyConvolutionFilter1D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyConvolutionFilter1DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyConvolutionFilter2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyConvolutionFilter2DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyPixels"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyPixelsCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexImage1D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyTexImage1DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexImage2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyTexImage2DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexSubImage1D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyTexSubImage1DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexSubImage2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyTexSubImage2DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexSubImage3D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCopyTexSubImage3DCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CullFace"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCullFaceCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteLists"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDeleteListsCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteTextures"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDeleteTexturesCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DepthFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDepthFuncCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DepthMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDepthMaskCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DepthRange"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDepthRangeCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Disable"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDisableCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DisableClientState"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDisableClientStateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DrawArrays"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDrawArraysCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DrawBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDrawBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EdgeFlag"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEdgeFlagCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EdgeFlagv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEdgeFlagvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Enable"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEnableCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EnableClientState"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEnableClientStateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "End"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEndCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EndList"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEndListCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord1d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord1dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord1dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord1dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord1fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalCoord2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalCoord2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalMesh1"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalMesh1Callback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalMesh2"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalMesh2Callback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalPoint1"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalPoint1Callback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EvalPoint2"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEvalPoint2Callback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FeedbackBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFeedbackBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Finish"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFinishCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Flush"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFlushCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Fogf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Fogfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Fogi"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Fogiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FrontFace"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFrontFaceCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Frustum"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFrustumCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenLists"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGenListsCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenTextures"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGenTexturesCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetBooleanv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetBooleanvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetClipPlane"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetClipPlaneCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetColorTableParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetColorTableParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetColorTableParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetColorTableParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetConvolutionParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetConvolutionParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetConvolutionParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetConvolutionParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetDoublev"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetDoublevCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetError"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetErrorCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetFloatv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetFloatvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetHistogramParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetHistogramParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetHistogramParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetHistogramParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetIntegerv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetIntegervCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetLightfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetLightfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetLightiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetLightivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMapdv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMapdvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMapfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMapfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMapiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMapivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMaterialfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMaterialfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMaterialiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMaterialivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMinmaxParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMinmaxParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMinmaxParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetMinmaxParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetPixelMapfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetPixelMapfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetPixelMapuiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetPixelMapuivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetPixelMapusv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetPixelMapusvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetPolygonStipple"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetPolygonStippleCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexEnvfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexEnvfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexEnviv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexEnvivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexGendv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexGendvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexGenfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexGenfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexGeniv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexGenivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexLevelParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexLevelParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexLevelParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexLevelParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetTexParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Hint"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglHintCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Histogram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglHistogramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IndexMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexMaskCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexdCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexdv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexdvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexi"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexs"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexsCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexsv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexsvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexub"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexubCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Indexubv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIndexubvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "InitNames"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglInitNamesCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsEnabled"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsEnabledCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsList"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsListCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsTextureCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LightModelf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightModelfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LightModelfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightModelfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LightModeli"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightModeliCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LightModeliv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightModelivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Lightf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Lightfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Lighti"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Lightiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLightivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LineStipple"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLineStippleCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LineWidth"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLineWidthCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ListBase"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglListBaseCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LoadIdentity"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLoadIdentityCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LoadMatrixd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLoadMatrixdCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LoadMatrixf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLoadMatrixfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LoadName"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLoadNameCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LogicOp"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLogicOpCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Map1d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMap1dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Map1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMap1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Map2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMap2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Map2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMap2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MapGrid1d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMapGrid1dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MapGrid1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMapGrid1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MapGrid2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMapGrid2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MapGrid2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMapGrid2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Materialf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMaterialfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Materialfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMaterialfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Materiali"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMaterialiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Materialiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMaterialivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MatrixMode"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMatrixModeCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Minmax"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMinmaxCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultMatrixd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultMatrixdCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultMatrixf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultMatrixfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NewList"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNewListCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3b"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3bCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3bv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3bvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Normal3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglNormal3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Ortho"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglOrthoCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PassThrough"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPassThroughCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelMapfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelMapfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelMapuiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelMapuivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelMapusv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelMapusvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelStoref"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelStorefCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelStorei"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelStoreiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelTransferf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelTransferfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelTransferi"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelTransferiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelZoom"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPixelZoomCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PointSize"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPointSizeCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PolygonMode"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPolygonModeCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PolygonOffset"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPolygonOffsetCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PolygonStipple"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPolygonStippleCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PopAttrib"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPopAttribCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PopClientAttrib"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPopClientAttribCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PopMatrix"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPopMatrixCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PopName"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPopNameCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PrioritizeTextures"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPrioritizeTexturesCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PushAttrib"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPushAttribCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PushClientAttrib"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPushClientAttribCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PushMatrix"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPushMatrixCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PushName"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPushNameCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos2sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos2svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RasterPos4sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRasterPos4svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ReadBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglReadBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rectd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectdCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rectdv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectdvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rectf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rectfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Recti"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rectiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rects"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectsCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rectsv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRectsvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RenderMode"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRenderModeCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ResetHistogram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglResetHistogramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ResetMinmax"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglResetMinmaxCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rotated"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRotatedCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Rotatef"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglRotatefCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Scaled"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglScaledCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Scalef"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglScalefCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Scissor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglScissorCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SelectBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSelectBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ShadeModel"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglShadeModelCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglStencilFuncCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglStencilMaskCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilOp"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglStencilOpCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord1sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord1svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord2sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord2svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexCoord4sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexCoord4svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexEnvf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexEnvfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexEnvfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexEnvfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexEnvi"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexEnviCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexEnviv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexEnvivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexGend"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexGendCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexGendv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexGendvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexGenf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexGenfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexGenfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexGenfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexGeni"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexGeniCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexGeniv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexGenivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameterf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexParameterfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameteri"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexParameteriCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTexParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Translated"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTranslatedCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Translatef"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglTranslatefCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex2sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex2svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Vertex4sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertex4svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Viewport"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglViewportCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SampleCoverage"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSampleCoverageCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LoadTransposeMatrixf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLoadTransposeMatrixfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LoadTransposeMatrixd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLoadTransposeMatrixdCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultTransposeMatrixf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultTransposeMatrixfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultTransposeMatrixd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultTransposeMatrixdCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ActiveTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglActiveTextureCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClientActiveTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglClientActiveTextureCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord1sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord1svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord2sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord2svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiTexCoord4sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiTexCoord4svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FogCoordf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogCoordfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FogCoordfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogCoordfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FogCoordd"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglFogCoorddCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3b"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3bCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3bv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3bvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3ub"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3ubCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3ubv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3ubvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3ui"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3uiCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3uiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3uivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3us"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3usCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SecondaryColor3usv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglSecondaryColor3usvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PointParameterf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPointParameterfCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PointParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPointParameterfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PointParameteri"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPointParameteriCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PointParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglPointParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendFuncSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBlendFuncSeparateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MultiDrawArrays"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglMultiDrawArraysCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos2sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos2svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowPos3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglWindowPos3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenQueries"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGenQueriesCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteQueries"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDeleteQueriesCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsQuery"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsQueryCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BeginQuery"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBeginQueryCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EndQuery"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEndQueryCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetQueryiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetQueryivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetQueryObjectiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetQueryObjectivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetQueryObjectuiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetQueryObjectuivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglBindBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteBuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDeleteBuffersCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenBuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGenBuffersCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UnmapBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUnmapBufferCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetBufferParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetBufferParameterivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DrawBuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDrawBuffersCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib1dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib1dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib1fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib1sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib1svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib2dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib2dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib2sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib2svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib3dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib3dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib3sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib3svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Nbv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NbvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Niv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Nsv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NsvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Nub"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NubCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Nubv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NubvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Nuiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NuivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4Nusv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4NusvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4bv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4bvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4d"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4dCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4dv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4dvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4s"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4sCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4sv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4svCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4ubv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4ubvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4uiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4uivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4usv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglVertexAttrib4usvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EnableVertexAttribArray"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglEnableVertexAttribArrayCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DisableVertexAttribArray"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDisableVertexAttribArrayCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetVertexAttribdv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetVertexAttribdvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetVertexAttribfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetVertexAttribfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetVertexAttribiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetVertexAttribivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDeleteShaderCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DetachShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDetachShaderCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCreateShaderCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CompileShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCompileShaderCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglCreateProgramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AttachShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglAttachShaderCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LinkProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglLinkProgramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UseProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUseProgramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglDeleteProgramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ValidateProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglValidateProgramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform1fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform2fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform3fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform4fCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform1iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform2iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform3iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform4iCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform1fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform1ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform2ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform3ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniform4ivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsShaderCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglIsProgramCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetShaderiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetShaderivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetProgramiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetProgramivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetAttachedShaders"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetAttachedShadersCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetUniformfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetUniformfvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetUniformiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglGetUniformivCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilFuncSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglStencilFuncSeparateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilOpSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglStencilOpSeparateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilMaskSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglStencilMaskSeparateCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix2x3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix2x3fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix3x2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix3x2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix2x4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix2x4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix4x2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix4x2fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix3x4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix3x4fvCallback));

     Gl->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix4x3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLglUniformMatrix4x3fvCallback));


      // Again, return the result through the current handle scope.
      return Gl;
}    


<|start_filename|>example/OpenGL/gles/ch8-simple-vertexshader.js<|end_filename|>
#!/usr/bin/env teajs

var exports = require("GL");
for (var p in exports) { global[p] = exports[p]; }

//adding matrix 4x4 library
/*
 * Copyright (c) 2009, Mozilla Corp
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the <organization> nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Based on sample code from the OpenGL(R) ES 2.0 Programming Guide, which carriers
 * the following header:
 *
 * Book:      OpenGL(R) ES 2.0 Programming Guide
 * Authors:   <NAME>, <NAME>, <NAME>
 * ISBN-10:   0321502795
 * ISBN-13:   9780321502797
 * Publisher: Addison-Wesley Professional
 * URLs:      http://safari.informit.com/9780321563835
 *            http://www.opengles-book.com
 */

//
// A simple 4x4 Matrix utility class
//

function Matrix4x4() {
  this.elements = Array(16);
  this.loadIdentity();
}

Matrix4x4.prototype = {
  scale: function (sx, sy, sz) {
    this.elements[0*4+0] *= sx;
    this.elements[0*4+1] *= sx;
    this.elements[0*4+2] *= sx;
    this.elements[0*4+3] *= sx;

    this.elements[1*4+0] *= sy;
    this.elements[1*4+1] *= sy;
    this.elements[1*4+2] *= sy;
    this.elements[1*4+3] *= sy;

    this.elements[2*4+0] *= sz;
    this.elements[2*4+1] *= sz;
    this.elements[2*4+2] *= sz;
    this.elements[2*4+3] *= sz;

    return this;
  },

  translate: function (tx, ty, tz) {
    this.elements[3*4+0] += this.elements[0*4+0] * tx + this.elements[1*4+0] * ty + this.elements[2*4+0] * tz;
    this.elements[3*4+1] += this.elements[0*4+1] * tx + this.elements[1*4+1] * ty + this.elements[2*4+1] * tz;
    this.elements[3*4+2] += this.elements[0*4+2] * tx + this.elements[1*4+2] * ty + this.elements[2*4+2] * tz;
    this.elements[3*4+3] += this.elements[0*4+3] * tx + this.elements[1*4+3] * ty + this.elements[2*4+3] * tz;

    return this;
  },

  rotate: function (angle, x, y, z) {
    var mag = Math.sqrt(x*x + y*y + z*z);
    var sinAngle = Math.sin(angle * Math.PI / 180.0);
    var cosAngle = Math.cos(angle * Math.PI / 180.0);

    if (mag > 0) {
      var xx, yy, zz, xy, yz, zx, xs, ys, zs;
      var oneMinusCos;
      var rotMat;

      x /= mag;
      y /= mag;
      z /= mag;

      xx = x * x;
      yy = y * y;
      zz = z * z;
      xy = x * y;
      yz = y * z;
      zx = z * x;
      xs = x * sinAngle;
      ys = y * sinAngle;
      zs = z * sinAngle;
      oneMinusCos = 1.0 - cosAngle;

      rotMat = new Matrix4x4();

      rotMat.elements[0*4+0] = (oneMinusCos * xx) + cosAngle;
      rotMat.elements[0*4+1] = (oneMinusCos * xy) - zs;
      rotMat.elements[0*4+2] = (oneMinusCos * zx) + ys;
      rotMat.elements[0*4+3] = 0.0;

      rotMat.elements[1*4+0] = (oneMinusCos * xy) + zs;
      rotMat.elements[1*4+1] = (oneMinusCos * yy) + cosAngle;
      rotMat.elements[1*4+2] = (oneMinusCos * yz) - xs;
      rotMat.elements[1*4+3] = 0.0;

      rotMat.elements[2*4+0] = (oneMinusCos * zx) - ys;
      rotMat.elements[2*4+1] = (oneMinusCos * yz) + xs;
      rotMat.elements[2*4+2] = (oneMinusCos * zz) + cosAngle;
      rotMat.elements[2*4+3] = 0.0;

      rotMat.elements[3*4+0] = 0.0;
      rotMat.elements[3*4+1] = 0.0;
      rotMat.elements[3*4+2] = 0.0;
      rotMat.elements[3*4+3] = 1.0;

      rotMat = rotMat.multiply(this);
      this.elements = rotMat.elements;
    }

    return this;
  },

  frustum: function (left, right, bottom, top, nearZ, farZ) {
    var deltaX = right - left;
    var deltaY = top - bottom;
    var deltaZ = farZ - nearZ;
    var frust;

    if ( (nearZ <= 0.0) || (farZ <= 0.0) ||
         (deltaX <= 0.0) || (deltaY <= 0.0) || (deltaZ <= 0.0) )
         return this;

    frust = new Matrix4x4();

    frust.elements[0*4+0] = 2.0 * nearZ / deltaX;
    frust.elements[0*4+1] = frust.elements[0*4+2] = frust.elements[0*4+3] = 0.0;

    frust.elements[1*4+1] = 2.0 * nearZ / deltaY;
    frust.elements[1*4+0] = frust.elements[1*4+2] = frust.elements[1*4+3] = 0.0;

    frust.elements[2*4+0] = (right + left) / deltaX;
    frust.elements[2*4+1] = (top + bottom) / deltaY;
    frust.elements[2*4+2] = -(nearZ + farZ) / deltaZ;
    frust.elements[2*4+3] = -1.0;

    frust.elements[3*4+2] = -2.0 * nearZ * farZ / deltaZ;
    frust.elements[3*4+0] = frust.elements[3*4+1] = frust.elements[3*4+3] = 0.0;

    frust = frust.multiply(this);
    this.elements = frust.elements;

    return this;
  },

  perspective: function (fovy, aspect, nearZ, farZ) {
    var frustumH = Math.tan(fovy / 360.0 * Math.PI) * nearZ;
    var frustumW = frustumH * aspect;

    return this.frustum(-frustumW, frustumW, -frustumH, frustumH, nearZ, farZ);
  },

  ortho: function (left, right, bottom, top, nearZ, farZ) {
    var deltaX = right - left;
    var deltaY = top - bottom;
    var deltaZ = farZ - nearZ;

    var ortho = new Matrix4x4();

    if ( (deltaX == 0.0) || (deltaY == 0.0) || (deltaZ == 0.0) )
        return this;

    ortho.elements[0*4+0] = 2.0 / deltaX;
    ortho.elements[3*4+0] = -(right + left) / deltaX;
    ortho.elements[1*4+1] = 2.0 / deltaY;
    ortho.elements[3*4+1] = -(top + bottom) / deltaY;
    ortho.elements[2*4+2] = -2.0 / deltaZ;
    ortho.elements[3*4+2] = -(nearZ + farZ) / deltaZ;

    ortho = ortho.multiply(this);
    this.elements = ortho.elements;

    return this;
  },

  multiply: function (right) {
    var tmp = new Matrix4x4();

    for (var i = 0; i < 4; i++) {
      tmp.elements[i*4+0] =
	(this.elements[i*4+0] * right.elements[0*4+0]) +
	(this.elements[i*4+1] * right.elements[1*4+0]) +
	(this.elements[i*4+2] * right.elements[2*4+0]) +
	(this.elements[i*4+3] * right.elements[3*4+0]) ;

      tmp.elements[i*4+1] =
	(this.elements[i*4+0] * right.elements[0*4+1]) +
	(this.elements[i*4+1] * right.elements[1*4+1]) +
	(this.elements[i*4+2] * right.elements[2*4+1]) +
	(this.elements[i*4+3] * right.elements[3*4+1]) ;

      tmp.elements[i*4+2] =
	(this.elements[i*4+0] * right.elements[0*4+2]) +
	(this.elements[i*4+1] * right.elements[1*4+2]) +
	(this.elements[i*4+2] * right.elements[2*4+2]) +
	(this.elements[i*4+3] * right.elements[3*4+2]) ;

      tmp.elements[i*4+3] =
	(this.elements[i*4+0] * right.elements[0*4+3]) +
	(this.elements[i*4+1] * right.elements[1*4+3]) +
	(this.elements[i*4+2] * right.elements[2*4+3]) +
	(this.elements[i*4+3] * right.elements[3*4+3]) ;
    }

    this.elements = tmp.elements;
    return this;
  },

  loadIdentity: function () {
    for (var i = 0; i < 16; i++)
      this.elements[i] = 0;
    this.elements[0*4+0] = 1.0;
    this.elements[1*4+1] = 1.0;
    this.elements[2*4+2] = 1.0;
    this.elements[3*4+3] = 1.0;
    return this;
  }
};

//adding a simple shape library
/*
 * Copyright (c) 2009, Mozilla Corp
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the <organization> nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY <copyright holder> ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Based on sample code from the OpenGL(R) ES 2.0 Programming Guide, which carriers
 * the following header:
 *
 * Book:      OpenGL(R) ES 2.0 Programming Guide
 * Authors:   <NAME>, <NAME>, <NAME>
 * ISBN-10:   0321502795
 * ISBN-13:   9780321502797
 * Publisher: Addison-Wesley Professional
 * URLs:      http://safari.informit.com/9780321563835
 *            http://www.opengles-book.com
 */

//
// port of esShapes.c
//

function shallowCloneArray(ar) {
  var o = Array(ar.length);
  for (var i = 0; i < ar.length; i++) {
    o[i] = ar[i];
  }
  return o;
}

function shallowCloneArrayScaled(ar, scale) {
  var o = Array(ar.length);
  for (var i = 0; i < ar.length; i++) {
    o[i] = ar[i] * scale;
  }
  return o;
}

// make these accessible directly in the glboal scope,
// in case someone wants to use them without copying
var esCubeVertices = [
  -0.5, -0.5, -0.5,
  -0.5, -0.5,  0.5,
   0.5, -0.5,  0.5,
   0.5, -0.5, -0.5,
  -0.5,  0.5, -0.5,
  -0.5,  0.5,  0.5,
   0.5,  0.5,  0.5,
   0.5,  0.5, -0.5,
  -0.5, -0.5, -0.5,
  -0.5,  0.5, -0.5,
   0.5,  0.5, -0.5,
   0.5, -0.5, -0.5,
  -0.5, -0.5, 0.5,
  -0.5,  0.5, 0.5,
   0.5,  0.5, 0.5,
   0.5, -0.5, 0.5,
  -0.5, -0.5, -0.5,
  -0.5, -0.5,  0.5,
  -0.5,  0.5,  0.5,
  -0.5,  0.5, -0.5,
   0.5, -0.5, -0.5,
   0.5, -0.5,  0.5,
   0.5,  0.5,  0.5,
   0.5,  0.5, -0.5
];

var esCubeNormals = [
   0.0, -1.0, 0.0,
   0.0, -1.0, 0.0,
   0.0, -1.0, 0.0,
   0.0, -1.0, 0.0,
   0.0, 1.0, 0.0,
   0.0, 1.0, 0.0,
   0.0, 1.0, 0.0,
   0.0, 1.0, 0.0,
   0.0, 0.0, -1.0,
   0.0, 0.0, -1.0,
   0.0, 0.0, -1.0,
   0.0, 0.0, -1.0,
   0.0, 0.0, 1.0,
   0.0, 0.0, 1.0,
   0.0, 0.0, 1.0,
   0.0, 0.0, 1.0,
  -1.0, 0.0, 0.0,
  -1.0, 0.0, 0.0,
  -1.0, 0.0, 0.0,
  -1.0, 0.0, 0.0,
   1.0, 0.0, 0.0,
   1.0, 0.0, 0.0,
   1.0, 0.0, 0.0,
   1.0, 0.0, 0.0
];

var esCubeTexCoords = [
  0.0, 0.0,
  0.0, 1.0,
  1.0, 1.0,
  1.0, 0.0,
  1.0, 0.0,
  1.0, 1.0,
  0.0, 1.0,
  0.0, 0.0,
  0.0, 0.0,
  0.0, 1.0,
  1.0, 1.0,
  1.0, 0.0,
  0.0, 0.0,
  0.0, 1.0,
  1.0, 1.0,
  1.0, 0.0,
  0.0, 0.0,
  0.0, 1.0,
  1.0, 1.0,
  1.0, 0.0,
  0.0, 0.0,
  0.0, 1.0,
  1.0, 1.0,
  1.0, 0.0
];

var esCubeIndices = [
  0, 2, 1,
  0, 3, 2,
  4, 5, 6,
  4, 6, 7,
  8, 9, 10,
  8, 10, 11,
  12, 15, 14,
  12, 14, 13,
  16, 17, 18,
  16, 18, 19,
  20, 23, 22,
  20, 22, 21
];

// will return an object that has vertices, normals, texCoords, and indices members
function esGenCube (scale) {
  return {
    vertices: shallowCloneArrayScaled(esCubeVertices, scale),
    texCoords: shallowCloneArray(esCubeTexCoords),
    indices: shallowCloneArray(esCubeIndices),
    normals: shallowCloneArray(esCubeNormals)
  };
}

//
// generates coordinate information for a sphere
//

function esGenSphere (numSlices, radius) {
  var i, j;
  var numParallels = numSlices;
  var numVertices = (numParallels + 1) * (numSlices + 1);
  var numIndices = numParallels * numSlices * 6;
  var angleStep = (2 * Math.PI) / numSlices;

  var vertices = Array(3*numVertices);
  var normals = Array(3*numVertices);
  var texCoords = Array(2*numVertices);
  var indices = Array(numIndices);

  for (i = 0; i < numParallels+1; i++) {
    for (j = 0; j < numSlices+1; j++) {
      var vertex = (i * (numSlices+1) + j) * 3;

      vertices[vertex+0] = radius * Math.sin(angleStep * i) * Math.sin(angleStep * j);
      vertices[vertex+1] = radius * Math.cos(angleStep * i);
      vertices[vertex+2] = radius * Math.sin(angleStep * i) * Math.cos(angleStep * j);

      normals[vertex+0] = vertices[vertex+0] / radius;
      normals[vertex+1] = vertices[vertex+1] / radius;
      normals[vertex+2] = vertices[vertex+2] / radius;

      var texIndex = (i * (numSlices+1) + j) * 2;

      texCoords[texIndex+0] = j / numSlices;
      texCoords[texIndex+1] = (1 - i) / (numParallels - 1);
    }
  }

  var k = 0;
  for (i = 0; i < numParallels; i++) {
    for (j = 0; j < numSlices; j++) {
      indices[k++] = i * (numSlices + 1) + j;
      indices[k++] = (i + 1) * (numSlices + 1) + j;
      indices[k++] = (i + 1) * (numSlices + 1) + (j + 1);

      indices[k++] = i * (numSlices + 1) + j;
      indices[k++] = (i + 1) * (numSlices + 1) + (j + 1);
      indices[k++] = i * (numSlices + 1) + (j + 1);
    }
  }

  return {
    vertices: vertices,
    normals: normals,
    texCoords: texCoords,
    indices: indices
  };
}
//end library code.


//start custom code.
var angle = 0;
var vertex_shader = "uniform mat4 u_mvpMatrix;\n"
					+ "attribute vec4 a_position;\n"
					+ "void main()\n"
					+ "{\n"
					+ "gl_Position = u_mvpMatrix * a_position;\n"
					+ "}\n";

var fragment_shader = "void main()\n"
					+ "{\n"
					+ "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
					+ "}\n";

// an object we'll use to store shaders, textures, etc. on as we create them
var userData = {};

function loadShader(shaderType, shaderSource) {
    // Create the shader object
    var shader = Gles.CreateShader(shaderType);
    if (shader == 0) return 0;

    // Load the shader source
    Gles.ShaderSource(shader, shaderSource);

    // Compile the shader
    Gles.CompileShader(shader);

    // Check the compile status
    var compiled = Gles.GetShaderiv(shader, Gles.COMPILE_STATUS);
    if (!compiled) {
		// Something went wrong during compilation; get the error
		var error = Gles.GetShaderInfoLog(shader);
		Gles.DeleteShader(shader);
		return 0;
    }

    return shader;
}

// Convenience function to create a program from all the passed-in
function getProgram() {
    var shaders = [];

    // first load and compile all the passed-in shaders.
    for (var i = 0; i < arguments.length; i+=2) {
	    var type = arguments[i], source = arguments[i+1];
		var shader = loadShader(type, source);
		if (shader == 0)
		    return 0;
		shaders.push(shader);
    }

    // then do the program object creation
    var program = Gles.CreateProgram();
    if (program == 0)
	return 0;

    // attach all the shaders
    for (var i = 0; i < shaders.length; i++) {
	Gles.AttachShader(program, shaders[i]);
    }

    // link, and check for errors
    Gles.LinkProgram(program);

    var linked = Gles.GetProgramiv(program, Gles.LINK_STATUS);
    if (!linked) {
    	var error = Gles.GetProgramInfoLog(program);
    	return 0;
    }

    return program;
}

function init() {
	userData.programObject = getProgram(Gles.VERTEX_SHADER, vertex_shader, Gles.FRAGMENT_SHADER, fragment_shader);
	if(userData.programObject == 0) return false;
	
	userData.positionLoc = Gles.GetAttribLocation(userData.programObject, "a_position");
	userData.mvpLoc = Gles.GetUniformLocation(userData.programObject, "u_mvpMatrix");
	userData.obj = esGenCube(1.0);
	Gles.ClearColor(0, 0, 0, 0);
	return true;
}

function updateObjects() {
	// compute the window aspect ratio
    var aspect = 800 / 600;

    // Generate a perspective matrix with a 60 degree FOV
    var persp = new Matrix4x4();
    persp.perspective(60, aspect, 1.0, 20.0);

    // Create our modelview matrix
    var modelview = new Matrix4x4();

    // translate away from the viewer
    modelview.translate(0, 0, -2);

    // then rotating the cube
    modelview.rotate(angle, 1, 0, 1);

    userData.mvpMatrix = modelview.multiply(persp);
}


// Update MVP matrix based on time; deltaTime is in seconds
function update() {
	angle += 2.0;
	if (angle > 360) angle -= 360;
	updateObjects();
    Glut.PostRedisplay();
	Glut.TimerFunc(25, update, 0);
}

// Actually draw the triangle, using the program created in init()
function draw() {
    // Set up the viewport
    Gles.Viewport(0, 0, 800, 600);

    // Clear the color buffer
    Gles.Clear(Gles.COLOR_BUFFER_BIT);

    // Use the program object we created in init()
    Gles.UseProgram(userData.programObject);

    // Load the vertex data
    Gles.VertexAttribPointer(userData.positionLoc, 3, Gles.FLOAT, false, 0, userData.obj.vertices);
    Gles.EnableVertexAttribArray(userData.positionLoc);

    // Load the MVP matrix
    Gles.UniformMatrix4fv(userData.mvpLoc, userData.mvpMatrix.elements.length, Gles.FALSE, userData.mvpMatrix.elements);

    // Draw the cube
    Gles.DrawElements(Gles.TRIANGLES, userData.obj.indices.length, Gles.UNSIGNED_SHORT, userData.obj.indices);

    // Finally do the swap to display what we just drew
    Glut.SwapBuffers();
}

function main() {
	//Initialize Glut
	Glut.Init();
	Glut.InitDisplayMode(Glut.DOUBLE | Glut.RGB | Glut.DEPTH);
	Glut.InitWindowSize(800, 600);
	//Create the window
	Glut.CreateWindow("OpenGL ES on V8!  (^_^)/");
	
    if (!init())
	return;
    
    updateObjects();
	//Set drawing callback
	Glut.DisplayFunc(draw);
	//Set resize window callback
	Glut.ReshapeFunc(function(w, h) {
		Gles.Viewport(0, 0, w, h);
		Gl.MatrixMode(Gl.PROJECTION);
		Gl.LoadIdentity();
		Glu.Perspective(45.0, w / h, 1.0, 200.0);
	});

	Glut.TimerFunc(25, update, 0);
	//Start the main loop.
	Glut.MainLoop();
}

main();


<|start_filename|>src/lib/binary-b/binary-b.cc<|end_filename|>
#include <v8.h>
#include <string>
#include "macros.h"
#include "gc.h"
#include "binary-b.h"
#include "bytestring.h"
#include "bytearray.h"
#include "bytestorage-b.h"

void commonIndexOf(const v8::FunctionCallbackInfo<v8::Value>& args, int direction) {
	ByteStorageB * bs = BS_THIS;
	int len = args.Length();

	unsigned char value = (unsigned char) args[0]->IntegerValue();
	size_t start = (len > 1 ? args[1]->IntegerValue() : 0);
	size_t end = (len > 2 ? args[2]->IntegerValue() : bs->getLength()-1);
	size_t index1 = MIN(start, end);
	size_t index2 = MAX(start, end);

	args.GetReturnValue().Set(JS_INT(bs->indexOf(value, index1, index2, direction)));
}

void Binary_length(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
	ByteStorageB * bs = BS_OTHER(info.This());
	info.GetReturnValue().Set(JS_INT(bs->getLength()));
}

void Binary_convertTo(const v8::FunctionCallbackInfo<v8::Value> &args, v8::Handle<v8::Function> ctor) {
	if (args.Length() == 0) {
		/* no copying for ByteString->ByteString conversions */
		v8::Local<v8::FunctionTemplate> byteString_template = v8::Local<v8::FunctionTemplate>::New(JS_ISOLATE, ByteString_template());
		if (INSTANCEOF(args.This(), byteString_template) && ctor == ByteString_function()) {
			args.GetReturnValue().Set(args.This());
			return;
		}
		
		v8::Handle<v8::Value> newargs[]= { args.This() };
		args.GetReturnValue().Set(ctor->NewInstance(1, newargs));
	} else {
		ByteStorageB * bs = BS_THIS;
		v8::String::Utf8Value from(args[0]);
		v8::String::Utf8Value to(args[1]);
		try {		
			ByteStorageB * bs2 = bs->transcode(*from, *to);
			v8::Handle<v8::Value> newargs[]= { v8::External::New(JS_ISOLATE, (void*) bs2) };
			args.GetReturnValue().Set(ctor->NewInstance(1, newargs));
		} catch (std::string e) {
			JS_ERROR(e.c_str());
		}
	}
	
}

JS_METHOD(Binary_indexOf) {
	commonIndexOf(args, 1);
}

JS_METHOD(Binary_lastIndexOf) {
	commonIndexOf(args, -1);
}

JS_METHOD(Binary_codeAt) {
	ByteStorageB * bs = BS_THIS;
	size_t len = bs->getLength();
	size_t index = args[0]->IntegerValue();
	if (index < 0 || index >= len) { args.GetReturnValue().SetUndefined(); return; }
	
	args.GetReturnValue().Set(JS_INT(bs->getByte(index)));
}

JS_METHOD(Binary_decodeToString) {
	ByteStorageB * bs = BS_THIS;
	v8::String::Utf8Value charset(args[0]);
	try {
		ByteStorageB bs_tmp(bs->transcode(*charset, "utf-8"));
		args.GetReturnValue().Set(bs_tmp.toString());
	} catch (std::string e) {
		JS_ERROR(e.c_str());
	}
}

JS_METHOD(Binary_toByteString) {
	v8::Local<v8::Function> byteString = v8::Local<v8::Function>::New(JS_ISOLATE, ByteString_function());
	Binary_convertTo(args, byteString);
}

JS_METHOD(Binary_toByteArray) {
	v8::Local<v8::Function> byteArray = v8::Local<v8::Function>::New(JS_ISOLATE, ByteArray_function());
	Binary_convertTo(args, byteArray);
}

JS_METHOD(Binary_concat) {
	args.GetReturnValue().Set(args.This());
}

void Binary_destroy(v8::Handle<v8::Object> instance) {
	ByteStorageB * bs = BS_OTHER(instance);
	delete bs;
}

void Binary_concat(v8::Handle<v8::Object> obj, const v8::FunctionCallbackInfo<v8::Value>& args, bool right) {
	ByteStorageB * bs = BS_OTHER(obj);
	
	v8::Handle<v8::Value> arg;
	for (int i=0;i<args.Length();i++) {
		arg = args[i];
		
		if (arg->IsObject() && IS_BINARY(arg->ToObject())) {
			ByteStorageB * bs2 = BS_OTHER(arg->ToObject());
			(right ? bs->push(bs2) : bs->unshift(bs2));
		} else if (arg->IsArray()) {
			v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(arg);
			ByteStorageB bs_tmp(arr);
			(right ? bs->push(&bs_tmp) : bs->unshift(&bs_tmp));
		} else {
			unsigned char byte = (unsigned char) arg->IntegerValue();
			(right ? bs->push(byte) : bs->unshift(byte));
		}
	}
	
	args.GetReturnValue().Set(JS_INT(bs->getLength()));
}

JS_METHOD(_Binary) {
	JS_ERROR("Binary function should never be called.");
}

SHARED_INIT() {
	v8::HandleScope handle_scope(JS_ISOLATE);
	
	v8::Handle<v8::FunctionTemplate> binaryTemplate = v8::FunctionTemplate::New(JS_ISOLATE, _Binary);
	binaryTemplate->SetClassName(JS_STR("Binary"));
	
	v8::Handle<v8::ObjectTemplate> binaryPrototype = binaryTemplate->PrototypeTemplate();
	binaryPrototype->Set(JS_STR("codeAt"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_codeAt));
	binaryPrototype->Set(JS_STR("indexOf"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_indexOf));
	binaryPrototype->Set(JS_STR("lastIndexOf"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_lastIndexOf));
	binaryPrototype->Set(JS_STR("toByteString"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_toByteString));
	binaryPrototype->Set(JS_STR("toByteArray"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_toByteArray));
	binaryPrototype->Set(JS_STR("decodeToString"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_decodeToString));
	binaryPrototype->Set(JS_STR("concat"), v8::FunctionTemplate::New(JS_ISOLATE, Binary_concat));
	exports->Set(JS_STR("Binary"), binaryTemplate->GetFunction());

	ByteString_init(binaryTemplate);
	v8::Local<v8::Function> byteString = v8::Local<v8::Function>::New(JS_ISOLATE, ByteString_function());
	exports->Set(JS_STR("ByteString"), byteString);

	ByteArray_init(binaryTemplate);
	v8::Local<v8::Function> byteArray = v8::Local<v8::Function>::New(JS_ISOLATE, ByteArray_function());
	exports->Set(JS_STR("ByteArray"), byteArray);
}


<|start_filename|>src/macros.h<|end_filename|>
/**
 * Shorthands for various lengthy V8 syntax constructs.
 */
#ifndef _JS_MACROS_H
#define _JS_MACROS_H

#include <string.h>
#include "app.h"
#include "lib/binary/bytestorage.h"

#define _STRING(x) #x
#define STRING(x) _STRING(x)

#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))

#define JS_ISOLATE v8::Isolate::GetCurrent()

#define SAVE_PTR_TO(obj, index, ptr) obj->SetInternalField(index, v8::External::New(JS_ISOLATE, ptr))
#define LOAD_PTR_FROM(obj, index, type) reinterpret_cast<type>(v8::Handle<v8::External>::Cast(obj->GetInternalField(index))->Value())
#define SAVE_PTR(index, ptr) SAVE_PTR_TO(args.This(), index, ptr)
#define LOAD_PTR(index, type) LOAD_PTR_FROM(args.This(), index, type)
#define SAVE_VALUE(index, val) args.This()->SetInternalField(index, val)
#define LOAD_VALUE(index) args.This()->GetInternalField(index)
#define JS_STR(str) v8::String::NewFromUtf8(JS_ISOLATE, str)
#define JS_STR_LEN(str, len) v8::String::NewFromUtf8(JS_ISOLATE, str, v8::String::kNormalString, len)
#define JS_INT(val) v8::Integer::New(JS_ISOLATE, val)
#define JS_FLOAT(val) v8::Number::New(JS_ISOLATE, val)
#define JS_BOOL(val) v8::Boolean::New(JS_ISOLATE, val)
#define JS_NULL v8::Null(JS_ISOLATE)
#define JS_UNDEFINED v8::Undefined(JS_ISOLATE)
#define JS_METHOD(name) void name(const v8::FunctionCallbackInfo<v8::Value>& args)
#define INSTANCEOF(obj, func) func->HasInstance(obj)

#define JS_THROW(type, reason) JS_ISOLATE->ThrowException(v8::Exception::type(JS_STR(reason)))
#define JS_ERROR(reason) JS_THROW(Error, reason)
#define JS_TYPE_ERROR(reason) JS_THROW(TypeError, reason)
#define JS_RANGE_ERROR(reason) JS_THROW(RangeError, reason)
#define JS_SYNTAX_ERROR(reason) JS_THROW(SyntaxError, reason)
#define JS_REFERENCE_ERROR(reason) JS_THROW(ReferenceError, reason)
#define JS_RETHROW(tc) v8::Local<v8::Value>::New(tc.Exception());

#define JS_GLOBAL JS_ISOLATE->GetCurrentContext()->Global()
#define GLOBAL_PROTO v8::Handle<v8::Object>::Cast(JS_GLOBAL->GetPrototype())
#define APP_PTR reinterpret_cast<TeaJS_App *>(v8::Handle<v8::External>::Cast(GLOBAL_PROTO->GetInternalField(0))->Value())
#define GC_PTR reinterpret_cast<GC *>(v8::Handle<v8::External>::Cast(GLOBAL_PROTO->GetInternalField(1))->Value())

#define ASSERT_CONSTRUCTOR if (!args.IsConstructCall()) { JS_ERROR("Invalid call format. Please use the 'new' operator."); return; }
#define ASSERT_NOT_CONSTRUCTOR if (args.IsConstructCall()) { return JS_ERROR("Invalid call format. Please do not use the 'new' operator."); }
#define RETURN_CONSTRUCT_CALL \
	std::vector< v8::Handle<v8::Value> > params(args.Length()); \
	for (size_t i=0; i<params.size(); i++) { params[i] = args[i]; } \
	args.GetReturnValue().Set(args.Callee()->NewInstance(args.Length(), &params[0])); \
	return;

#ifdef _WIN32
#   define SHARED_INIT() extern "C" __declspec(dllexport) void init(v8::Handle<v8::Function> require, v8::Handle<v8::Object> exports, v8::Handle<v8::Object> module)
#else
#   define SHARED_INIT() extern "C" void init(v8::Handle<v8::Function> require, v8::Handle<v8::Object> exports, v8::Handle<v8::Object> module)
#endif

inline v8::Handle<v8::Value> BYTESTORAGE_TO_JS(ByteStorage * bs) {
	v8::Local<v8::Object> binary = v8::Local<v8::Object>::New(JS_ISOLATE, (APP_PTR)->require("binary", ""));
	v8::Handle<v8::Function> buffer = v8::Handle<v8::Function>::Cast(binary->Get(JS_STR("Buffer")));
	v8::Handle<v8::Value> newargs[] = { v8::External::New(JS_ISOLATE, (void*)bs) };
	return v8::Handle<v8::Function>::Cast(buffer)->NewInstance(1, newargs);
}

inline ByteStorage * JS_TO_BYTESTORAGE(v8::Handle<v8::Value> value) {
	v8::Handle<v8::Object> object = value->ToObject();
	return LOAD_PTR_FROM(object, 0, ByteStorage *);
}

inline v8::Handle<v8::Value> JS_BUFFER(char * data, size_t length) {
	ByteStorage * bs = new ByteStorage(data, length);
	return BYTESTORAGE_TO_JS(bs);
}

inline char * JS_BUFFER_TO_CHAR(v8::Handle<v8::Value> value, size_t * size) {
	ByteStorage * bs = JS_TO_BYTESTORAGE(value);
	*size = bs->getLength();
	return bs->getData();
}

inline bool IS_BUFFER(v8::Handle<v8::Value> value) {
	if (!value->IsObject()) { return false; }
	v8::Handle<v8::Value> proto = value->ToObject()->GetPrototype();
	try {
		v8::Local<v8::Object> binary = v8::Local<v8::Object>::New(JS_ISOLATE, (APP_PTR)->require("binary", ""));
		v8::Handle<v8::Value> prototype = binary->Get(JS_STR("Buffer"))->ToObject()->Get(JS_STR("prototype"));
		return proto->Equals(prototype);
	} catch (std::string e) { /* for some reasons, the binary module is not available */
		return false;
	} 
}

inline void READ(FILE * stream, size_t amount, const v8::FunctionCallbackInfo<v8::Value>& args) {
	std::string data;
	size_t size = 0;

   if (amount == 0) { /* all */
		size_t tmp;
		char * buf = new char[1024];
		do {
			tmp = fread((void *) buf, sizeof(char), sizeof(buf), stream);
			size += tmp;
			data.insert(data.length(), buf, tmp);
		} while (tmp == sizeof(buf));
		delete[] buf;
	} else {
		char * tmp = new char[amount];
		size = fread((void *) tmp, sizeof(char), amount, stream);
		data.insert(0, tmp, size);
		delete[] tmp;
	}
	
	args.GetReturnValue().Set(JS_BUFFER((char *) data.data(), size));
}

inline void READ_LINE(FILE * stream, size_t amount, const v8::FunctionCallbackInfo<v8::Value>& args) {
	char * buf = new char[amount];
	v8::Handle<v8::Value> result;
	
	char * r = fgets(buf, amount, stream);
	if (r) {
		result = JS_BUFFER(buf, strlen(buf));
	} else {
		result = JS_NULL;
	}
	delete[] buf;

	args.GetReturnValue().Set(result);
}

inline size_t WRITE(FILE * stream, v8::Handle<v8::Value> data) {
	if (IS_BUFFER(data)) {
		size_t size = 0;
		char * cdata = JS_BUFFER_TO_CHAR(data, &size);
		return fwrite(cdata, sizeof(char), size, stream);
	} else {
		v8::String::Utf8Value utfdata(data);
		return fwrite(*utfdata, sizeof(char), utfdata.length(), stream);
	}
}

inline size_t WRITE_LINE(FILE * stream, v8::Handle<v8::Value> data) {
	size_t result = 0;
	result += WRITE(stream, data);
	char newline = '\n';
	result += fwrite(&newline, sizeof(char), 1, stream);
	return result;
}

#endif


<|start_filename|>unit/tests/gc.js<|end_filename|>
/**
 * This file test functions system.gc() and system.heap_statistics().
 */

var assert = require("assert");

exports.testGC = function() {
	var before_create = system.heap_statistics()['used_heap_size'];
	for (var i = 0; i < 100; i++) {
		var arr = {};
		for (var j = 0; j < 1000; j++) {
			arr[j] = j;
		}
	}
	var after_create = system.heap_statistics()['used_heap_size'];
	system.gc();
	var after_clean = system.heap_statistics()['used_heap_size'];
	
	assert.equal(before_create < after_create, true, "used_heap_size must be bigger after create objects");
	assert.equal(after_clean < after_create, true, "used_heap_size must be less after system.gc()");
}



<|start_filename|>src/lib/binary/bytestorage.cc<|end_filename|>
#include <v8.h>
#include <cerrno>
#include <string.h>
#include <string>
#include <iconv.h>
#include <stdlib.h>
#include "bytestorage.h"
#include "macros.h"

#define ALLOC_ERROR throw std::string("Cannot allocate enough memory")

#if defined windows || bsd
#	define ICONV_INPUT_T const char * 
#else
#	define ICONV_INPUT_T char *
#endif

/**
 * Create blank with a given length
 */
ByteStorage::ByteStorage(size_t length) {
	this->length = length;
	this->storage = new ByteStorageData(length);
	JS_ISOLATE->AdjustAmountOfExternalAllocatedMemory(length);
	this->data = this->storage->getData();
}

/**
 * Use a given buffer + length
 */
ByteStorage::ByteStorage(char * data, size_t length) {
	this->length = length;
	this->storage = new ByteStorageData(length);
	JS_ISOLATE->AdjustAmountOfExternalAllocatedMemory(length);
	this->data = this->storage->getData();
	
	if (length) { memcpy(this->data, data, length); }
}

ByteStorage::ByteStorage(ByteStorage * bs, size_t index1, size_t index2) {
	this->storage = bs->getStorage();
	this->storage->setInstances(this->storage->getInstances() + 1);
	this->length = index2-index1;
	this->data = bs->getData() + index1;
}

ByteStorage::~ByteStorage() {
	this->data = NULL;
	size_t inst = this->storage->getInstances();
	inst--;
	this->storage->setInstances(inst);
	if (!inst) { 
		delete this->storage;
		JS_ISOLATE->AdjustAmountOfExternalAllocatedMemory(-length);
	} /* last reference */
	
	this->storage = NULL;
}

void ByteStorage::fill(char fill) {
	memset(this->data, fill, this->length);
}

void ByteStorage::fill(char * data, size_t length) {
	memcpy(this->data, data, length);
}

ByteStorageData * ByteStorage::getStorage() {
	return this->storage;
}

size_t ByteStorage::getLength() {
	return this->length;
}

void ByteStorage::setByte(size_t index, char byte) {
	if (index >= this->length) { return; }
	this->data[index] = byte;
}

char ByteStorage::getByte(size_t index) {
	if (index >= this->length) { return NULL; }
	return this->data[index];
}

char * ByteStorage::getData() {
	return this->data;
}

ByteStorage * ByteStorage::transcode(const char * from, const char * to) {
	/* no data */
	if (!this->length) { return new ByteStorage(0); }

	/* source and target are the same -> copy */
/*
	if ((from == to) || (from && to && (strcasecmp(from, to) == 0))) {
		return new ByteStorage(this->data, this->length);
	}
*/
	iconv_t cd = iconv_open(to, from);
	if (cd == (iconv_t)(-1)) { 
		std::string error = "Cannot transcode from ";
		error += from;
		error += " to ";
		error += to;
		throw error;
	}
	
	size_t allocated = this->length + (this->length/8) + 32; /* WAG */
	char * output = (char *) malloc(allocated);
	if (!output) {
		iconv_close(cd);
		ALLOC_ERROR;
	}
	
	size_t inBytesLeft = this->length;
	size_t outBytesLeft = allocated;
	ICONV_INPUT_T inBuf = (ICONV_INPUT_T) this->data;
	char * outBuf = output;

	size_t result = 0;
	do {
		result = iconv(cd, &inBuf, &inBytesLeft, &outBuf, &outBytesLeft);
		if (result == (size_t)(-1)) {
			switch (errno) {
				case E2BIG: {
					/* estimate a new buffer size */
					size_t newAllocated = allocated + inBytesLeft + (inBytesLeft/4) + 32; /* WAG -- +32 implies output charset cannot exceed 32 bytes per character */

					char * newOutput = (char *) realloc(output, newAllocated);
					if (!newOutput) {
						free(output);
						iconv_close(cd);
						ALLOC_ERROR;
					}

					/* so far, outBuf-output bytes were used; move outBuf to this position in newOutput */
					outBuf = newOutput + (outBuf - output);

					/* adjust target pointer */
					output = newOutput;

					/* we allocated this much new bytes */
					outBytesLeft += newAllocated - allocated;
					allocated = newAllocated;
				} break;

				default: {
					free(output);
					iconv_close(cd);
					std::string error = "Transcoding error at source byte ";
					
					size_t tmpSize = 100;
					char * tmp = (char *) malloc(tmpSize);
					if (tmp) {
						size_t result = snprintf(tmp, tmpSize, "%lu", (unsigned long) (inBuf-(char *)this->data));
						if (result < tmpSize) { error += tmp; }
						free(tmp);
					}
					error += " - ";
					switch (errno) {
						case EILSEQ: 
							error += "an invalid multibyte sequence has been encountered in the input";
						break;
						case EINVAL:
							error += "an incomplete multibyte sequence has been encountered in the input";
						break;
						default:
							error += "unknown error";
						break;
					}
					throw error;
				} break;
			}
		}
	} while (result == (size_t)(-1));

	iconv_close(cd);

	/* this is the resulting length */
	size_t len = outBuf - output;
	ByteStorage * bs = new ByteStorage((char *) output, len);

	free(output);
	return bs;
}


<|start_filename|>src/lib/fs/fs.cc<|end_filename|>
/**
 * IO library defines File and Directory classes.
 * Some compatibility macros are defined for Win32 environment.
 */

#include <v8.h>
#include <sys/stat.h>
#include <sys/types.h>

#include <string>
#include <stdlib.h>
#include "macros.h"
#include "common.h"
#include "path.h"

#include <unistd.h>
#include <dirent.h>

#ifdef windows
#	define MKDIR(a, b) mkdir(a)
#else
#	define MKDIR mkdir
#endif

#define TYPE_FILE 0
#define TYPE_DIR 1

namespace {

v8::Persistent<v8::Function> file;

/**
 * Generic directory lister
 * @param {char *} name Directory name
 * @param {int} type Type constant - do we list files or directories?
 * @param {args} the function callback args
 */
void list_items(char * name, int type, const v8::FunctionCallbackInfo<v8::Value>& args) {
	v8::HandleScope handle_scope(JS_ISOLATE);
	v8::Handle<v8::Array> result = v8::Array::New(JS_ISOLATE);
	int cnt = 0;

	DIR * dp;
	struct dirent * ep;
	struct stat st;
	std::string path;
	unsigned int cond = (type == TYPE_FILE ? 0 : S_IFDIR);
	
	dp = opendir(name);
	if (dp == NULL) { JS_ERROR("Directory cannot be opened"); return; }
	while ((ep = readdir(dp))) { 
		path = name;
		path += "/";
		path += ep->d_name;
		if (stat(path.c_str(), &st) != 0) { continue; } /* cannot access */
		
		if ((st.st_mode & S_IFDIR) == cond) {
			std::string name = ep->d_name;
			if (type == TYPE_FILE) {
				result->Set(JS_INT(cnt++), JS_STR(ep->d_name));
			} else if (name != "." && name != "..") {
				result->Set(JS_INT(cnt++), JS_STR(ep->d_name));
			}
		}
	}
	closedir(dp);
	args.GetReturnValue().Set(result);
}

JS_METHOD(_directory) {
	ASSERT_CONSTRUCTOR;
	SAVE_VALUE(0, args[0]);
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_create) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	int mode;
	if (args.Length() == 0) { 
		mode = 0777; 
	} else {
		mode = args[0]->Int32Value();
	}

	int result = MKDIR(*name, mode);
	if (result != 0) {
		JS_ERROR("Cannot create directory");
		return;
	}

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_listfiles) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	list_items(*name, TYPE_FILE, args);
}

JS_METHOD(_listdirectories) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	list_items(*name, TYPE_DIR, args);
}

JS_METHOD(_isdirectory) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	args.GetReturnValue().Set(JS_BOOL(path_dir_exists(*name)));
}

JS_METHOD(_file) {
	ASSERT_CONSTRUCTOR;
	
	SAVE_VALUE(0, args[0]);
	SAVE_VALUE(1, JS_BOOL(false));
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_open) {
	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'file.open(mode)'");
		return;
	}
	v8::String::Utf8Value mode(args[0]);
	v8::String::Utf8Value name(LOAD_VALUE(0));
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	if (!file->IsFalse()) {
		JS_ERROR("File already opened");
		return;
	}
	
	FILE * f;
	f = fopen(*name, *mode);
	
	if (!f) {
		JS_ERROR("Cannot open file");
		return;
	}
	
	SAVE_PTR(1, f);
	args.GetReturnValue().Set(args.This());
}
		
JS_METHOD(_close) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	
	if (file->IsFalse()) {
		JS_ERROR("Cannot close non-opened file");
		return;
	}
	
	FILE * f = LOAD_PTR(1, FILE *);
	
	fclose(f);
	SAVE_VALUE(1, JS_BOOL(false));
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_flush) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);

	if (file->IsFalse()) {
		JS_ERROR("Cannot flush non-opened file");
		return;
	}

	FILE * f = LOAD_PTR(1, FILE *);

	fflush(f);
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_read) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	
	if (file->IsFalse()) {
		JS_ERROR("File must be opened before reading");
		return;
	}
	FILE * f = LOAD_PTR(1, FILE *);
	
	size_t count = 0;
	if (args.Length() && args[0]->IsNumber()) {
		count = args[0]->IntegerValue();
	}
	
	READ(f, count, args);
}

JS_METHOD(_readline) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	
	if (file->IsFalse()) {
		JS_ERROR("File must be opened before reading");
		return;
	}
	FILE * f = LOAD_PTR(1, FILE *);
	
	int size = args[1]->IntegerValue();
	if (size < 1) { size = 0xFFFF; }
	
	READ_LINE(f, size, args);
}

JS_METHOD(_rewind) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	if (file->IsFalse()) {
		JS_ERROR("File must be opened before rewinding");
		return;
	}
	
	FILE * f = LOAD_PTR(1, FILE *);
	rewind(f);

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_iseof) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	if (file->IsFalse()) {
		JS_ERROR("File must be opened before an EOF check");
		return;
	}
	FILE * f = LOAD_PTR(1, FILE *);

	args.GetReturnValue().Set(JS_BOOL(feof(f) != 0));
}

JS_METHOD(_write) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	
	if (file->IsFalse()) {
		JS_ERROR("File must be opened before writing");
		return;
	}
	
	FILE * f = LOAD_PTR(1, FILE *);
	
	WRITE(f, args[0]);
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_writeline) {
	v8::Handle<v8::Value> file = LOAD_VALUE(1);
	
	if (file->IsFalse()) {
		JS_ERROR("File must be opened before writing");
		return;
	}
	
	FILE * f = LOAD_PTR(1, FILE *);
	
	WRITE_LINE(f, args[0]);
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_removefile) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	
	if (remove(*name) != 0) {
		JS_ERROR("Cannot remove file");
		return;
	}

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_removedirectory) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	
	if (rmdir(*name) != 0) {
		JS_ERROR("Cannot remove directory");
		return;
	}

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_stat) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	struct stat st;
	if (stat(*name, &st) == 0) {
		v8::Handle<v8::Object> obj = v8::Object::New(JS_ISOLATE);
		obj->Set(JS_STR("size"), JS_INT(st.st_size));
		obj->Set(JS_STR("mtime"), JS_INT(st.st_mtime));
		obj->Set(JS_STR("atime"), JS_INT(st.st_atime));
		obj->Set(JS_STR("ctime"), JS_INT(st.st_ctime));
		obj->Set(JS_STR("mode"), JS_INT(st.st_mode));
		obj->Set(JS_STR("uid"), JS_INT(st.st_uid));
		obj->Set(JS_STR("gid"), JS_INT(st.st_gid));
		args.GetReturnValue().Set(obj);
	} else {
		args.GetReturnValue().Set(JS_BOOL(false));
	}
}

bool _copy(char * name1, char * name2) {
	size_t size = 0;
	void * data = mmap_read(name1, &size);
	if (data == NULL) { JS_ERROR("Cannot open source file"); return false; }
	
	int result = mmap_write(name2, data, size);
	mmap_free((char *)data, size);
	
	if (result == -1) { JS_ERROR("Cannot open target file"); return false; }
	return true;
}

JS_METHOD(_movefile) {
	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'file.rename(newname)'");
		return;
	}
	
	v8::String::Utf8Value name(LOAD_VALUE(0));
	v8::String::Utf8Value newname(args[0]);

	int renres = rename(*name, *newname);

	if (renres != 0) {
		if (!_copy(*name, *newname)) {
			return;
		}
		remove(*name);
	}
	
	SAVE_VALUE(0, args[0]);
	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_copyfile) {
	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'file.copy(newname)'");
		return;
	}
	
	v8::String::Utf8Value name(LOAD_VALUE(0));
	v8::String::Utf8Value newname(args[0]);

	if (!_copy(*name, *newname)) {
		return;
	}
	v8::Handle<v8::Value> fargs[] = { args[0] };
	v8::Local<v8::Function> _file = v8::Local<v8::Function>::New(JS_ISOLATE, file);
	args.GetReturnValue().Set(_file->NewInstance(1, fargs));
}

JS_METHOD(_tostring) {
	args.GetReturnValue().Set(LOAD_VALUE(0));
}

JS_METHOD(_exists) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	int result = access(*name, F_OK);
	args.GetReturnValue().Set(JS_BOOL(result == 0));
}

JS_METHOD(_isfile) {
	v8::String::Utf8Value name(LOAD_VALUE(0));
	args.GetReturnValue().Set(JS_BOOL(path_file_exists(*name)));
}


}

SHARED_INIT() {
	v8::HandleScope handle_scope(JS_ISOLATE);
	
	v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(JS_ISOLATE, _file);
	ft->SetClassName(JS_STR("File"));
	v8::Handle<v8::ObjectTemplate> ot = ft->InstanceTemplate();
	/* filename, handle */
	ot->SetInternalFieldCount(2); 

	v8::Handle<v8::ObjectTemplate> pt = ft->PrototypeTemplate();
	/**
	 * File prototype methods (new File().*)
	 */
	pt->Set(JS_STR("open"), v8::FunctionTemplate::New(JS_ISOLATE, _open));
	pt->Set(JS_STR("read"), v8::FunctionTemplate::New(JS_ISOLATE, _read));
	pt->Set(JS_STR("readLine"), v8::FunctionTemplate::New(JS_ISOLATE, _readline));
	pt->Set(JS_STR("rewind"), v8::FunctionTemplate::New(JS_ISOLATE, _rewind));
	pt->Set(JS_STR("close"), v8::FunctionTemplate::New(JS_ISOLATE, _close));
	pt->Set(JS_STR("flush"), v8::FunctionTemplate::New(JS_ISOLATE, _flush));
	pt->Set(JS_STR("write"), v8::FunctionTemplate::New(JS_ISOLATE, _write));
	pt->Set(JS_STR("writeLine"), v8::FunctionTemplate::New(JS_ISOLATE, _writeline));
	pt->Set(JS_STR("remove"), v8::FunctionTemplate::New(JS_ISOLATE, _removefile));
	pt->Set(JS_STR("toString"), v8::FunctionTemplate::New(JS_ISOLATE, _tostring));
	pt->Set(JS_STR("exists"), v8::FunctionTemplate::New(JS_ISOLATE, _exists));
	pt->Set(JS_STR("move"), v8::FunctionTemplate::New(JS_ISOLATE, _movefile));
	pt->Set(JS_STR("copy"), v8::FunctionTemplate::New(JS_ISOLATE, _copyfile));
	pt->Set(JS_STR("stat"), v8::FunctionTemplate::New(JS_ISOLATE, _stat));
	pt->Set(JS_STR("isFile"), v8::FunctionTemplate::New(JS_ISOLATE, _isfile));
	pt->Set(JS_STR("isEOF"), v8::FunctionTemplate::New(JS_ISOLATE, _iseof));


	exports->Set(JS_STR("File"), ft->GetFunction());			
	file.Reset(JS_ISOLATE, ft->GetFunction());
	
	v8::Handle<v8::FunctionTemplate> dt = v8::FunctionTemplate::New(JS_ISOLATE, _directory);
	dt->SetClassName(JS_STR("Directory"));
	ot = dt->InstanceTemplate();
	/* dirname */
	ot->SetInternalFieldCount(1); 

	pt = dt->PrototypeTemplate();

	/**
	 * Directory prototype methods (new File().*)
	 */
	pt->Set(JS_STR("create"), v8::FunctionTemplate::New(JS_ISOLATE, _create));
	pt->Set(JS_STR("listFiles"), v8::FunctionTemplate::New(JS_ISOLATE, _listfiles));
	pt->Set(JS_STR("listDirectories"), v8::FunctionTemplate::New(JS_ISOLATE, _listdirectories));
	pt->Set(JS_STR("toString"), v8::FunctionTemplate::New(JS_ISOLATE, _tostring));
	pt->Set(JS_STR("exists"), v8::FunctionTemplate::New(JS_ISOLATE, _exists));
	pt->Set(JS_STR("remove"), v8::FunctionTemplate::New(JS_ISOLATE, _removedirectory));
	pt->Set(JS_STR("stat"), v8::FunctionTemplate::New(JS_ISOLATE, _stat));
	pt->Set(JS_STR("isDirectory"), v8::FunctionTemplate::New(JS_ISOLATE, _isdirectory));

	exports->Set(JS_STR("Directory"), dt->GetFunction());
}


<|start_filename|>example/websocket.js<|end_filename|>
#!/usr/bin/env teajs

/* simple websocket echo server: repeats received message to all clients (and logs to console) */

var Server = require("websocket").Server;
var ws = new Server("0.0.0.0", 8888, {idle:150});

var clients = [];
var app = {
	onmessage: function(client, data) {
		system.stdout.writeLine(data);
		for (var i=0;i<clients.length;i++) {
			ws.send(clients[i], data);
		}
	},
	onconnect: function(client, headers) {
		clients.push(client);
	},
	ondisconnect: function(client, code, message) {
		var index = clients.indexOf(client);
		if (index != -1) { clients.splice(index, 1); }
	},
	onidle: function() {
		system.stdout.write(".");
		system.stdout.flush();
	}
};

ws.addApplication(app);
ws.run();


<|start_filename|>example/shell.js<|end_filename|>
#!/usr/bin/env teajs

/* simple interactive js shell */

while (1) {
	system.stdout("TeaJS> ");
	var cmd = system.stdin.readLine().toString("utf-8").trim();
	if (cmd == "quit" || cmd == "exit" || cmd == "bye") { break; }

	try {
		var result = eval(cmd);
		if (result !== undefined) { system.stdout.writeLine(result); }
	} catch (e) {
		system.stdout.writeLine(e);
	}
}


<|start_filename|>example/wwwclient.js<|end_filename|>
#!/usr/bin/env teajs

/* simple http client application - downloads an URL and outputs its contents */

var http = require("http");
var client = new http.ClientRequest("https://www.google.com/");
var response = client.send(true);

system.stdout.writeLine(JSON.stringify(response.headers(), false, " "));
system.stdout.writeLine();
system.stdout.writeLine(response.data);


<|start_filename|>src/lib/GL/glubindings/glubind.cpp<|end_filename|>


#include "glubind.h"
    
    

void GetGLU_EXT_object_space_tess(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_EXT_object_space_tess));
}




void GetGLU_EXT_nurbs_tessellator(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_EXT_nurbs_tessellator));
}




void GetGLU_FALSE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_FALSE));
}




void GetGLU_TRUE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TRUE));
}




void GetGLU_VERSION_1_1(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_VERSION_1_1));
}




void GetGLU_VERSION_1_2(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_VERSION_1_2));
}




void GetGLU_VERSION_1_3(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_VERSION_1_3));
}




void GetGLU_VERSION(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_VERSION));
}




void GetGLU_EXTENSIONS(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_EXTENSIONS));
}




void GetGLU_INVALID_ENUM(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_INVALID_ENUM));
}




void GetGLU_INVALID_VALUE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_INVALID_VALUE));
}




void GetGLU_OUT_OF_MEMORY(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OUT_OF_MEMORY));
}




void GetGLU_INCOMPATIBLE_GL_VERSION(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_INCOMPATIBLE_GL_VERSION));
}




void GetGLU_INVALID_OPERATION(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_INVALID_OPERATION));
}




void GetGLU_OUTLINE_POLYGON(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OUTLINE_POLYGON));
}




void GetGLU_OUTLINE_PATCH(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OUTLINE_PATCH));
}




void GetGLU_NURBS_ERROR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR));
}




void GetGLU_ERROR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_ERROR));
}




void GetGLU_NURBS_BEGIN(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_BEGIN));
}




void GetGLU_NURBS_BEGIN_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_BEGIN_EXT));
}




void GetGLU_NURBS_VERTEX(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_VERTEX));
}




void GetGLU_NURBS_VERTEX_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_VERTEX_EXT));
}




void GetGLU_NURBS_NORMAL(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_NORMAL));
}




void GetGLU_NURBS_NORMAL_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_NORMAL_EXT));
}




void GetGLU_NURBS_COLOR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_COLOR));
}




void GetGLU_NURBS_COLOR_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_COLOR_EXT));
}




void GetGLU_NURBS_TEXTURE_COORD(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_TEXTURE_COORD));
}




void GetGLU_NURBS_TEX_COORD_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_TEX_COORD_EXT));
}




void GetGLU_NURBS_END(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_END));
}




void GetGLU_NURBS_END_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_END_EXT));
}




void GetGLU_NURBS_BEGIN_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_BEGIN_DATA));
}




void GetGLU_NURBS_BEGIN_DATA_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_BEGIN_DATA_EXT));
}




void GetGLU_NURBS_VERTEX_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_VERTEX_DATA));
}




void GetGLU_NURBS_VERTEX_DATA_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_VERTEX_DATA_EXT));
}




void GetGLU_NURBS_NORMAL_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_NORMAL_DATA));
}




void GetGLU_NURBS_NORMAL_DATA_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_NORMAL_DATA_EXT));
}




void GetGLU_NURBS_COLOR_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_COLOR_DATA));
}




void GetGLU_NURBS_COLOR_DATA_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_COLOR_DATA_EXT));
}




void GetGLU_NURBS_TEXTURE_COORD_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_TEXTURE_COORD_DATA));
}




void GetGLU_NURBS_TEX_COORD_DATA_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_TEX_COORD_DATA_EXT));
}




void GetGLU_NURBS_END_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_END_DATA));
}




void GetGLU_NURBS_END_DATA_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_END_DATA_EXT));
}




void GetGLU_NURBS_ERROR1(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR1));
}




void GetGLU_NURBS_ERROR2(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR2));
}




void GetGLU_NURBS_ERROR3(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR3));
}




void GetGLU_NURBS_ERROR4(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR4));
}




void GetGLU_NURBS_ERROR5(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR5));
}




void GetGLU_NURBS_ERROR6(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR6));
}




void GetGLU_NURBS_ERROR7(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR7));
}




void GetGLU_NURBS_ERROR8(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR8));
}




void GetGLU_NURBS_ERROR9(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR9));
}




void GetGLU_NURBS_ERROR10(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR10));
}




void GetGLU_NURBS_ERROR11(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR11));
}




void GetGLU_NURBS_ERROR12(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR12));
}




void GetGLU_NURBS_ERROR13(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR13));
}




void GetGLU_NURBS_ERROR14(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR14));
}




void GetGLU_NURBS_ERROR15(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR15));
}




void GetGLU_NURBS_ERROR16(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR16));
}




void GetGLU_NURBS_ERROR17(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR17));
}




void GetGLU_NURBS_ERROR18(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR18));
}




void GetGLU_NURBS_ERROR19(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR19));
}




void GetGLU_NURBS_ERROR20(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR20));
}




void GetGLU_NURBS_ERROR21(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR21));
}




void GetGLU_NURBS_ERROR22(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR22));
}




void GetGLU_NURBS_ERROR23(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR23));
}




void GetGLU_NURBS_ERROR24(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR24));
}




void GetGLU_NURBS_ERROR25(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR25));
}




void GetGLU_NURBS_ERROR26(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR26));
}




void GetGLU_NURBS_ERROR27(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR27));
}




void GetGLU_NURBS_ERROR28(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR28));
}




void GetGLU_NURBS_ERROR29(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR29));
}




void GetGLU_NURBS_ERROR30(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR30));
}




void GetGLU_NURBS_ERROR31(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR31));
}




void GetGLU_NURBS_ERROR32(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR32));
}




void GetGLU_NURBS_ERROR33(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR33));
}




void GetGLU_NURBS_ERROR34(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR34));
}




void GetGLU_NURBS_ERROR35(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR35));
}




void GetGLU_NURBS_ERROR36(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR36));
}




void GetGLU_NURBS_ERROR37(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_ERROR37));
}




void GetGLU_AUTO_LOAD_MATRIX(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_AUTO_LOAD_MATRIX));
}




void GetGLU_CULLING(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_CULLING));
}




void GetGLU_SAMPLING_TOLERANCE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_SAMPLING_TOLERANCE));
}




void GetGLU_DISPLAY_MODE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_DISPLAY_MODE));
}




void GetGLU_PARAMETRIC_TOLERANCE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_PARAMETRIC_TOLERANCE));
}




void GetGLU_SAMPLING_METHOD(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_SAMPLING_METHOD));
}




void GetGLU_U_STEP(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_U_STEP));
}




void GetGLU_V_STEP(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_V_STEP));
}




void GetGLU_NURBS_MODE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_MODE));
}




void GetGLU_NURBS_MODE_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_MODE_EXT));
}




void GetGLU_NURBS_TESSELLATOR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_TESSELLATOR));
}




void GetGLU_NURBS_TESSELLATOR_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_TESSELLATOR_EXT));
}




void GetGLU_NURBS_RENDERER(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_RENDERER));
}




void GetGLU_NURBS_RENDERER_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NURBS_RENDERER_EXT));
}




void GetGLU_OBJECT_PARAMETRIC_ERROR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OBJECT_PARAMETRIC_ERROR));
}




void GetGLU_OBJECT_PARAMETRIC_ERROR_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OBJECT_PARAMETRIC_ERROR_EXT));
}




void GetGLU_OBJECT_PATH_LENGTH(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OBJECT_PATH_LENGTH));
}




void GetGLU_OBJECT_PATH_LENGTH_EXT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OBJECT_PATH_LENGTH_EXT));
}




void GetGLU_PATH_LENGTH(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_PATH_LENGTH));
}




void GetGLU_PARAMETRIC_ERROR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_PARAMETRIC_ERROR));
}




void GetGLU_DOMAIN_DISTANCE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_DOMAIN_DISTANCE));
}




void GetGLU_MAP1_TRIM_2(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_MAP1_TRIM_2));
}




void GetGLU_MAP1_TRIM_3(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_MAP1_TRIM_3));
}




void GetGLU_POINT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_POINT));
}




void GetGLU_LINE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_LINE));
}




void GetGLU_FILL(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_FILL));
}




void GetGLU_SILHOUETTE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_SILHOUETTE));
}




void GetGLU_SMOOTH(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_SMOOTH));
}




void GetGLU_FLAT(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_FLAT));
}




void GetGLU_NONE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_NONE));
}




void GetGLU_OUTSIDE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_OUTSIDE));
}




void GetGLU_INSIDE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_INSIDE));
}




void GetGLU_TESS_BEGIN(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_BEGIN));
}




void GetGLU_BEGIN(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_BEGIN));
}




void GetGLU_TESS_VERTEX(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_VERTEX));
}




void GetGLU_VERTEX(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_VERTEX));
}




void GetGLU_TESS_END(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_END));
}




void GetGLU_END(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_END));
}




void GetGLU_TESS_ERROR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR));
}




void GetGLU_TESS_EDGE_FLAG(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_EDGE_FLAG));
}




void GetGLU_EDGE_FLAG(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_EDGE_FLAG));
}




void GetGLU_TESS_COMBINE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_COMBINE));
}




void GetGLU_TESS_BEGIN_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_BEGIN_DATA));
}




void GetGLU_TESS_VERTEX_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_VERTEX_DATA));
}




void GetGLU_TESS_END_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_END_DATA));
}




void GetGLU_TESS_ERROR_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR_DATA));
}




void GetGLU_TESS_EDGE_FLAG_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_EDGE_FLAG_DATA));
}




void GetGLU_TESS_COMBINE_DATA(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_COMBINE_DATA));
}




void GetGLU_CW(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_CW));
}




void GetGLU_CCW(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_CCW));
}




void GetGLU_INTERIOR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_INTERIOR));
}




void GetGLU_EXTERIOR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_EXTERIOR));
}




void GetGLU_UNKNOWN(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_UNKNOWN));
}




void GetGLU_TESS_WINDING_RULE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_WINDING_RULE));
}




void GetGLU_TESS_BOUNDARY_ONLY(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_BOUNDARY_ONLY));
}




void GetGLU_TESS_TOLERANCE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_TOLERANCE));
}




void GetGLU_TESS_ERROR1(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR1));
}




void GetGLU_TESS_ERROR2(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR2));
}




void GetGLU_TESS_ERROR3(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR3));
}




void GetGLU_TESS_ERROR4(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR4));
}




void GetGLU_TESS_ERROR5(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR5));
}




void GetGLU_TESS_ERROR6(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR6));
}




void GetGLU_TESS_ERROR7(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR7));
}




void GetGLU_TESS_ERROR8(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_ERROR8));
}




void GetGLU_TESS_MISSING_BEGIN_POLYGON(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_MISSING_BEGIN_POLYGON));
}




void GetGLU_TESS_MISSING_BEGIN_CONTOUR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_MISSING_BEGIN_CONTOUR));
}




void GetGLU_TESS_MISSING_END_POLYGON(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_MISSING_END_POLYGON));
}




void GetGLU_TESS_MISSING_END_CONTOUR(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_MISSING_END_CONTOUR));
}




void GetGLU_TESS_COORD_TOO_LARGE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_COORD_TOO_LARGE));
}




void GetGLU_TESS_NEED_COMBINE_CALLBACK(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_NEED_COMBINE_CALLBACK));
}




void GetGLU_TESS_WINDING_ODD(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_WINDING_ODD));
}




void GetGLU_TESS_WINDING_NONZERO(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_WINDING_NONZERO));
}




void GetGLU_TESS_WINDING_POSITIVE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_WINDING_POSITIVE));
}




void GetGLU_TESS_WINDING_NEGATIVE(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_WINDING_NEGATIVE));
}




void GetGLU_TESS_WINDING_ABS_GEQ_TWO(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_WINDING_ABS_GEQ_TWO));
}




void GetGLU_TESS_MAX_COORD(Local<String> property,
                      const PropertyCallbackInfo<Value>& info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLU_TESS_MAX_COORD));
}




void GLUCheckExtensionCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  Handle<Array> arrHandle0 = Handle<Array>::Cast(args[0]);
    GLubyte*   arg0 = new   GLubyte  [arrHandle0->Length()];
  for (unsigned j = 0; j < arrHandle0->Length(); j++) {
      Handle<Value> arg(arrHandle0->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
        GLubyte   aux = (  GLubyte  )arg->Uint32Value();
      arg0[j] = aux; 
  }
    
    
  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
    GLubyte*   arg1 = new   GLubyte  [arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
        GLubyte   aux = (  GLubyte  )arg->Uint32Value();
      arg1[j] = aux; 
  }
    
    
  //make call
  gluCheckExtension(( const GLubyte* ) arg0, ( const GLubyte* ) arg1);
  args.GetReturnValue().SetUndefined();
}




void GLULookAtCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 9) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();
  double arg5 = args[5]->NumberValue();
  double arg6 = args[6]->NumberValue();
  double arg7 = args[7]->NumberValue();
  double arg8 = args[8]->NumberValue();

  //make call
  gluLookAt(( GLdouble ) arg0, ( GLdouble ) arg1, ( GLdouble ) arg2, ( GLdouble ) arg3, ( GLdouble ) arg4, ( GLdouble ) arg5, ( GLdouble ) arg6, ( GLdouble ) arg7, ( GLdouble ) arg8);
  args.GetReturnValue().SetUndefined();
}




void GLUNewNurbsRendererCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  gluNewNurbsRenderer();
  args.GetReturnValue().SetUndefined();
}




void GLUNewQuadricCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  gluNewQuadric();
  args.GetReturnValue().SetUndefined();
}




void GLUNewTessCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  gluNewTess();
  args.GetReturnValue().SetUndefined();
}




void GLUOrtho2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  gluOrtho2D(( GLdouble ) arg0, ( GLdouble ) arg1, ( GLdouble ) arg2, ( GLdouble ) arg3);
  args.GetReturnValue().SetUndefined();
}




void GLUPerspectiveCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  gluPerspective(( GLdouble ) arg0, ( GLdouble ) arg1, ( GLdouble ) arg2, ( GLdouble ) arg3);
  args.GetReturnValue().SetUndefined();
}




void GLUPickMatrixCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) { args.GetReturnValue().SetUndefined(); return; }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  Handle<Array> arrHandle4 = Handle<Array>::Cast(args[4]);
   GLint*   arg4 = new  GLint  [arrHandle4->Length()];
  for (unsigned j = 0; j < arrHandle4->Length(); j++) {
      Handle<Value> arg(arrHandle4->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint   aux = ( GLint  )arg->IntegerValue();
      arg4[j] = aux; 
  }
    
    
  //make call
  gluPickMatrix(( GLdouble ) arg0, ( GLdouble ) arg1, ( GLdouble ) arg2, ( GLdouble ) arg3, ( GLint* ) arg4);
  args.GetReturnValue().SetUndefined();
}



Handle<ObjectTemplate> createGlu(void) {
      Handle<ObjectTemplate> Glu = ObjectTemplate::New();
      Glu->SetInternalFieldCount(1);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXT_object_space_tess"), GetGLU_EXT_object_space_tess);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXT_nurbs_tessellator"), GetGLU_EXT_nurbs_tessellator);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FALSE"), GetGLU_FALSE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRUE"), GetGLU_TRUE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_1"), GetGLU_VERSION_1_1);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_2"), GetGLU_VERSION_1_2);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION_1_3"), GetGLU_VERSION_1_3);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION"), GetGLU_VERSION);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXTENSIONS"), GetGLU_EXTENSIONS);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_ENUM"), GetGLU_INVALID_ENUM);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_VALUE"), GetGLU_INVALID_VALUE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OUT_OF_MEMORY"), GetGLU_OUT_OF_MEMORY);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INCOMPATIBLE_GL_VERSION"), GetGLU_INCOMPATIBLE_GL_VERSION);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_OPERATION"), GetGLU_INVALID_OPERATION);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OUTLINE_POLYGON"), GetGLU_OUTLINE_POLYGON);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OUTLINE_PATCH"), GetGLU_OUTLINE_PATCH);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR"), GetGLU_NURBS_ERROR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ERROR"), GetGLU_ERROR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_BEGIN"), GetGLU_NURBS_BEGIN);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_BEGIN_EXT"), GetGLU_NURBS_BEGIN_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_VERTEX"), GetGLU_NURBS_VERTEX);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_VERTEX_EXT"), GetGLU_NURBS_VERTEX_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_NORMAL"), GetGLU_NURBS_NORMAL);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_NORMAL_EXT"), GetGLU_NURBS_NORMAL_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_COLOR"), GetGLU_NURBS_COLOR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_COLOR_EXT"), GetGLU_NURBS_COLOR_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_TEXTURE_COORD"), GetGLU_NURBS_TEXTURE_COORD);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_TEX_COORD_EXT"), GetGLU_NURBS_TEX_COORD_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_END"), GetGLU_NURBS_END);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_END_EXT"), GetGLU_NURBS_END_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_BEGIN_DATA"), GetGLU_NURBS_BEGIN_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_BEGIN_DATA_EXT"), GetGLU_NURBS_BEGIN_DATA_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_VERTEX_DATA"), GetGLU_NURBS_VERTEX_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_VERTEX_DATA_EXT"), GetGLU_NURBS_VERTEX_DATA_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_NORMAL_DATA"), GetGLU_NURBS_NORMAL_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_NORMAL_DATA_EXT"), GetGLU_NURBS_NORMAL_DATA_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_COLOR_DATA"), GetGLU_NURBS_COLOR_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_COLOR_DATA_EXT"), GetGLU_NURBS_COLOR_DATA_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_TEXTURE_COORD_DATA"), GetGLU_NURBS_TEXTURE_COORD_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_TEX_COORD_DATA_EXT"), GetGLU_NURBS_TEX_COORD_DATA_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_END_DATA"), GetGLU_NURBS_END_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_END_DATA_EXT"), GetGLU_NURBS_END_DATA_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR1"), GetGLU_NURBS_ERROR1);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR2"), GetGLU_NURBS_ERROR2);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR3"), GetGLU_NURBS_ERROR3);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR4"), GetGLU_NURBS_ERROR4);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR5"), GetGLU_NURBS_ERROR5);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR6"), GetGLU_NURBS_ERROR6);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR7"), GetGLU_NURBS_ERROR7);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR8"), GetGLU_NURBS_ERROR8);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR9"), GetGLU_NURBS_ERROR9);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR10"), GetGLU_NURBS_ERROR10);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR11"), GetGLU_NURBS_ERROR11);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR12"), GetGLU_NURBS_ERROR12);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR13"), GetGLU_NURBS_ERROR13);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR14"), GetGLU_NURBS_ERROR14);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR15"), GetGLU_NURBS_ERROR15);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR16"), GetGLU_NURBS_ERROR16);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR17"), GetGLU_NURBS_ERROR17);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR18"), GetGLU_NURBS_ERROR18);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR19"), GetGLU_NURBS_ERROR19);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR20"), GetGLU_NURBS_ERROR20);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR21"), GetGLU_NURBS_ERROR21);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR22"), GetGLU_NURBS_ERROR22);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR23"), GetGLU_NURBS_ERROR23);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR24"), GetGLU_NURBS_ERROR24);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR25"), GetGLU_NURBS_ERROR25);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR26"), GetGLU_NURBS_ERROR26);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR27"), GetGLU_NURBS_ERROR27);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR28"), GetGLU_NURBS_ERROR28);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR29"), GetGLU_NURBS_ERROR29);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR30"), GetGLU_NURBS_ERROR30);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR31"), GetGLU_NURBS_ERROR31);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR32"), GetGLU_NURBS_ERROR32);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR33"), GetGLU_NURBS_ERROR33);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR34"), GetGLU_NURBS_ERROR34);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR35"), GetGLU_NURBS_ERROR35);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR36"), GetGLU_NURBS_ERROR36);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_ERROR37"), GetGLU_NURBS_ERROR37);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AUTO_LOAD_MATRIX"), GetGLU_AUTO_LOAD_MATRIX);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CULLING"), GetGLU_CULLING);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLING_TOLERANCE"), GetGLU_SAMPLING_TOLERANCE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DISPLAY_MODE"), GetGLU_DISPLAY_MODE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PARAMETRIC_TOLERANCE"), GetGLU_PARAMETRIC_TOLERANCE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLING_METHOD"), GetGLU_SAMPLING_METHOD);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "U_STEP"), GetGLU_U_STEP);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "V_STEP"), GetGLU_V_STEP);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_MODE"), GetGLU_NURBS_MODE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_MODE_EXT"), GetGLU_NURBS_MODE_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_TESSELLATOR"), GetGLU_NURBS_TESSELLATOR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_TESSELLATOR_EXT"), GetGLU_NURBS_TESSELLATOR_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_RENDERER"), GetGLU_NURBS_RENDERER);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NURBS_RENDERER_EXT"), GetGLU_NURBS_RENDERER_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OBJECT_PARAMETRIC_ERROR"), GetGLU_OBJECT_PARAMETRIC_ERROR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OBJECT_PARAMETRIC_ERROR_EXT"), GetGLU_OBJECT_PARAMETRIC_ERROR_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OBJECT_PATH_LENGTH"), GetGLU_OBJECT_PATH_LENGTH);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OBJECT_PATH_LENGTH_EXT"), GetGLU_OBJECT_PATH_LENGTH_EXT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PATH_LENGTH"), GetGLU_PATH_LENGTH);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PARAMETRIC_ERROR"), GetGLU_PARAMETRIC_ERROR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOMAIN_DISTANCE"), GetGLU_DOMAIN_DISTANCE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_TRIM_2"), GetGLU_MAP1_TRIM_2);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAP1_TRIM_3"), GetGLU_MAP1_TRIM_3);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINT"), GetGLU_POINT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE"), GetGLU_LINE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FILL"), GetGLU_FILL);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SILHOUETTE"), GetGLU_SILHOUETTE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SMOOTH"), GetGLU_SMOOTH);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLAT"), GetGLU_FLAT);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NONE"), GetGLU_NONE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OUTSIDE"), GetGLU_OUTSIDE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INSIDE"), GetGLU_INSIDE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_BEGIN"), GetGLU_TESS_BEGIN);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BEGIN"), GetGLU_BEGIN);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_VERTEX"), GetGLU_TESS_VERTEX);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX"), GetGLU_VERTEX);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_END"), GetGLU_TESS_END);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "END"), GetGLU_END);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR"), GetGLU_TESS_ERROR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_EDGE_FLAG"), GetGLU_TESS_EDGE_FLAG);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EDGE_FLAG"), GetGLU_EDGE_FLAG);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_COMBINE"), GetGLU_TESS_COMBINE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_BEGIN_DATA"), GetGLU_TESS_BEGIN_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_VERTEX_DATA"), GetGLU_TESS_VERTEX_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_END_DATA"), GetGLU_TESS_END_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR_DATA"), GetGLU_TESS_ERROR_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_EDGE_FLAG_DATA"), GetGLU_TESS_EDGE_FLAG_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_COMBINE_DATA"), GetGLU_TESS_COMBINE_DATA);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CW"), GetGLU_CW);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CCW"), GetGLU_CCW);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INTERIOR"), GetGLU_INTERIOR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXTERIOR"), GetGLU_EXTERIOR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNKNOWN"), GetGLU_UNKNOWN);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_WINDING_RULE"), GetGLU_TESS_WINDING_RULE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_BOUNDARY_ONLY"), GetGLU_TESS_BOUNDARY_ONLY);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_TOLERANCE"), GetGLU_TESS_TOLERANCE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR1"), GetGLU_TESS_ERROR1);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR2"), GetGLU_TESS_ERROR2);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR3"), GetGLU_TESS_ERROR3);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR4"), GetGLU_TESS_ERROR4);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR5"), GetGLU_TESS_ERROR5);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR6"), GetGLU_TESS_ERROR6);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR7"), GetGLU_TESS_ERROR7);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_ERROR8"), GetGLU_TESS_ERROR8);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_MISSING_BEGIN_POLYGON"), GetGLU_TESS_MISSING_BEGIN_POLYGON);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_MISSING_BEGIN_CONTOUR"), GetGLU_TESS_MISSING_BEGIN_CONTOUR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_MISSING_END_POLYGON"), GetGLU_TESS_MISSING_END_POLYGON);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_MISSING_END_CONTOUR"), GetGLU_TESS_MISSING_END_CONTOUR);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_COORD_TOO_LARGE"), GetGLU_TESS_COORD_TOO_LARGE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_NEED_COMBINE_CALLBACK"), GetGLU_TESS_NEED_COMBINE_CALLBACK);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_WINDING_ODD"), GetGLU_TESS_WINDING_ODD);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_WINDING_NONZERO"), GetGLU_TESS_WINDING_NONZERO);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_WINDING_POSITIVE"), GetGLU_TESS_WINDING_POSITIVE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_WINDING_NEGATIVE"), GetGLU_TESS_WINDING_NEGATIVE);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_WINDING_ABS_GEQ_TWO"), GetGLU_TESS_WINDING_ABS_GEQ_TWO);

     Glu->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TESS_MAX_COORD"), GetGLU_TESS_MAX_COORD);
     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CheckExtension"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUCheckExtensionCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LookAt"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLULookAtCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NewNurbsRenderer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUNewNurbsRendererCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NewQuadric"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUNewQuadricCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NewTess"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUNewTessCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Ortho2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUOrtho2DCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Perspective"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUPerspectiveCallback));

     Glu->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PickMatrix"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUPickMatrixCallback));


      // Again, return the result through the current handle scope.
      return Glu;
}    


<|start_filename|>src/system.cc<|end_filename|>
#include <v8.h>
#include <string>

#ifdef FASTCGI
#  include <fcgi_stdio.h>
#endif

#include "macros.h"
#include "common.h"
#include "app.h"
#include "system.h"
#include "path.h"
#include <unistd.h>
#include <sys/time.h>

#ifndef HAVE_SLEEP
#	include <windows.h>
#	include <process.h>
#	define sleep(num) { Sleep(num * 1000); }
#	define usleep(num) { Sleep(num / 1000); }
#endif

namespace {

v8::Persistent<v8::Function> js_stdin;
v8::Persistent<v8::Function> js_stdout;
v8::Persistent<v8::Function> js_stderr;

/**
 * Read characters from stdin
 * @param {int} count How many; 0 == all
 */
JS_METHOD(_read) {
	size_t count = 0;
	if (args.Length() && args[0]->IsNumber()) {
		count = args[0]->IntegerValue();
	}
	
	READ(stdin, count, args);
}

JS_METHOD(_readline) {
	int size = args[1]->IntegerValue();
	if (size < 1) { size = 0xFFFF; }
	READ_LINE(stdin, size, args);
}

/**
 * Dump data to stdout
 * @param {string||Buffer} String or Buffer
 */
JS_METHOD(_write_stdout) {
	WRITE(stdout, args[0]);
	args.GetReturnValue().Set(v8::Local<v8::Function>::New(JS_ISOLATE, js_stdout));
}

JS_METHOD(_write_stderr) {
	WRITE(stderr, args[0]);
	args.GetReturnValue().Set(v8::Local<v8::Function>::New(JS_ISOLATE, js_stderr));
}

JS_METHOD(_writeline_stdout) {
	v8::Handle<v8::Value> str = args[0];
	if (!args.Length()) { str = JS_STR(""); }
	WRITE_LINE(stdout, str);
	args.GetReturnValue().Set(v8::Local<v8::Function>::New(JS_ISOLATE, js_stdout));
}

JS_METHOD(_writeline_stderr) {
	v8::Handle<v8::Value> str = args[0];
	if (!args.Length()) { str = JS_STR(""); }
	WRITE_LINE(stderr, str);
	args.GetReturnValue().Set(v8::Local<v8::Function>::New(JS_ISOLATE, js_stderr));
}

JS_METHOD(_getcwd) {
	args.GetReturnValue().Set(JS_STR(path_getcwd().c_str()));
}

JS_METHOD(_getpid) {
	args.GetReturnValue().Set(getppid());
}

/**
 * Sleep for a given number of seconds
 */
JS_METHOD(_sleep) {
	int num = args[0]->Int32Value();
	{
		v8::Unlocker unlocker(JS_ISOLATE);
		sleep(num);
	}
	args.GetReturnValue().SetUndefined();
}

/**
 * Sleep for a given number of microseconds
 */
JS_METHOD(_usleep) {
	v8::HandleScope handle_scope(JS_ISOLATE);
	int num = args[0]->Int32Value();
	usleep(num);
	args.GetReturnValue().SetUndefined();
}

/**
 * run GC and forzen for n ms, default is 1000
 */
JS_METHOD(_gc) {
	int idle_time = args.Length() ? args[0]->Int32Value() : 1000;
	JS_ISOLATE->IdleNotification(idle_time);
	args.GetReturnValue().SetUndefined();
}

/**
 * run HEAP statistics
 */
JS_METHOD(_heap_statistics) {
	v8::HeapStatistics heap_statistics;
	v8::Handle<v8::Object> result = v8::Object::New(JS_ISOLATE);

	JS_ISOLATE->GetHeapStatistics(&heap_statistics);

	result->Set(JS_STR("total_heap_size"), JS_INT(heap_statistics.total_heap_size()));
	result->Set(JS_STR("total_heap_size_executable"), JS_INT(heap_statistics.total_heap_size_executable()));
	result->Set(JS_STR("total_physical_size"), JS_INT(heap_statistics.total_physical_size()));
	result->Set(JS_STR("used_heap_size"), JS_INT(heap_statistics.used_heap_size()));
	result->Set(JS_STR("heap_size_limit"), JS_INT(heap_statistics.heap_size_limit()));

	args.GetReturnValue().Set(result);
}

/**
 * Return the number of microseconds that have elapsed since the epoch.
 */
JS_METHOD(_getTimeInMicroseconds) {
	struct timeval tv;
	gettimeofday(&tv, 0);
	char buffer[24];
	sprintf(buffer, "%lu%06lu", tv.tv_sec, tv.tv_usec);
	args.GetReturnValue().Set(JS_STR(buffer)->ToNumber());
}

JS_METHOD(_flush_stdout) {
	if (fflush(stdout)) { JS_ERROR("Can not flush stdout"); return; }
	args.GetReturnValue().SetUndefined();
}

JS_METHOD(_flush_stderr) {
	if (fflush(stderr)) { JS_ERROR("Can not flush stderr"); return; }
	args.GetReturnValue().SetUndefined();
}

}

void setup_system(v8::Handle<v8::Object> global, char ** envp, std::string mainfile, std::vector<std::string> args) {
	v8::HandleScope handle_scope(JS_ISOLATE);
	v8::Handle<v8::Object> system = v8::Object::New(JS_ISOLATE);
	v8::Handle<v8::Object> env = v8::Object::New(JS_ISOLATE);
	global->Set(JS_STR("system"), system);
	
	/**
	 * Create system.args 
	 */
	v8::Handle<v8::Array> arr = v8::Array::New(JS_ISOLATE);
	arr->Set(JS_INT(0), JS_STR(mainfile.c_str()));
	for (size_t i = 0; i < args.size(); ++i) {
		arr->Set(JS_INT(i+1), JS_STR(args.at(i).c_str()));
	}
	system->Set(JS_STR("args"), arr);

	v8::Handle<v8::Function> _js_stdin = v8::FunctionTemplate::New(JS_ISOLATE, _read)->GetFunction();
	system->Set(JS_STR("stdin"), _js_stdin);
	_js_stdin->Set(JS_STR("read"), _js_stdin);
	_js_stdin->Set(JS_STR("readLine"), v8::FunctionTemplate::New(JS_ISOLATE, _readline)->GetFunction());
	js_stdin.Reset(JS_ISOLATE, _js_stdin);

	v8::Handle<v8::Function> _js_stdout = v8::FunctionTemplate::New(JS_ISOLATE, _write_stdout)->GetFunction();
	system->Set(JS_STR("stdout"), _js_stdout);
	_js_stdout->Set(JS_STR("write"), _js_stdout);
	_js_stdout->Set(JS_STR("writeLine"), v8::FunctionTemplate::New(JS_ISOLATE, _writeline_stdout)->GetFunction());
	_js_stdout->Set(JS_STR("flush"), v8::FunctionTemplate::New(JS_ISOLATE, _flush_stdout)->GetFunction());
	js_stdout.Reset(JS_ISOLATE, _js_stdout);

	v8::Handle<v8::Function> _js_stderr = v8::FunctionTemplate::New(JS_ISOLATE, _write_stderr)->GetFunction();
	system->Set(JS_STR("stderr"), _js_stderr);
	_js_stderr->Set(JS_STR("write"), _js_stderr);
	_js_stderr->Set(JS_STR("writeLine"), v8::FunctionTemplate::New(JS_ISOLATE, _writeline_stderr)->GetFunction());
	_js_stderr->Set(JS_STR("flush"), v8::FunctionTemplate::New(JS_ISOLATE, _flush_stderr)->GetFunction());
	js_stderr.Reset(JS_ISOLATE, _js_stderr);
	
	system->Set(JS_STR("getcwd"), v8::FunctionTemplate::New(JS_ISOLATE, _getcwd)->GetFunction());
	system->Set(JS_STR("getpid"), v8::FunctionTemplate::New(JS_ISOLATE, _getpid)->GetFunction());
	system->Set(JS_STR("sleep"), v8::FunctionTemplate::New(JS_ISOLATE, _sleep)->GetFunction());
	system->Set(JS_STR("usleep"), v8::FunctionTemplate::New(JS_ISOLATE, _usleep)->GetFunction());
	system->Set(JS_STR("gc"), v8::FunctionTemplate::New(JS_ISOLATE, _gc)->GetFunction());
	system->Set(JS_STR("heap_statistics"), v8::FunctionTemplate::New(JS_ISOLATE, _heap_statistics)->GetFunction());
	system->Set(JS_STR("getTimeInMicroseconds"), v8::FunctionTemplate::New(JS_ISOLATE, _getTimeInMicroseconds)->GetFunction());
	system->Set(JS_STR("env"), env);
	
	std::string name, value;
	bool done;
	int i,j;
	char ch;
	
	/* extract environment variables and create JS object */
	for (i = 0; envp[i] != NULL; i++) {
		done = false;
		name = "";
		value = "";
		for (j = 0; envp[i][j] != '\0'; j++) {
			ch = envp[i][j];
			if (!done) {
				if (ch == '=') {
					done = true;
				} else {
					name += ch;
				}
			} else {
				value += ch;
			}
		}
		env->Set(JS_STR(name.c_str()), JS_STR(value.c_str()));
	}
}


<|start_filename|>deps/v8/third_party/icu/source/test/perf/unisetperf/draft/contperf.bat<|end_filename|>
rem  Copyright (c) 2007, International Business Machines Corporation and
rem  others. All Rights Reserved.

set PERF=c:\svn\icuproj\icu\ucnvutf8\source\test\perf\unisetperf\release\unisetperf
rem types: slow Bv Bv0 B0
rem --pattern [:White_Space:]

for %%f in (udhr_eng.txt
            udhr_deu.txt
            udhr_fra.txt
            udhr_rus.txt
            udhr_tha.txt
            udhr_jpn.txt
            udhr_cmn.txt
            udhr_jpn.html) do (
  for %%t in (slow Bv Bv0 B0) do (
    %PERF% Contains  --type %%t -f \temp\udhr\%%f --pattern [:White_Space:] -v -e UTF-8 --passes 3 --iterations 10000
  )
)


<|start_filename|>src/lib/socket/socket.cc<|end_filename|>
/**
 * Socket library. Provides a simple OO abstraction atop several socket-related functions.
 */

#include <v8.h>
#include "macros.h"
#include "common.h"

#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>

#ifdef windows
#  include <winsock2.h>
#  include <ws2tcpip.h>
#  define close(s) closesocket(s)
#  define sock_errno WSAGetLastError()
#  define WOULD_BLOCK (sock_errno == WSAEWOULDBLOCK || sock_errno == WSAEINPROGRESS)
#else
#  include <unistd.h>
#  include <sys/socket.h>
#  include <sys/un.h>
#  include <sys/param.h>
#  include <arpa/inet.h>
#  include <netinet/in.h>
#  include <netinet/tcp.h>
#  include <netdb.h>
#  define sock_errno errno
#  define WOULD_BLOCK (sock_errno == EWOULDBLOCK || sock_errno == EAGAIN)
#endif 

#ifndef EWOULDBLOCK
#  define EWOULDBLOCK EAGAIN
#endif

#ifndef EINPROGRESS
#  define EINPROGRESS WSAEINPROGRESS
#endif

#ifndef MAXHOSTNAMELEN
#  define MAXHOSTNAMELEN 64
#endif

#ifndef INVALID_SOCKET
#  define INVALID_SOCKET -1
#endif

#ifndef SOCKET_ERROR
#  define SOCKET_ERROR -1
#endif

void FormatError() {
#ifdef windows
	int size = 0xFF;
	char buf[size];
	buf[size-1] = '\0';
	FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, WSAGetLastError(), 0, buf, size-1, NULL);
	JS_ERROR(buf);
#else
	JS_ERROR(strerror(errno));
#endif
}

namespace {

v8::Persistent<v8::Function> _socketFunc;
v8::Persistent<v8::FunctionTemplate> _socketTemplate;

inline bool isSocket(v8::Handle<v8::Value> value) {
	v8::Local<v8::FunctionTemplate> socketTemplate = v8::Local<v8::FunctionTemplate>::New(JS_ISOLATE, _socketTemplate);
	if (INSTANCEOF(value, socketTemplate)) { return true; }

	v8::Handle<v8::Value> getSocket = value->ToObject()->Get(JS_STR("getSocket"));
	if (!getSocket->IsFunction()) { return false; }
	
	v8::Handle<v8::Function> getSocketFunc = v8::Handle<v8::Function>::Cast(getSocket);
	v8::Handle<v8::Value> socket = getSocketFunc->Call(value->ToObject(), 0, NULL);
	return INSTANCEOF(socket, socketTemplate);
}

inline int jsToSocket(v8::Handle<v8::Value> value) {
	v8::Local<v8::FunctionTemplate> socketTemplate = v8::Local<v8::FunctionTemplate>::New(JS_ISOLATE, _socketTemplate);
	if (INSTANCEOF(value, socketTemplate)) { return value->ToObject()->GetInternalField(0)->IntegerValue(); }
	
	v8::Handle<v8::Value> getSocket = value->ToObject()->Get(JS_STR("getSocket"));

	v8::Handle<v8::Function> getSocketFunc = v8::Handle<v8::Function>::Cast(getSocket);
	v8::Handle<v8::Value> socket = getSocketFunc->Call(value->ToObject(), 0, NULL);

	return socket->ToObject()->GetInternalField(0)->IntegerValue();
}

#ifndef HAVE_PTON
int inet_pton(int family, const char *src, void *dst) {
	struct addrinfo hints, *res, *ressave;

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = family;
	if (getaddrinfo(src, NULL, &hints, &res) != 0) { return 0; }
	
	if (family == PF_INET) {
		memcpy(dst, &((sockaddr_in *) res->ai_addr)->sin_addr.s_addr, sizeof(struct in_addr));
	} else {
		memcpy(dst, &((sockaddr_in6 *) res->ai_addr)->sin6_addr.s6_addr, sizeof(struct in6_addr));
	}

	freeaddrinfo(ressave);
	return 1;
}
#endif

#ifndef HAVE_NTOP
const char * inet_ntop(int family, const void *src, char *dst, socklen_t cnt) {
    switch (family) {
		case PF_INET: {
			struct sockaddr_in in;
			memset(&in, 0, sizeof(in));
			in.sin_family = PF_INET;
			memcpy(&in.sin_addr, src, sizeof(struct in_addr));
			getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST);
			return dst;
		}
		case PF_INET6: {
			struct sockaddr_in6 in;
			memset(&in, 0, sizeof(in));
			in.sin6_family = PF_INET6;
			memcpy(&in.sin6_addr, src, sizeof(struct in_addr6));
			getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
			return dst;
		}
	}
	return NULL;
}
#endif

typedef union sock_addr {
    struct sockaddr_in in;
#ifndef windows
    struct sockaddr_un un;
#endif
    struct sockaddr_in6 in6;
} sock_addr_t;

/**
 * Universal address creator.
 * @param {char *} address Stringified addres
 * @param {int} port Port number
 * @param {int} family Address family
 * @param {sock_addr_t *} result Target data structure
 * @param {socklen_t *} len Result length
 */
inline int create_addr(char * address, int port, int family, sock_addr_t * result, socklen_t * len) {
   switch (family) {
#ifndef windows
		case PF_UNIX: {
			unsigned int length = strlen(address);
 			struct sockaddr_un *addr = (struct sockaddr_un*) result;
			memset(addr, 0, sizeof(sockaddr_un));

			if (length >= sizeof(addr->sun_path)) { return 1; }
			addr->sun_family = PF_UNIX;
			memcpy(addr->sun_path, address, length);
			addr->sun_path[length] = '\0';
			*len = length + (sizeof(*addr) - sizeof(addr->sun_path));
		} break;
#endif
		case PF_INET: {
			struct sockaddr_in *addr = (struct sockaddr_in*) result;
			memset(addr, 0, sizeof(*addr)); 
			addr->sin_family = PF_INET;
			int pton_ret = inet_pton(PF_INET, address, & addr->sin_addr.s_addr);
			if (pton_ret == 0) { return 1; }
			addr->sin_port = htons((short)port);
			*len = sizeof(*addr);
		} break;
		case PF_INET6: {
			struct sockaddr_in6 *addr = (struct sockaddr_in6*) result;
			memset(addr, 0, sizeof(*addr));
			addr->sin6_family = PF_INET6;
			int pton_ret = inet_pton(PF_INET6, address, & addr->sin6_addr.s6_addr);
			if (pton_ret == 0) { return 1; }
			addr->sin6_port = htons((short)port);
			*len = sizeof(*addr);
		} break;
    }
	return 0;
}

/**
 * Returns JS array with values describing remote address.
 * For UNIX socket, only one item is present. For PF_INET and
 * PF_INET6, array contains [address, port].
 */
inline v8::Handle<v8::Value> create_peer(sockaddr * addr) {
    switch (addr->sa_family) {
#ifndef windows
		case PF_UNIX: {
			v8::Handle<v8::Array> result = v8::Array::New(JS_ISOLATE, 1);
			sockaddr_un * addr_un = (sockaddr_un *) addr;
			result->Set(JS_INT(0), JS_STR(addr_un->sun_path));
			return result;
		} break;
#endif
		case PF_INET6: {
			v8::Handle<v8::Array> result = v8::Array::New(JS_ISOLATE, 2);
			char * buf = new char[INET6_ADDRSTRLEN];
			sockaddr_in6 * addr_in6 = (sockaddr_in6 *) addr;
			inet_ntop(PF_INET6, addr_in6->sin6_addr.s6_addr, buf, INET6_ADDRSTRLEN);
			result->Set(JS_INT(0), JS_STR(buf));
			result->Set(JS_INT(1), JS_INT(ntohs(addr_in6->sin6_port)));
			delete[] buf;
			return result;
		} break;
		case PF_INET: {
			v8::Handle<v8::Array> result = v8::Array::New(JS_ISOLATE, 2);
			char * buf = new char[INET_ADDRSTRLEN];
			sockaddr_in * addr_in = (sockaddr_in *) addr;
			inet_ntop(PF_INET, & addr_in->sin_addr.s_addr, buf, INET_ADDRSTRLEN);
			result->Set(JS_INT(0), JS_STR(buf));
			result->Set(JS_INT(1), JS_INT(ntohs(addr_in->sin_port)));
			delete[] buf;
			return result;
		} break;
	}
    return v8::Undefined(JS_ISOLATE);
}

/**
 * Socket constructor
 * @param {int} family
 * @param {int} type
 * @param {int} [proto]
 */
JS_METHOD(_socket) {
	ASSERT_CONSTRUCTOR;
	if (args.Length() < 2) {
		JS_TYPE_ERROR("Invalid call format. Use 'new Socket(family, type, [proto])'");
		return;
	}
	
	int offset = (args[0]->IsExternal() ? 1 : 0);
	int family = args[offset + 0]->Int32Value();
	int type = args[offset + 1]->Int32Value();
	int proto = args[offset + 2]->Int32Value();
	int s = -1;
	
	if (args[0]->IsExternal()) {
		v8::Handle<v8::External> tmp = v8::Handle<v8::External>::Cast(args[0]);
		s = *((int *) tmp->Value());
	} else {
		s = socket(family, type, proto);
	}
	SAVE_VALUE(0, JS_INT(s));
	SAVE_VALUE(1, JS_BOOL(false));
	args.This()->Set(JS_STR("family"), JS_INT(family));
	args.This()->Set(JS_STR("type"), JS_INT(type));
	args.This()->Set(JS_STR("proto"), JS_INT(proto));
	
	if (s == INVALID_SOCKET) {
		FormatError();
		return;
	}

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_getprotobyname) {
	v8::String::Utf8Value name(args[0]);
	struct protoent * result = getprotobyname(*name);
	if (result) {
		args.GetReturnValue().Set(JS_INT(result->p_proto));
	} else {
		JS_ERROR("Cannot retrieve protocol number");
	}
}

JS_METHOD(_getaddrinfo) {
	v8::String::Utf8Value name(args[0]);
	int family = args[1]->IntegerValue();
	if (family == 0) { family = PF_INET; }
	
	struct addrinfo hints, * servinfo;
	memset(&hints, 0, sizeof(hints));
	hints.ai_family = family;

	int result = getaddrinfo(*name, NULL, &hints, &servinfo);
	if (result != 0) {
		JS_ERROR(gai_strerror(result));
		return;
	}

	v8::Local<v8::Object> item = create_peer(servinfo->ai_addr)->ToObject();
	freeaddrinfo(servinfo);
	args.GetReturnValue().Set(item->Get(JS_INT(0)));
}

JS_METHOD(_getnameinfo) {
	v8::String::Utf8Value name(args[0]);
	int family = args[1]->IntegerValue();
	if (family == 0) { family = PF_INET; }

	char hostname[NI_MAXHOST];
    sock_addr_t addr;
    socklen_t len = 0;

	int result = create_addr(*name, 0, family, &addr, &len);
	if (result != 0) {
		JS_ERROR("Malformed address");
		return;
	}
	
	result = getnameinfo((sockaddr *) & addr, len, hostname, NI_MAXHOST, NULL, 0, 0);
	if (result != 0) {
		JS_ERROR(gai_strerror(result));
	} else {
		args.GetReturnValue().Set(JS_STR(hostname));
	}
}

JS_METHOD(_gethostname) {
	v8::HandleScope handle_scope(JS_ISOLATE);
    char * buf = new char[MAXHOSTNAMELEN+1];
    gethostname(buf, MAXHOSTNAMELEN);
	v8::Handle<v8::Value> result = JS_STR(buf);
	delete[] buf;
	args.GetReturnValue().Set(result);
}

JS_METHOD(_select) {
	if (args.Length() != 4) {
		JS_TYPE_ERROR("Bad argument count. Socket.select must be called with 4 arguments.");
		return;
	}
	
	int max = 0;
	fd_set fds[3];

	/* fill descriptors */
	for (int i=0;i<3;i++) {
		FD_ZERO(&fds[i]);
		
		if (!args[i]->IsArray()) { continue; }
		v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(args[i]);
		int len = arr->Length();
		for (int j=0;j<len;j++) {
			v8::Handle<v8::Value> member = arr->Get(JS_INT(j));
			if (!isSocket(member)) { JS_ERROR("Arguments must be arrays of Socket instances"); return; }
			int fd = jsToSocket(member);
			if (fd > max) { max = fd; }
			FD_SET(fd, &fds[i]);
		}
	}
	
	/* prepare time info */
	timeval * tv = NULL;
	if (!args[3]->IsNull()) {
		int time = args[3]->IntegerValue();
		tv = new timeval;
		tv->tv_sec = time / 1000;
		tv->tv_usec = 1000 * (time % 1000);
	}
	
	int ret;
	
	{
		v8::Unlocker unlocker(JS_ISOLATE);
		while (1) {
			ret = select(max+1, &fds[0], &fds[1], &fds[2], tv);
			if (ret != SOCKET_ERROR || sock_errno != EINTR) { break; }
		}
	}

	if (tv != NULL) { delete tv; } /* clean up time */
	if (ret == SOCKET_ERROR) { return FormatError(); }
	
	/* delete unused sockets */
	for (int i=0;i<3;i++) {
		if (!args[i]->IsArray()) { continue; }
		v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(args[i]);
		int len = arr->Length();
		for (int j=0;j<len;j++) {
			v8::Handle<v8::Value> member = arr->Get(JS_INT(j));
			int fd = jsToSocket(member);
			if (!FD_ISSET(fd, &fds[i])) { arr->ForceDelete(JS_INT(j)); }
		}
	}

	args.GetReturnValue().Set(JS_INT(ret));
}

JS_METHOD(_connect) {
	int family = args.This()->Get(JS_STR("family"))->Int32Value();
	int sock = LOAD_VALUE(0)->Int32Value();

	int argcount = 1;
	if (family != PF_UNIX) { argcount = 2; }
	if (args.Length() < argcount) {
		JS_TYPE_ERROR("Bad argument count. Use 'socket.connect(address, [port])'");
		return;
	}
	
	v8::String::Utf8Value address(args[0]);
	int port = args[1]->Int32Value();
	sock_addr_t addr;
	socklen_t len = 0;

	int result = create_addr(*address, port, family, &addr, &len);
	if (result != 0) {
        JS_ERROR("Malformed address");
		return;
	}
	
	result = connect(sock, (sockaddr *) &addr, len);
	
	if (!result) { args.GetReturnValue().Set(JS_BOOL(true)); return; }
	if (WOULD_BLOCK) { args.GetReturnValue().Set(JS_BOOL(false)); return; }

	FormatError();
}

JS_METHOD(_bind) {
	int family = args.This()->Get(JS_STR("family"))->Int32Value();
	int sock = LOAD_VALUE(0)->Int32Value();

	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'socket.bind(address, [port])'");
		return;
	}
	
	v8::String::Utf8Value address(args[0]);
	int port = args[1]->Int32Value();
	sock_addr_t addr;
	socklen_t len = 0;
	int result = create_addr(*address, port, family, &addr, &len);
	if (result != 0) {
		JS_ERROR("Malformed address");
		return;
	}

	result = bind(sock, (sockaddr *) &addr, len);
	if (result) {
		FormatError();
	} else {
		args.GetReturnValue().Set(args.This());
	}
}

JS_METHOD(_listen) {
	int sock = LOAD_VALUE(0)->Int32Value();

	int num = args[0]->Int32Value();
	if (args.Length() == 0) { num = 5; }

	int result = listen(sock, num);
	if (result) {
		FormatError();
	} else {
		args.GetReturnValue().Set(args.This());
	}
}

JS_METHOD(_accept) {
	int sock = LOAD_VALUE(0)->Int32Value();
	int sock2 = accept(sock, NULL, NULL);
	if (sock2 != INVALID_SOCKET) { 
		v8::Handle<v8::Value> argv[4];
		argv[0] = v8::External::New(JS_ISOLATE, &sock2); // dummy field
		argv[1] = args.This()->Get(JS_STR("family"));
		argv[2] = args.This()->Get(JS_STR("type"));
		argv[3] = args.This()->Get(JS_STR("proto"));
		v8::Local<v8::Function> socketFunc = v8::Local<v8::Function>::New(JS_ISOLATE, _socketFunc);
		args.GetReturnValue().Set(socketFunc->NewInstance(4, argv));
		return;
	}
	if (WOULD_BLOCK) { args.GetReturnValue().Set(JS_BOOL(false)); return; }
	FormatError();
}

JS_METHOD(_send) {
	int sock = LOAD_VALUE(0)->Int32Value();

	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'socket.send(data, [address], [port])'");
		return;
	}
	
	sock_addr_t taddr;
	sockaddr * target = NULL;
	socklen_t len = 0;
	ssize_t result;
	
	if (args.Length() > 1) {
		int family = args.This()->Get(JS_STR("family"))->Int32Value();
		v8::String::Utf8Value address(args[1]);
		int port = args[2]->Int32Value();
		int r = create_addr(*address, port, family, &taddr, &len);
		if (r != 0) { JS_ERROR("Malformed address"); return; }
		target = (sockaddr *) &taddr;
	}
	
	if (IS_BUFFER(args[0])) {
		size_t size = 0;
		char * data = JS_BUFFER_TO_CHAR(args[0], &size);
		result = sendto(sock, data, size, 0, target, len);
	} else {
		v8::String::Utf8Value data(args[0]);
		result = sendto(sock, *data, data.length(), 0, target, len);
	}
	
	if (result != SOCKET_ERROR) { args.GetReturnValue().Set(JS_INT(result)); return; }
	if (WOULD_BLOCK) { args.GetReturnValue().Set(JS_BOOL(false)); return; }
	FormatError();
}

JS_METHOD(_receive) {
	int sock = LOAD_VALUE(0)->Int32Value();
	int count = args[0]->Int32Value();
	int type = args.This()->Get(JS_STR("type"))->Int32Value();
	
	char * data = new char[count];
	sock_addr_t addr;
	socklen_t len = 0;

	ssize_t result = recvfrom(sock, data, count, 0, (sockaddr *) &addr, &len);
	if (result != SOCKET_ERROR) {
		v8::Handle<v8::Value> buffer = JS_BUFFER(data, result);
		delete[] data;
		if (type == SOCK_DGRAM) { SAVE_VALUE(1, create_peer((sockaddr *) &addr)); }
		args.GetReturnValue().Set(buffer);
		return;
	}
	
	delete[] data;
	if (WOULD_BLOCK) { args.GetReturnValue().Set(JS_BOOL(false)); return; }

	FormatError();
}

JS_METHOD(_socketclose) {
	int sock = LOAD_VALUE(0)->Int32Value();
	
	int result = close(sock);
	if (result == SOCKET_ERROR) {
		FormatError();
	} else {
		args.GetReturnValue().SetUndefined();
	}
}

JS_METHOD(_setoption) {
	if (args.Length() != 2) {
		JS_TYPE_ERROR("Bad argument count. Use 'socket.setOption(name, value)'");
		return;
	}
	int sock = LOAD_VALUE(0)->Int32Value();
	int name = args[0]->Int32Value();
	int value = args[1]->Int32Value();

	int level;
	switch (name) {
		case TCP_NODELAY:
			level = IPPROTO_TCP;
		break;
		default:
			level = SOL_SOCKET;
		break;
	}
	
	int result = setsockopt(sock, level, name, (char *) &value, sizeof(int));
	if (result) {
		FormatError();
	} else {
		args.GetReturnValue().Set(args.This());
	}
}

JS_METHOD(_getoption) {
	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'socket.getOption(name)'");
		return;
	}
	int sock = LOAD_VALUE(0)->Int32Value();
	int name = args[0]->Int32Value();
	int level;
	switch (name) {
		case TCP_NODELAY:
			level = IPPROTO_TCP;
		break;
		default:
			level = SOL_SOCKET;
		break;
	}
	
	int value;
	socklen_t len = sizeof(value);
	int result = getsockopt(sock, level, name, (char *)&value, &len);

	if (result != 0) { FormatError(); return; }
	if (len != sizeof(value)) { JS_ERROR("getsockopt returned truncated value"); return; }
	args.GetReturnValue().Set(JS_INT(value));
}

JS_METHOD(_setblocking) {
	if (args.Length() < 1) {
		JS_TYPE_ERROR("Bad argument count. Use 'socket.setBlocking(true/false)'");
		return;
	}
	
	int sock = LOAD_VALUE(0)->Int32Value();
	
#ifdef windows
	unsigned long flag = !args[0]->ToBoolean()->Value(); /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */
	if (ioctlsocket(sock, FIONBIO, &flag) == SOCKET_ERROR) {
		FormatError();
		return;
	} else {
		args.GetReturnValue().SetUndefined();
		return;
	}

#else 
	int flags = fcntl(sock, F_GETFL);

	if (args[0]->ToBoolean()->Value()) {
		flags &= ~O_NONBLOCK;
	} else {
		flags |= O_NONBLOCK;
	}
	
	if (fcntl(sock, F_SETFL, flags) == -1) {
		FormatError();
		return;
	} else {
		args.GetReturnValue().SetUndefined();
		return;
	}
#endif

}

JS_METHOD(_getpeername) {
	int sock = LOAD_VALUE(0)->Int32Value();

	if (!LOAD_VALUE(1)->IsTrue()) {
	    sock_addr_t addr;
		socklen_t len = sizeof(sock_addr_t);
		int result = getpeername(sock, (sockaddr *) &addr, &len);
		if (result == 0) {
			SAVE_VALUE(1, create_peer((sockaddr *) &addr));
		} else {
			return FormatError();
		}
	}
	
	args.GetReturnValue().Set(LOAD_VALUE(1));
}

}

SHARED_INIT() {
	v8::HandleScope handle_scope(JS_ISOLATE);

#ifdef windows
	WSADATA wsaData;
	WORD wVersionRequested = MAKEWORD(2, 0);
	WSAStartup(wVersionRequested, &wsaData);
#endif

	v8::Local<v8::FunctionTemplate> socketTemplate = v8::FunctionTemplate::New(JS_ISOLATE, _socket);
	socketTemplate->SetClassName(JS_STR("Socket"));
	_socketTemplate.Reset(JS_ISOLATE, socketTemplate);

	/**
	 * Constants (Socket.*)
	 */
	socketTemplate->Set(JS_STR("PF_INET"), JS_INT(PF_INET)); 
	socketTemplate->Set(JS_STR("PF_INET6"), JS_INT(PF_INET6)); 
	socketTemplate->Set(JS_STR("PF_UNIX"), JS_INT(PF_UNIX)); 
	socketTemplate->Set(JS_STR("IPPROTO_TCP"), JS_INT(IPPROTO_TCP)); 
	socketTemplate->Set(JS_STR("IPPROTO_UDP"), JS_INT(IPPROTO_UDP)); 
	socketTemplate->Set(JS_STR("SOCK_STREAM"), JS_INT(SOCK_STREAM)); 
	socketTemplate->Set(JS_STR("SOCK_DGRAM"), JS_INT(SOCK_DGRAM)); 
	socketTemplate->Set(JS_STR("SOCK_RAW"), JS_INT(SOCK_RAW)); 
	socketTemplate->Set(JS_STR("SO_REUSEADDR"), JS_INT(SO_REUSEADDR)); 
	socketTemplate->Set(JS_STR("SO_BROADCAST"), JS_INT(SO_BROADCAST)); 
	socketTemplate->Set(JS_STR("SO_KEEPALIVE"), JS_INT(SO_KEEPALIVE)); 
	socketTemplate->Set(JS_STR("SO_ERROR"), JS_INT(SO_ERROR)); 
	socketTemplate->Set(JS_STR("TCP_NODELAY"), JS_INT(TCP_NODELAY)); 
	
	socketTemplate->Set(JS_STR("getProtoByName"), v8::FunctionTemplate::New(JS_ISOLATE, _getprotobyname)->GetFunction());
	socketTemplate->Set(JS_STR("getAddrInfo"), v8::FunctionTemplate::New(JS_ISOLATE, _getaddrinfo)->GetFunction());
	socketTemplate->Set(JS_STR("getNameInfo"), v8::FunctionTemplate::New(JS_ISOLATE, _getnameinfo)->GetFunction());
	socketTemplate->Set(JS_STR("getHostName"), v8::FunctionTemplate::New(JS_ISOLATE, _gethostname)->GetFunction());
	socketTemplate->Set(JS_STR("select"), v8::FunctionTemplate::New(JS_ISOLATE, _select)->GetFunction());
	
	v8::Handle<v8::ObjectTemplate> it = socketTemplate->InstanceTemplate();
	it->SetInternalFieldCount(2); /* sock, peername */

	v8::Handle<v8::ObjectTemplate> pt = socketTemplate->PrototypeTemplate();
	
	/**
	 * Prototype methods (new Socket().*)
	 */
	pt->Set(JS_STR("connect"), v8::FunctionTemplate::New(JS_ISOLATE, _connect));
	pt->Set(JS_STR("send"), v8::FunctionTemplate::New(JS_ISOLATE, _send));
	pt->Set(JS_STR("receive"), v8::FunctionTemplate::New(JS_ISOLATE, _receive));
	pt->Set(JS_STR("bind"), v8::FunctionTemplate::New(JS_ISOLATE, _bind));
	pt->Set(JS_STR("listen"), v8::FunctionTemplate::New(JS_ISOLATE, _listen));
	pt->Set(JS_STR("accept"), v8::FunctionTemplate::New(JS_ISOLATE, _accept));
	pt->Set(JS_STR("close"), v8::FunctionTemplate::New(JS_ISOLATE, _socketclose));
	pt->Set(JS_STR("setOption"), v8::FunctionTemplate::New(JS_ISOLATE, _setoption));
	pt->Set(JS_STR("getOption"), v8::FunctionTemplate::New(JS_ISOLATE, _getoption));
	pt->Set(JS_STR("setBlocking"), v8::FunctionTemplate::New(JS_ISOLATE, _setblocking));
	pt->Set(JS_STR("getPeerName"), v8::FunctionTemplate::New(JS_ISOLATE, _getpeername));

	exports->Set(JS_STR("Socket"), socketTemplate->GetFunction());
	_socketFunc.Reset(JS_ISOLATE, socketTemplate->GetFunction());
}


<|start_filename|>src/teajs.cc<|end_filename|>
/**
 * TeaJS - (fast(cgi)) binary
 */

#include <v8.h>
#include <v8-debug.h>
#include <stdlib.h>
#include <string.h>
#include "app.h"
#include "macros.h"
#include "path.h"
#include <signal.h>

#ifdef FASTCGI
#  include <fcgi_stdio.h>
#endif

#ifdef windows
#  include <fcntl.h> /*  _O_BINARY */
   unsigned int _CRT_fmode = _O_BINARY; 
#endif

/**
 * Format for command line arguments
 *
 * as you can see if you wish to pass any arguments to v8, you MUST
 * put a -- surrounded by whitespace after all the v8 arguments
 *
 * any arguments after the v8_args but before the program_file are
 * used by TeaJS.
 */
static const char * const teajs_usage = "tea [v8_args --] [-v] [-h] [-c path] [-d port] program_file [argument ...]";

class TeaJS_CGI : public TeaJS_App {
public:
	/**
	 * Initialize from command line
	 */
	void init(int argc, char ** argv) {
		TeaJS_App::init();
		
		this->argv0 = (argc > 0 ? path_normalize(argv[0]) : std::string(""));

		if (argc == 1) {
			/* no command-line arguments, try looking for CGI env vars */
			this->fromEnvVars();
		}
		
		try {
			this->process_args(argc, argv);
		} catch (std::string e) {
			fwrite((void *) e.c_str(), sizeof(char), e.length(), stderr);
			fwrite((void *) "\n", sizeof(char), 1, stderr);
			this->exit_code = 1;
		}
	}

	void fromEnvVars() {
		char * env = getenv("PATH_TRANSLATED");
		if (!env) { env = getenv("SCRIPT_FILENAME"); }
		if (env) { this->mainfile = std::string(env); }
	}
	
private:
	std::string argv0;

	const char * instanceType() { 
		return "cli";
	}
	
	const char * executableName() {
		return this->argv0.c_str();
	}
	
	/**
	 * Process command line arguments.
	 */
	void process_args(int argc, char ** argv) {
		std::string err = "Invalid command line usage.\n";
		err += "Correct usage: ";
		err += teajs_usage; /* see the teajs_usage deftion for the format */
		
		int index = 0;

		/* see if we have v8 options */
		bool have_v8args = false;
		for (; index < argc; ++index) {
			/* FIXME: if there is a standalone "--" after the name of the script
			 then this breaks.  I can't figure out a solution to this, so
			 for now we don't support any standalone "--" after the script name.
			 One solution (and the way it currently works) is to require "--"
			 before all other args even if no v8 args are used, but that seems
			 I don't like this, but it is where we are right now. */
			if (std::string(argv[index]) == "--") {
				/* treat all previous arguments as v8 arguments */
				int v8argc = index;
				v8::V8::SetFlagsFromCommandLine(&v8argc, argv, true);
				index++; /* skip over the "--" */
				have_v8args = true;
				break;
			}
		}
		
		/* if there were no v8 args, then reset index to the first argument */
		if (!have_v8args) { index = 1; }
		
		/* scan for teajs-specific arguments now */
		while (index < argc) {
			std::string optname(argv[index]);
			if (optname[0] != '-') { break; } /* not starting with "-" => mainfile */
			if (optname.length() != 2) { throw err; } /* one-character options only */
			index++; /* skip the option name */
			
			switch (optname[1]) {
				case 'c':
					if (index >= argc) { throw err; } /* missing option value */
					this->cfgfile = argv[index];		
#ifdef VERBOSE
					printf("cfgfile: %s\n", argv[index]);
#endif
					index++; /* skip the option value */
				break;
				
				case 'h':
					printf(teajs_usage);
					printf("\n");
				break;
				
				case 'v':
					printf("TeaJS version %s", STRING(VERSION));
					printf("\n");
				break;
				
				
				default:
					throw err;
				break;
			}
			
		} 
		
		if (index < argc) {
			/* argv[index] is the program file */
			this->mainfile = argv[index];
			/* expand mainfile to absolute path */
			if (!path_isabsolute(this->mainfile)) {
				std::string tmp = path_getcwd();
				tmp += "/";
				tmp += this->mainfile;
				this->mainfile = path_normalize(this->mainfile);
			}
			index++; /* skip over the program_file */
		}
		
		/* all the rest of the arguments are arguments to the program_file */
		for (; index < argc; ++index) {
#ifdef VERBOSE
			printf("program_arg: %s\n", argv[index]);
#endif
			this->mainfile_args.push_back(std::string(argv[index]));
		}
	}
};

#ifdef FASTCGI
	/**
	 * This is true only after we receive a signal to terminate
	 */
	void handle_sigterm(int param) {
		FCGI_SetExitStatus(0);
		exit(0); 
 	}

	void handle_sigusr1(int param) {
		FCGI_SetExitStatus(0);
		exit(0); 
	}
#endif

extern char ** environ;

int main(int argc, char ** argv) {
	TeaJS_CGI cgi;
	cgi.init(argc, argv);
	if (cgi.exit_code) { exit(cgi.exit_code); }

#ifdef SIGPIPE
	signal(SIGPIPE, SIG_IGN);
#endif

#ifdef FASTCGI
	signal(SIGTERM, handle_sigterm);
#  ifdef SIGUSR1
	signal(SIGUSR1, handle_sigusr1);
#  endif
	/**
	 * FastCGI main loop
	 */
	while (FCGI_Accept() >= 0) {
		cgi.fromEnvVars();
#endif

		try {
			cgi.execute(environ);
		} catch (std::string e) {
			FILE * target;
			target = (cgi.show_errors ? stdout : stderr);
			fwrite((void *) e.c_str(), sizeof(char), e.length(), target);
			fwrite((void *) "\n", sizeof(char), 1, target);
		}
		
#ifdef FASTCGI
		FCGI_SetExitStatus(cgi.exit_code);
	}
#endif

	return cgi.exit_code;
}


<|start_filename|>src/lib/binary-b/bytearray.h<|end_filename|>
#ifndef _BYTEARRAY_H
#define _BYTEARRAY_H

#include <v8.h>
#include "macros.h"

v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function> > ByteArray_function();
v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > ByteArray_template();
void ByteArray_init(v8::Handle<v8::FunctionTemplate> binary);

#endif


<|start_filename|>src/lib/binary-b/binary-b.h<|end_filename|>
#ifndef _BINARY_H
#define _BINARY_H

#include <v8.h>
#include "macros.h"
#include "bytestring.h"
#include "bytearray.h"

#define IS_BINARY(obj) (INSTANCEOF(obj, v8::Local<v8::FunctionTemplate>::New(JS_ISOLATE, ByteArray_template())) || INSTANCEOF(obj, v8::Local<v8::FunctionTemplate>::New(JS_ISOLATE, ByteString_template())))

void Binary_length(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);
JS_METHOD(Binary_indexOf);
JS_METHOD(Binary_lastIndexOf);
JS_METHOD(Binary_codeAt);
JS_METHOD(Binary_toByteString);
JS_METHOD(Binary_toByteArray);
JS_METHOD(Binary_decodeToString);

void Binary_concat(v8::Handle<v8::Object> obj, const v8::FunctionCallbackInfo<v8::Value>& args, bool right);
void Binary_destroy(v8::Handle<v8::Object> instance);

#endif


<|start_filename|>src/lib/GL/glesbindings/glesbind.cpp<|end_filename|>

#include "glesbind.h"

#if defined(V8_GL_USE_GLEW)
#include "GL/glew.h"
#include "glew_desktop_shim.h"
#elif defined(__APPLE__)
#include <OpenGL/OpenGL.h>
#include <GLUT/glut.h>
#include "gles_desktop_shim.h"
#else
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
// If we're running on desktop OpenGL, some ES 2.0 constants don't exist, or
// are under a name with EXT in them, etc.
#include "gles_desktop_shim.h"
#endif

#include <fstream>
#include <string>
#include <string.h>
using namespace v8;


Persistent<Object> GlesFactory::self_;
Persistent<Context> GlesFactory::gles_persistent_context;
char* GlesFactory::root_path;
// glGenBuffers uses an output parameter to return an array of ints.
void GLESglGenBuffersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLsizei num_buffers = args[0]->Int32Value();

  GLuint* buffers = new GLuint[num_buffers];
  glGenBuffers(num_buffers, buffers);

  // TODO(deanm): There should be a way to initialize the array faster.
  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_buffers);
  for (int i = 0; i < num_buffers; ++i) {
    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), buffers[i]));
  }

  delete[] buffers;

  args.GetReturnValue().Set(res);
}


void GLESglGenRenderbuffersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
      if (args.Length() != 1) {
        args.GetReturnValue().SetUndefined();
        return;
      }

      HandleScope handle_scope(v8::Isolate::GetCurrent());
	  GLsizei num_buffers = args[0]->Int32Value();

	  GLuint* buffers = new GLuint[num_buffers];
	  glGenRenderbuffers(num_buffers, buffers);

	  // TODO(deanm): There should be a way to initialize the array faster.
	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_buffers);
	  for (int i = 0; i < num_buffers; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), buffers[i]));
	  }

	  delete[] buffers;

	  args.GetReturnValue().Set(res);
}


void GLESglGenFramebuffersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
      if (args.Length() != 1) {
        args.GetReturnValue().SetUndefined();
        return;
      }

	  HandleScope handle_scope(v8::Isolate::GetCurrent());
	  GLsizei num_buffers = args[0]->Int32Value();

	  GLuint* buffers = new GLuint[num_buffers];
	  glGenFramebuffers(num_buffers, buffers);

	  // TODO(deanm): There should be a way to initialize the array faster.
	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_buffers);
	  for (int i = 0; i < num_buffers; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), buffers[i]));
	  }

	  delete[] buffers;

	  args.GetReturnValue().Set(res);
}

void GLESglGenTexturesCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLsizei num_textures = args[0]->Int32Value();

  GLuint* textures = new GLuint[num_textures];
  glGenTextures(num_textures, textures);

  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_textures);
  for (int i = 0; i < num_textures; ++i) {
    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), textures[i]));
  }

  delete[] textures;

  args.GetReturnValue().Set(res);
}


// glGetShaderiv uses an output parameter to return an int.
void GLESglGetShaderivCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

  int out;
  glGetShaderiv((GLuint) arg0, (GLenum) arg1, (GLint*)&out);
  v8::Local<v8::Value> val = v8::Integer::New(v8::Isolate::GetCurrent(), out);
  args.GetReturnValue().Set(val);
}


// We expect to be called with a shader id and a single string.
void GLESglShaderSourceCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLuint shader_id = args[0]->Uint32Value();
  // GLSL source is defined as an ASCII subset.
  v8::String::Utf8Value code_ascii(args[1]);
  if (!*code_ascii){
    args.GetReturnValue().SetUndefined();
    return;
  }

  const char* code_str = *code_ascii;
  GLsizei code_len = code_ascii.length();
  glShaderSource(shader_id, 1, &code_str, &code_len);

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}


void GLESglVertexAttribPointerCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());

  unsigned int index = args[0]->Uint32Value();
  unsigned int size = args[1]->Uint32Value();
  unsigned int type = args[2]->Uint32Value();
  unsigned int normalized = args[3]->Uint32Value();
  int stride = args[4]->IntegerValue();
  void* ans;

  if(args[5]->IsArray()) {
	  Handle<Array> data = Handle<Array>::Cast(args[5]);
	  //I guess most of these types could be thrown away
	  switch(type) {
//		  case GL_BYTE:
//			  GLbyte* arg1 = new  GLbyte[data->Length()];
//			  for (unsigned j = 0; j < data->Length(); j++) {
//			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
//			      arg1[j] = (GLbyte)arg->IntegerValue();
//			  }
//			  ans = (void *)arg1;
//			  break;
//
//		  case GL_UNSIGNED_BYTE:
//			  GLubyte* arg1 = new  GLubyte[data->Length()];
//			  for (unsigned j = 0; j < data->Length(); j++) {
//			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
//			      arg1[j] = (GLubyte)arg->Uint32Value();
//			  }
//			  ans = (void *)arg1;
//			  break;

		  case GL_SHORT:
		  {
			  GLshort* arg1 = new  GLshort[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLshort)arg->IntegerValue();
			  }
			  ans = (void *)arg1;
		  }
		  break;
		  case GL_UNSIGNED_SHORT:
		  {
			  GLushort* arg1 = new  GLushort[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLushort)arg->Uint32Value();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  case GL_FLOAT:
		  {
			  GLfloat* arg1 = new  GLfloat[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLfloat)arg->NumberValue();
			  }
			  ans = (void *)arg1;
		  }
		  break;

//		  case GL_FIXED:
//		  {
//			  GLfixed* arg1 = new  GLfixed[data->Length()];
//			  for (unsigned j = 0; j < data->Length(); j++) {
//			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
//			      arg1[j] = (GLfixed)arg->IntegerValue();
//			  }
//			  ans = (void *)arg1;
//		  }
//		  break;

		  default:
            args.GetReturnValue().SetUndefined();
            return;
	  }
  } else {
	  ans = (void *)args[5]->IntegerValue();
  }

  glVertexAttribPointer((GLuint)index,
		  (GLint)size,
		  (GLenum)type,
		  (GLboolean)normalized,
		  (GLsizei)stride,
		  (const void*)ans);

  //should I delete[] ans?

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}

void GLESglDrawElementsCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned int mode  = args[0]->Uint32Value();
  int count = args[1]->IntegerValue();
  unsigned int type  = args[2]->Uint32Value();
  void* ans;

  if(args[3]->IsArray()) {
	  Handle<Array> data = Handle<Array>::Cast(args[3]);
	  switch(type) {
		  case GL_UNSIGNED_SHORT:
		  {
			  GLushort* arg1 = new  GLushort[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLushort)arg->Uint32Value();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  default:
            args.GetReturnValue().SetUndefined();
            return;
	  }
  } else {
	  ans = (void *)args[3]->IntegerValue();
  }

  glDrawElements((GLenum)mode,
		  (GLsizei)count,
		  (GLenum)type,
		  (const GLvoid*)ans);

  //should I delete[] ans?

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}

//Accepts GL_UNSIGNED_SHORT and GL_FLOAT as types
//TODO(nico): deal with interleaved data
void GLESglBufferDataCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 4 || !args[1]->IsArray()) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  unsigned int target  = args[0]->Uint32Value();
  unsigned int type = args[2]->Uint32Value();
  unsigned int usage  = args[3]->Uint32Value();
  Handle<Array> data = Handle<Array>::Cast(args[1]);
  unsigned int len = data->Length();

  if (type == GL_FLOAT) {
    GLfloat* arg1 = new GLfloat[len];
    for (unsigned j = 0; j < len; j++) {
        Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
        arg1[j] = (GLfloat)arg->NumberValue();
    }
    glBufferData((GLenum)target,
                 (GLsizeiptr)(len * sizeof(*arg1)),
                 (const void*)arg1,
                 (GLenum)usage);
    delete[] arg1;
  } else if (type == GL_UNSIGNED_SHORT) {
    GLushort* arg1 = new GLushort[len];
    for (unsigned j = 0; j < len; j++) {
      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      arg1[j] = (GLushort)arg->Uint32Value();
    }
    glBufferData((GLenum)target,
                 (GLsizeiptr)(len * sizeof(*arg1)),
                 (const void*)arg1,
                 (GLenum)usage);
    delete[] arg1;
  }

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}


//Accepts GL_UNSIGNED_SHORT and GL_FLOAT as types
//TODO(nico): deal with interleaved data
void GLESglBufferSubDataCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned int target  = args[0]->Uint32Value();
  unsigned int offset = args[1]->Uint32Value();
  unsigned int type  = args[3]->Uint32Value();

  void* ans;
  if(args[2]->IsArray()) {
	  Handle<Array> data = Handle<Array>::Cast(args[2]);
	  unsigned int len = data->Length();

	  switch(type) {
		  case GL_FLOAT:
		  {
			  GLfloat* arg1 = new  GLfloat[len];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLfloat)arg->NumberValue();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  case GL_UNSIGNED_SHORT:
		  {
			  GLushort* arg1 = new  GLushort[len];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLushort)arg->Uint32Value();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  default:
            args.GetReturnValue().SetUndefined();
            return;

	  }

	  glBufferSubData((GLenum)target,
			  (GLintptr)offset,
			  (GLsizeiptr)len,
			  (const void*)ans);

	  //should I delete[] ans?
  }

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}

void GLESglReadPixelsCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  int x = args[0]->IntegerValue();
  int y = args[1]->IntegerValue();
  unsigned width = args[2]->Uint32Value();
  unsigned height = args[3]->Uint32Value();
  unsigned format = args[4]->Uint32Value();
  unsigned type = args[5]->Uint32Value();

  //TODO(nico): should support other formats also
  if(format == GL_RGB && type == GL_UNSIGNED_BYTE) {
	  unsigned len = width * height * 3;
	  GLubyte *ans = new GLubyte[len];
	  glReadPixels((GLint)x,
			  (GLint)y,
			  (GLsizei)width,
			  (GLsizei)height,
			  (GLenum)format,
			  (GLenum)type, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), len);
	  for (unsigned i = 0; i < len; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;
	  args.GetReturnValue().Set(res);
  }

  args.GetReturnValue().SetUndefined();
}

void GLESglGetActiveAttribCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());

  unsigned program = args[0]->Uint32Value();
  unsigned index = args[1]->Uint32Value();

  char name[256];
  int length = 0;
  int size = 0;
  unsigned type = 0;

  glGetActiveAttrib((GLuint)program,
		  (GLuint)index,
		  (GLsizei)sizeof(name),
		  (GLsizei*)&length,
		  (GLint*)&size,
		  (GLenum*)&type,
		  (GLchar*)name);

  Handle<Object> ans = Object::New(v8::Isolate::GetCurrent());
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "type"), Uint32::New(v8::Isolate::GetCurrent(), type));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "size"), Integer::New(v8::Isolate::GetCurrent(), size));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "name"), String::NewFromUtf8(v8::Isolate::GetCurrent(), name, v8::String::kNormalString, length));
  args.GetReturnValue().Set(ans);
}

void GLESglGetActiveUniformCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());

  unsigned program = args[0]->Uint32Value();
  unsigned index = args[1]->Uint32Value();

  char name[256];
  int length = 0;
  int size = 0;
  unsigned type = 0;

  glGetActiveUniform((GLuint)program,
		  (GLuint)index,
		  (GLsizei)sizeof(name),
		  (GLsizei*)&length,
		  (GLint*)&size,
		  (GLenum*)&type,
		  (GLchar*)name);

  // Create a template for the answer object that'll hold
  // type/size/name as properties
  Handle<Object> ans = Object::New(v8::Isolate::GetCurrent());
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "type"), Uint32::New(v8::Isolate::GetCurrent(), type));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "size"), Integer::New(v8::Isolate::GetCurrent(), size));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "name"), String::NewFromUtf8(v8::Isolate::GetCurrent(), name));
  args.GetReturnValue().Set(ans);
}

void GLESglGetAttachedShadersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
      if (args.Length() != 1) {
        args.GetReturnValue().SetUndefined();
        return;
      }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned program = args[0]->Uint32Value();

  int maxcount = 500;
  int count = 0;
  unsigned* shaders = new unsigned[maxcount];

  glGetAttachedShaders((GLuint)program,
		  (GLsizei)maxcount,
		  (GLsizei*)&count,
		  (GLuint*)shaders);

  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), count);
  for (int i = 0; i < count; ++i) {
    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Uint32::New(v8::Isolate::GetCurrent(), shaders[i]));
  }

  delete[] shaders;

  args.GetReturnValue().Set(res);
}

void GLESglGetBufferParameterivCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->IntegerValue();
  unsigned pname = args[1]->IntegerValue();
  int ans = 0;
  //TODO(nico): does this return an array or just GLint?
  glGetBufferParameteriv((GLenum)target,
		  (GLenum)pname,
		  (GLint*)&ans);

  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
}

//GetBooleanv, GetIntegerv, GetString, GetFloatv, GetDoublev should map here.
void GLESglGetParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned pname = args[0]->Uint32Value();


  switch(pname) {
  //return 1 int value
  case GL_ALPHA_TEST_FUNC:
  case GL_ACCUM_ALPHA_BITS:
  case GL_ACCUM_BLUE_BITS:
  case GL_ACCUM_GREEN_BITS:
  case GL_ACCUM_RED_BITS:
  case GL_ALPHA_BITS:
  case GL_ATTRIB_STACK_DEPTH:
  case GL_AUX_BUFFERS:
  case GL_BLEND_DST:
  case GL_BLEND_EQUATION_EXT:
  case GL_BLEND_SRC:
  case GL_BLUE_BITS:
  case GL_SUBPIXEL_BITS:
  case GL_CLIENT_ATTRIB_STACK_DEPTH:
  case GL_COLOR_ARRAY_SIZE:
  case GL_COLOR_ARRAY_STRIDE:
  case GL_COLOR_ARRAY_TYPE:
  case GL_COLOR_MATERIAL_FACE:
  case GL_COLOR_MATERIAL_PARAMETER:
  case GL_CULL_FACE_MODE:
  case GL_DEPTH_BITS:
  case GL_DEPTH_FUNC:
  case GL_DRAW_BUFFER:
  case GL_EDGE_FLAG_ARRAY_STRIDE:
  case GL_FOG_HINT:
  case GL_FOG_MODE:
  case GL_FRONT_FACE:
  case GL_GREEN_BITS:
  case GL_INDEX_ARRAY_STRIDE:
  case GL_INDEX_ARRAY_TYPE:
  case GL_INDEX_BITS:
  case GL_INDEX_WRITEMASK:
  case GL_LINE_SMOOTH_HINT:
  case GL_LINE_STIPPLE_PATTERN:
  case GL_LINE_STIPPLE_REPEAT:
  case GL_LIST_BASE:
  case GL_LIST_INDEX: //name of the display list
  case GL_LIST_MODE:
  case GL_LOGIC_OP_MODE:
  case GL_MAP1_GRID_SEGMENTS:
  case GL_MATRIX_MODE:
  case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
  case GL_MAX_ATTRIB_STACK_DEPTH:
  case GL_MAX_CLIP_PLANES:
  case GL_MAX_EVAL_ORDER:
  case GL_MAX_LIGHTS:
  case GL_MAX_LIST_NESTING:
  case GL_MAX_MODELVIEW_STACK_DEPTH:
  case GL_MAX_NAME_STACK_DEPTH:
  case GL_MAX_PIXEL_MAP_TABLE:
  case GL_MAX_PROJECTION_STACK_DEPTH:
  case GL_MAX_TEXTURE_SIZE:
  case GL_MAX_TEXTURE_STACK_DEPTH:
  case GL_MODELVIEW_STACK_DEPTH:
  case GL_NAME_STACK_DEPTH:
  case GL_NORMAL_ARRAY_STRIDE:
  case GL_NORMAL_ARRAY_TYPE:
  case GL_PACK_ALIGNMENT:
  case GL_PACK_ROW_LENGTH:
  case GL_PACK_SKIP_PIXELS:
  case GL_PACK_SKIP_ROWS:
  case GL_PERSPECTIVE_CORRECTION_HINT:
  case GL_PIXEL_MAP_A_TO_A_SIZE:
  case GL_PIXEL_MAP_B_TO_B_SIZE:
  case GL_PIXEL_MAP_G_TO_G_SIZE:
  case GL_PIXEL_MAP_I_TO_A_SIZE:
  case GL_PIXEL_MAP_I_TO_B_SIZE:
  case GL_PIXEL_MAP_I_TO_G_SIZE:
  case GL_PIXEL_MAP_I_TO_I_SIZE:
  case GL_PIXEL_MAP_I_TO_R_SIZE:
  case GL_PIXEL_MAP_R_TO_R_SIZE:
  case GL_PIXEL_MAP_S_TO_S_SIZE:
  case GL_POINT_SMOOTH_HINT:
  case GL_POLYGON_SMOOTH_HINT:
  case GL_PROJECTION_STACK_DEPTH:
  case GL_RED_BITS:
  case GL_RENDER_MODE:
  case GL_SHADE_MODEL:
  case GL_STENCIL_BITS:
  case GL_STENCIL_CLEAR_VALUE:
  case GL_STENCIL_FAIL:
  case GL_STENCIL_FUNC:
  case GL_STENCIL_PASS_DEPTH_FAIL:
  case GL_STENCIL_PASS_DEPTH_PASS:
  case GL_STENCIL_REF:
  case GL_STENCIL_VALUE_MASK:
  case GL_STENCIL_WRITEMASK:
//  case GL_TEXTURE_1D_BINDING:
//  case GL_TEXTURE_2D_BINDING:
  case GL_TEXTURE_COORD_ARRAY_SIZE:
  case GL_TEXTURE_COORD_ARRAY_STRIDE:
  case GL_TEXTURE_COORD_ARRAY_TYPE:
  case GL_TEXTURE_STACK_DEPTH:
  case GL_UNPACK_ALIGNMENT:
  case GL_UNPACK_ROW_LENGTH:
  case GL_UNPACK_SKIP_PIXELS:
  case GL_UNPACK_SKIP_ROWS:
  case GL_VERTEX_ARRAY_SIZE:
  case GL_VERTEX_ARRAY_STRIDE:
  case GL_VERTEX_ARRAY_TYPE:
  {
	  int ans = 0;
	  glGetIntegerv((GLenum)pname, (GLint*)&ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }
  //2 values int
  case GL_LINE_WIDTH_RANGE:
  case GL_MAP2_GRID_SEGMENTS:
  case GL_MAX_VIEWPORT_DIMS:
  case GL_POLYGON_MODE:
  {
	  int* ans = new int[2];
	  glGetIntegerv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 2);
	  for (int i = 0; i < 2; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }
  //4 values int
  case GL_SCISSOR_BOX:
  case GL_VIEWPORT:
  {
	  int* ans = new int[4];
	  glGetIntegerv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //1 value boolean
  case GL_ALPHA_TEST:
  case GL_AUTO_NORMAL:
  case GL_BLEND:
  case GL_DEPTH_TEST:
//  case GL_CLIP_PLANEi:
  case GL_COLOR_ARRAY:
  case GL_COLOR_LOGIC_OP:
  case GL_COLOR_MATERIAL:
  case GL_CULL_FACE:
  case GL_CURRENT_RASTER_POSITION_VALID:
  case GL_DEPTH_WRITEMASK:
  case GL_DITHER:
  case GL_DOUBLEBUFFER:
  case GL_EDGE_FLAG:
  case GL_EDGE_FLAG_ARRAY:
  case GL_FOG:
  case GL_INDEX_ARRAY:
  case GL_INDEX_LOGIC_OP:
  case GL_INDEX_MODE:
//  case GL_LIGHTi:
  case GL_LIGHTING:
  case GL_LIGHT_MODEL_LOCAL_VIEWER:
  case GL_LIGHT_MODEL_TWO_SIDE:
  case GL_LINE_SMOOTH:
  case GL_LINE_STIPPLE:
  case GL_MAP1_COLOR_4:
  case GL_MAP1_INDEX:
  case GL_MAP1_NORMAL:
  case GL_MAP1_TEXTURE_COORD_1:
  case GL_MAP1_TEXTURE_COORD_2:
  case GL_MAP1_TEXTURE_COORD_3:
  case GL_MAP1_TEXTURE_COORD_4:
  case GL_MAP1_VERTEX_3:
  case GL_MAP1_VERTEX_4:
  case GL_MAP2_COLOR_4:
  case GL_MAP2_INDEX:
  case GL_MAP2_NORMAL:
  case GL_MAP2_TEXTURE_COORD_1:
  case GL_MAP2_TEXTURE_COORD_2:
  case GL_MAP2_TEXTURE_COORD_3:
  case GL_MAP2_TEXTURE_COORD_4:
  case GL_MAP2_VERTEX_3:
  case GL_MAP2_VERTEX_4:
  case GL_MAP_COLOR:
  case GL_MAP_STENCIL:
  case GL_NORMAL_ARRAY:
  case GL_NORMALIZE:
  case GL_PACK_LSB_FIRST:
  case GL_PACK_SWAP_BYTES:
  case GL_POINT_SMOOTH:
  case GL_POLYGON_OFFSET_FILL:
  case GL_POLYGON_OFFSET_LINE:
  case GL_POLYGON_OFFSET_POINT:
  case GL_POLYGON_SMOOTH:
  case GL_POLYGON_STIPPLE:
  case GL_READ_BUFFER:
  case GL_RGBA_MODE:
  case GL_SCISSOR_TEST:
  case GL_STENCIL_TEST:
  case GL_STEREO:
  case GL_TEXTURE_1D:
  case GL_TEXTURE_2D:
  case GL_TEXTURE_COORD_ARRAY:
  case GL_TEXTURE_GEN_Q:
  case GL_TEXTURE_GEN_R:
  case GL_TEXTURE_GEN_S:
  case GL_TEXTURE_GEN_T:
  case GL_UNPACK_LSB_FIRST:
  case GL_VERTEX_ARRAY:
  case GL_UNPACK_SWAP_BYTES:
  {
	  GLboolean ans = 0;
	  glGetBooleanv((GLenum)pname, &ans);
	  args.GetReturnValue().Set(Boolean::New(v8::Isolate::GetCurrent(), ans != GL_FALSE));
  }

  //1 value float
  case GL_ALPHA_BIAS:
  case GL_ALPHA_SCALE:
  case GL_BLUE_BIAS:
  case GL_BLUE_SCALE:
  case GL_RED_BIAS:
  case GL_RED_SCALE:
  case GL_GREEN_BIAS:
  case GL_GREEN_SCALE:
  case GL_DEPTH_BIAS:
  case GL_DEPTH_SCALE:
  case GL_ALPHA_TEST_REF:
  case GL_ZOOM_X:
  case GL_ZOOM_Y:
  case GL_CURRENT_INDEX:
  case GL_CURRENT_RASTER_DISTANCE:
  case GL_CURRENT_RASTER_INDEX:
  case GL_DEPTH_CLEAR_VALUE:
  case GL_FOG_DENSITY:
  case GL_FOG_END:
  case GL_FOG_INDEX:
  case GL_FOG_START:
  case GL_INDEX_CLEAR_VALUE:
  case GL_INDEX_OFFSET:
  case GL_INDEX_SHIFT:
  case GL_LINE_WIDTH:
  case GL_LINE_WIDTH_GRANULARITY:
  case GL_POINT_SIZE:
  case GL_POINT_SIZE_GRANULARITY:
  {
	  float ans = 0.0f;
	  glGetFloatv((GLenum)pname, &ans);
	  args.GetReturnValue().Set(Number::New(v8::Isolate::GetCurrent(), ans));
  }

  //4 values float
  case GL_BLEND_COLOR_EXT:
  case GL_ACCUM_CLEAR_VALUE:
  case GL_COLOR_CLEAR_VALUE:
  case GL_CURRENT_COLOR:
  case GL_CURRENT_RASTER_COLOR:
  case GL_CURRENT_RASTER_POSITION:
  case GL_CURRENT_RASTER_TEXTURE_COORDS:
  case GL_CURRENT_TEXTURE_COORDS:
  case GL_FOG_COLOR:
  case GL_LIGHT_MODEL_AMBIENT:
  case GL_MAP2_GRID_DOMAIN:
  case GL_POLYGON_OFFSET_FACTOR:
  case GL_POLYGON_OFFSET_UNITS:
  {
	  float* ans = new float[4];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

   //3 values float
  case GL_CURRENT_NORMAL:
  {
	  float* ans = new float[3];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 3);
	  for (int i = 0; i < 3; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //2 values float
  case GL_DEPTH_RANGE:
  case GL_MAP1_GRID_DOMAIN:
  case GL_POINT_SIZE_RANGE:
  {
	  float* ans = new float[2];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 2);
	  for (int i = 0; i < 2; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //16 values float
  case GL_MODELVIEW_MATRIX:
  case GL_PROJECTION_MATRIX:
  case GL_TEXTURE_MATRIX:
  {
	  float* ans = new float[16];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 16);
	  for (int i = 0; i < 16; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //4 values boolean
  case GL_COLOR_WRITEMASK:
  {
	  GLboolean* ans = new GLboolean[4];
	  glGetBooleanv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Boolean::New(v8::Isolate::GetCurrent(), ans[i] != GL_FALSE));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  }
  args.GetReturnValue().SetUndefined();
}


void GLESglGetProgramivCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned program = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();
  int ans;

  //TODO(nico): I haven't seen any case where this function might return
  //an array.
  glGetProgramiv((GLuint)program, (GLenum)pname, (GLint*) &ans);

  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
}

void GLESglGetProgramInfoLogCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned program = args[0]->Uint32Value();

  //query string length
  int len = 0;
  glGetProgramiv((GLuint)program, GL_INFO_LOG_LENGTH, &len);

  char* log = new char[len];
  glGetProgramInfoLog((GLuint)program, (GLsizei)len, NULL, log);

  args.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), log));
}

void GLESglGetTexParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();

  switch(pname) {
  //1 int
  case GL_TEXTURE_MAG_FILTER:
  case GL_TEXTURE_MIN_FILTER:
  case GL_TEXTURE_WRAP_S:
  case GL_TEXTURE_WRAP_T:
  {
	  int ans = 0;
	  glTexParameteriv((GLenum)target, (GLenum)pname, (GLint*) &ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }
	  //4 floats
  case GL_TEXTURE_BORDER_COLOR:
  {
	  float* ans = new float[4];
	  glTexParameterfv((GLenum)target, (GLenum)pname, (GLfloat*) ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }
	  //1 float
  case GL_TEXTURE_PRIORITY:
  {
	  float ans = 0;
	  glTexParameterfv((GLenum)target, (GLenum)pname, (GLfloat*) &ans);
	  args.GetReturnValue().Set(Number::New(v8::Isolate::GetCurrent(), ans));
  }
	  //1 boolean
  case GL_TEXTURE_RESIDENT:
  {
	  int ans = 0;
	  glTexParameteriv((GLenum)target, (GLenum)pname, (GLint*) &ans);
	  args.GetReturnValue().Set(Boolean::New(v8::Isolate::GetCurrent(), ans != GL_FALSE));
  }

  }
  args.GetReturnValue().SetUndefined();
}

void GLESglGetVertexAttribCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned index = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();

  switch(pname) {
  //1 int value
  case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
  case GL_VERTEX_ATTRIB_ARRAY_SIZE:
  case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
  case GL_VERTEX_ATTRIB_ARRAY_TYPE:
  {
	  GLint ans = 0;
	  glGetVertexAttribiv((GLuint)index, (GLenum)pname, &ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }

  //1 boolean value
  case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
  case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
  {
	  GLint ans = 0;
	  glGetVertexAttribiv((GLuint)index, (GLenum)pname, &ans);
	  args.GetReturnValue().Set(Boolean::New(v8::Isolate::GetCurrent(), ans != GL_FALSE));
  }

  //4 float values
  case GL_CURRENT_VERTEX_ATTRIB: //(?)
  {
	  GLfloat* ans = new GLfloat[4];
	  glGetVertexAttribfv((GLuint)index, (GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }
  }

  args.GetReturnValue().SetUndefined();
}

void GLESglTexImage2DCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 9) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  int level = args[1]->IntegerValue();
  int internal_format = args[2]->IntegerValue();
  int width = args[3]->IntegerValue();
  int height = args[4]->IntegerValue();
  int border = args[5]->IntegerValue();
  unsigned format = args[6]->Uint32Value();
  unsigned type = args[7]->Uint32Value();

  if(args[8]->IsArray()) {
	  Handle<Array> arr_handle = Handle<Array>::Cast(args[8]);

	  if( type == GL_UNSIGNED_BYTE ) {
		  GLubyte* pixels = new  GLubyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLubyte aux = (GLubyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  } else if( type == GL_BYTE ) {
		  GLbyte* pixels = new  GLbyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbyte aux = (GLbyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_BITMAP ) {
		  GLbitfield* pixels = new  GLbitfield[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbitfield aux = (GLbitfield)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_UNSIGNED_SHORT ) {
		  GLushort* pixels = new  GLushort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLushort aux = (GLushort)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_SHORT ) {
		  GLshort* pixels = new  GLshort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLshort aux = (GLshort)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_UNSIGNED_INT ) {
		  GLuint* pixels = new  GLuint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLuint aux = (GLuint)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_INT ) {
		  GLint* pixels = new  GLint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLint aux = (GLint)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_FLOAT ) {
		  GLfloat* pixels = new  GLfloat[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLfloat aux = (GLfloat)arg->NumberValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
  }

  args.GetReturnValue().SetUndefined();
}



void GLESglTexSubImage2DCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 9) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  int level = args[1]->IntegerValue();
  int xoffset = args[2]->IntegerValue();
  int yoffset = args[3]->IntegerValue();
  int width = args[4]->IntegerValue();
  int height = args[5]->IntegerValue();
  unsigned format = args[6]->Uint32Value();
  unsigned type = args[7]->Uint32Value();

  if(args[8]->IsArray()) {
	  Handle<Array> arr_handle = Handle<Array>::Cast(args[8]);

	  switch(type) {
	  case GL_UNSIGNED_BYTE:
	  {
		  GLubyte* pixels = new  GLubyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLubyte aux = (GLubyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_BYTE:
	  {
		  GLbyte* pixels = new  GLbyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbyte aux = (GLbyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_BITMAP:
	  {
		  GLbitfield* pixels = new  GLbitfield[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbitfield aux = (GLbitfield)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_UNSIGNED_SHORT:
	  {
		  GLushort* pixels = new  GLushort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLushort aux = (GLushort)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_SHORT:
	  {
		  GLshort* pixels = new  GLshort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLshort aux = (GLshort)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_UNSIGNED_INT:
	  {
		  GLuint* pixels = new  GLuint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLuint aux = (GLuint)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_INT:
	  {
		  GLint* pixels = new  GLint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLint aux = (GLint)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_FLOAT:
	  {
		  GLfloat* pixels = new  GLfloat[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLfloat aux = (GLfloat)arg->NumberValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;
	  }
  }

  args.GetReturnValue().SetUndefined();
}


void GLESglGetRenderbufferParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();

  switch(pname) {
  //1 int value
  case GL_RENDERBUFFER_WIDTH:
  case GL_RENDERBUFFER_HEIGHT:
  case GL_RENDERBUFFER_INTERNAL_FORMAT:
  case GL_RENDERBUFFER_RED_SIZE:
  case GL_RENDERBUFFER_GREEN_SIZE:
  case GL_RENDERBUFFER_BLUE_SIZE:
  case GL_RENDERBUFFER_ALPHA_SIZE:
  case GL_RENDERBUFFER_DEPTH_SIZE:
  case  GL_RENDERBUFFER_STENCIL_SIZE:
  {
	  int ans = 0;
	  glGetRenderbufferParameteriv((GLenum)target, (GLenum)pname, (GLint*)&ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }
  }

  args.GetReturnValue().SetUndefined();
  return;
}

void GLESglGetFramebufferAttachmentParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  unsigned attachment = args[1]->Uint32Value();
  unsigned pname = args[2]->Uint32Value();

//  switch(pname) {
//  case FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
//  case FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
//  case FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
//  case FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
//  {
	  int ans = 0;
	  glGetFramebufferAttachmentParameteriv((GLenum)target,
			  (GLenum)attachment,
			  (GLenum)pname,
			  (GLint*)&ans);

	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
//  }
//  }

  args.GetReturnValue().SetUndefined();
}

void GLESglGetShaderInfoLogCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned shader = args[0]->Uint32Value();

  //query string length
  int len = 0;
  glGetShaderiv((GLuint)shader, GL_INFO_LOG_LENGTH, &len);

  char* log = new char[len];
  glGetShaderInfoLog((GLuint)shader, (GLsizei)len, NULL, log);

  args.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), log));
}

void GLESglGetShaderSourceCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned shader = args[0]->Uint32Value();

  //query string length
  int len = 0;
  glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &len);

  char* log = new char[len];
  glGetShaderSource((GLuint)shader, (GLsizei)len, NULL, log);

  args.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), log));
}

// We expect to be called with a shader id and a single string.
void GLESglShaderSourceFileCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLuint shader_id = args[0]->Uint32Value();
  // GLSL source is defined as an ASCII subset.
  v8::String::Utf8Value filepath_ascii(args[1]);
  if (!*filepath_ascii) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  char* filepath_str = *filepath_ascii;

  //read the file source
  char* filename = NULL;
  if(filepath_str[0] != '/') {
	  filename = new char[strlen(GlesFactory::root_path) + strlen(filepath_str) +1];
	  strcpy(filename, GlesFactory::root_path);
	  strcat(filename, filepath_str);
  } else {
	  filename = new char[strlen(filepath_str) +1];
	  strcpy(filename, filepath_str);
  }

  std::ifstream in_file(filename);

  if(!in_file.is_open()) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  std::string line, full_text = "";
  while (! in_file.eof() ) {
    std::getline (in_file, line);
    full_text += line + "\n";
  }

  char* ans = new char[full_text.length() +1];
  strcpy(ans, full_text.c_str());

  GLsizei code_len = full_text.length();
  glShaderSource(shader_id, 1, (const GLchar**) &ans, &code_len);

  delete[] ans;
  delete[] filename;

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}



void GLESglActiveTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glActiveTexture((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglAttachShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glAttachShader((GLuint) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBindAttribLocationCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  String::Utf8Value value2(args[2]);
  char* arg2 = *value2;

  //make call
  glBindAttribLocation((GLuint) arg0, (GLuint) arg1, (const char*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBindBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBindBuffer((GLenum) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBindFramebufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBindFramebuffer((GLenum) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBindRenderbufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBindRenderbuffer((GLenum) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBindTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBindTexture((GLenum) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBlendColorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glBlendColor((GLclampf) arg0, (GLclampf) arg1, (GLclampf) arg2, (GLclampf) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBlendEquationCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glBlendEquation((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBlendEquationSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBlendEquationSeparate((GLenum) arg0, (GLenum) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBlendFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glBlendFunc((GLenum) arg0, (GLenum) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglBlendFuncSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glBlendFuncSeparate((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLenum) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglCheckFramebufferStatusCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glCheckFramebufferStatus((GLenum) arg0));
}




void GLESglClearCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glClear((GLbitfield) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglClearColorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glClearColor((GLclampf) arg0, (GLclampf) arg1, (GLclampf) arg2, (GLclampf) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglClearDepthfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glClearDepthf((GLclampf) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglClearStencilCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glClearStencil((GLint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglColorMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glColorMask((GLboolean) arg0, (GLboolean) arg1, (GLboolean) arg2, (GLboolean) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglCompileShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glCompileShader((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglCopyTexImage2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 8) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();
  int arg6 = args[6]->IntegerValue();
  int arg7 = args[7]->IntegerValue();

  //make call
  glCopyTexImage2D((GLenum) arg0, (GLint) arg1, (GLenum) arg2, (GLint) arg3, (GLint) arg4, (GLsizei) arg5, (GLsizei) arg6, (GLint) arg7);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglCopyTexSubImage2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 8) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();
  int arg5 = args[5]->IntegerValue();
  int arg6 = args[6]->IntegerValue();
  int arg7 = args[7]->IntegerValue();

  //make call
  glCopyTexSubImage2D((GLenum) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4, (GLint) arg5, (GLsizei) arg6, (GLsizei) arg7);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglCreateProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  args.GetReturnValue().Set(glCreateProgram());
}




void GLESglCreateShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glCreateShader((GLenum) arg0));
}




void GLESglCullFaceCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glCullFace((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDeleteBuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux;
  }


  //make call
  glDeleteBuffers((GLsizei) arg0, (const GLuint*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDeleteFramebuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux;
  }


  //make call
  glDeleteFramebuffers((GLsizei) arg0, (const GLuint*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDeleteProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDeleteProgram((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDeleteRenderbuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux;
  }


  //make call
  glDeleteRenderbuffers((GLsizei) arg0, (const GLuint*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDeleteShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDeleteShader((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDeleteTexturesCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLuint* arg1 = new  GLuint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLuint aux = ( GLuint)arg->Uint32Value();
      arg1[j] = aux;
  }


  //make call
  glDeleteTextures((GLsizei) arg0, (const GLuint*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDepthFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDepthFunc((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDepthMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDepthMask((GLboolean) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDepthRangefCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glDepthRangef((GLclampf) arg0, (GLclampf) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDetachShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glDetachShader((GLuint) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDisableCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDisable((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDisableVertexAttribArrayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glDisableVertexAttribArray((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglDrawArraysCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glDrawArrays((GLenum) arg0, (GLint) arg1, (GLsizei) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglEnableCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glEnable((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglEnableVertexAttribArrayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glEnableVertexAttribArray((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglFinishCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glFinish();
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglFlushCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glFlush();
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglFramebufferRenderbufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glFramebufferRenderbuffer((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLuint) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglFramebufferTexture2DCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();
  int arg4 = args[4]->IntegerValue();

  //make call
  glFramebufferTexture2D((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLuint) arg3, (GLint) arg4);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglFrontFaceCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glFrontFace((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGenerateMipmapCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glGenerateMipmap((GLenum) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGetAttribLocationCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  String::Utf8Value value1(args[1]);
  char* arg1 = *value1;

  //make call
  args.GetReturnValue().Set(glGetAttribLocation((GLuint) arg0, (const char*) arg1));
}




void GLESglGetBooleanvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLboolean* arg1 = new GLboolean[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLboolean aux = (GLboolean)arg->Uint32Value();
      arg1[j] = aux;
  }


  //make call
  glGetBooleanv((GLenum) arg0, (GLboolean*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGetErrorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  args.GetReturnValue().Set(glGetError());
}




void GLESglGetFloatvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLfloat* arg1 = new GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLfloat aux = (GLfloat)arg->NumberValue();
      arg1[j] = aux;
  }


  //make call
  glGetFloatv((GLenum) arg0, (GLfloat*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGetFramebufferAttachmentParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();


  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
  GLint* arg3 = new GLint[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg3[j] = aux;
  }


  //make call
  glGetFramebufferAttachmentParameteriv((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLint*) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGetIntegervCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
  GLint* arg1 = new GLint[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg1[j] = aux;
  }


  //make call
  glGetIntegerv((GLenum) arg0, (GLint*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGetUniformivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
  GLint* arg2 = new GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      GLint aux = (GLint)arg->IntegerValue();
      arg2[j] = aux;
  }


  //make call
  glGetUniformiv((GLuint) arg0, (GLint) arg1, (GLint*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglGetUniformLocationCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  String::Utf8Value value1(args[1]);
  char* arg1 = *value1;

  //make call
  args.GetReturnValue().Set(glGetUniformLocation((GLuint) arg0, (const char*) arg1));
}




void GLESglHintCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glHint((GLenum) arg0, (GLenum) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglIsBufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsBuffer((GLuint) arg0));
}




void GLESglIsEnabledCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsEnabled((GLenum) arg0));
}




void GLESglIsFramebufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsFramebuffer((GLuint) arg0));
}




void GLESglIsProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsProgram((GLuint) arg0));
}




void GLESglIsRenderbufferCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsRenderbuffer((GLuint) arg0));
}




void GLESglIsShaderCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsShader((GLuint) arg0));
}




void GLESglIsTextureCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  args.GetReturnValue().Set(glIsTexture((GLuint) arg0));
}




void GLESglLineWidthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glLineWidth((GLfloat) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglLinkProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glLinkProgram((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglPixelStoreiCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

  //make call
  glPixelStorei((GLenum) arg0, (GLint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglPolygonOffsetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glPolygonOffset((GLfloat) arg0, (GLfloat) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglRenderbufferStorageCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glRenderbufferStorage((GLenum) arg0, (GLenum) arg1, (GLsizei) arg2, (GLsizei) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglSampleCoverageCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glSampleCoverage((GLclampf) arg0, (GLboolean) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglScissorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glScissor((GLint) arg0, (GLint) arg1, (GLsizei) arg2, (GLsizei) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglStencilFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glStencilFunc((GLenum) arg0, (GLint) arg1, (GLuint) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglStencilFuncSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  int arg2 = args[2]->IntegerValue();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glStencilFuncSeparate((GLenum) arg0, (GLenum) arg1, (GLint) arg2, (GLuint) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglStencilMaskCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glStencilMask((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglStencilMaskSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();

  //make call
  glStencilMaskSeparate((GLenum) arg0, (GLuint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglStencilOpCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();

  //make call
  glStencilOp((GLenum) arg0, (GLenum) arg1, (GLenum) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglStencilOpSeparateCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  unsigned int arg2 = args[2]->Uint32Value();
  unsigned int arg3 = args[3]->Uint32Value();

  //make call
  glStencilOpSeparate((GLenum) arg0, (GLenum) arg1, (GLenum) arg2, (GLenum) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglTexParameterfCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  double arg2 = args[2]->NumberValue();

  //make call
  glTexParameterf((GLenum) arg0, (GLenum) arg1, (GLfloat) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglTexParameterfvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux;
  }


  //make call
  glTexParameterfv((GLenum) arg0, (GLenum) arg1, (const GLfloat*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglTexParameteriCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();
  int arg2 = args[2]->IntegerValue();

  //make call
  glTexParameteri((GLenum) arg0, (GLenum) arg1, (GLint) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglTexParameterivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  unsigned int arg1 = args[1]->Uint32Value();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux;
  }


  //make call
  glTexParameteriv((GLenum) arg0, (GLenum) arg1, (const GLint*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();

  //make call
  glUniform1f((GLint) arg0, (GLfloat) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux;
  }


  //make call
  glUniform1fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform1iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glUniform1i((GLint) arg0, (GLint) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform1ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux;
  }


  //make call
  glUniform1iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glUniform2f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux;
  }


  //make call
  glUniform2fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform2iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glUniform2i((GLint) arg0, (GLint) arg1, (GLint) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform2ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux;
  }


  //make call
  glUniform2iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glUniform3f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux;
  }


  //make call
  glUniform3fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform3iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glUniform3i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform3ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux;
  }


  //make call
  glUniform3iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glUniform4f((GLint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3, (GLfloat) arg4);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLfloat* arg2 = new  GLfloat[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg2[j] = aux;
  }


  //make call
  glUniform4fv((GLint) arg0, (GLsizei) arg1, (const GLfloat*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform4iCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glUniform4i((GLint) arg0, (GLint) arg1, (GLint) arg2, (GLint) arg3, (GLint) arg4);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniform4ivCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();


  Handle<Array> arrHandle2 = Handle<Array>::Cast(args[2]);
   GLint* arg2 = new  GLint[arrHandle2->Length()];
  for (unsigned j = 0; j < arrHandle2->Length(); j++) {
      Handle<Value> arg(arrHandle2->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLint aux = ( GLint)arg->IntegerValue();
      arg2[j] = aux;
  }


  //make call
  glUniform4iv((GLint) arg0, (GLsizei) arg1, (const GLint*) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniformMatrix2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();


  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux;
  }


  //make call
  glUniformMatrix2fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniformMatrix3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();


  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux;
  }


  //make call
  glUniformMatrix3fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUniformMatrix4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  unsigned int arg2 = args[2]->Uint32Value();


  Handle<Array> arrHandle3 = Handle<Array>::Cast(args[3]);
   GLfloat* arg3 = new  GLfloat[arrHandle3->Length()];
  for (unsigned j = 0; j < arrHandle3->Length(); j++) {
      Handle<Value> arg(arrHandle3->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg3[j] = aux;
  }


  //make call
  glUniformMatrix4fv((GLint) arg0, (GLsizei) arg1, (GLboolean) arg2, (const GLfloat*) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglUseProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glUseProgram((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglValidateProgramCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glValidateProgram((GLuint) arg0);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib1fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();

  //make call
  glVertexAttrib1f((GLuint) arg0, (GLfloat) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib1fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux;
  }


  //make call
  glVertexAttrib1fv((GLuint) arg0, (const GLfloat*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib2fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();

  //make call
  glVertexAttrib2f((GLuint) arg0, (GLfloat) arg1, (GLfloat) arg2);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib2fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux;
  }


  //make call
  glVertexAttrib2fv((GLuint) arg0, (const GLfloat*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib3fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glVertexAttrib3f((GLuint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib3fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux;
  }


  //make call
  glVertexAttrib3fv((GLuint) arg0, (const GLfloat*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib4fCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();
  double arg4 = args[4]->NumberValue();

  //make call
  glVertexAttrib4f((GLuint) arg0, (GLfloat) arg1, (GLfloat) arg2, (GLfloat) arg3, (GLfloat) arg4);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglVertexAttrib4fvCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();


  Handle<Array> arrHandle1 = Handle<Array>::Cast(args[1]);
   GLfloat* arg1 = new  GLfloat[arrHandle1->Length()];
  for (unsigned j = 0; j < arrHandle1->Length(); j++) {
      Handle<Value> arg(arrHandle1->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
       GLfloat aux = ( GLfloat)arg->NumberValue();
      arg1[j] = aux;
  }


  //make call
  glVertexAttrib4fv((GLuint) arg0, (const GLfloat*) arg1);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




void GLESglViewportCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glViewport((GLint) arg0, (GLint) arg1, (GLsizei) arg2, (GLsizei) arg3);
  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}




Handle<ObjectTemplate> GlesFactory::createGles(void) {
      HandleScope handle_scope(v8::Isolate::GetCurrent());

      Handle<ObjectTemplate> Gles = ObjectTemplate::New();
      
      Gles->SetInternalFieldCount(1);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ES_VERSION_2_0"), Uint32::New(v8::Isolate::GetCurrent(), GL_ES_VERSION_2_0), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_BUFFER_BIT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BUFFER_BIT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_BUFFER_BIT"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_BUFFER_BIT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FALSE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FALSE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRUE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POINTS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POINTS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINES"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINES), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_LOOP"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_LOOP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_STRIP"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_STRIP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRIANGLES"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRIANGLES), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRIANGLE_STRIP"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRIANGLE_STRIP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRIANGLE_FAN"), Uint32::New(v8::Isolate::GetCurrent(), GL_TRIANGLE_FAN), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ZERO"), Uint32::New(v8::Isolate::GetCurrent(), GL_ZERO), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_SRC_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_SRC_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_SRC_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_SRC_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DST_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_DST_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_DST_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_DST_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DST_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_DST_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_DST_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_DST_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SRC_ALPHA_SATURATE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SRC_ALPHA_SATURATE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FUNC_ADD"), Uint32::New(v8::Isolate::GetCurrent(), GL_FUNC_ADD), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_EQUATION"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_EQUATION), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_EQUATION_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_EQUATION_RGB), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_EQUATION_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_EQUATION_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FUNC_SUBTRACT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FUNC_SUBTRACT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FUNC_REVERSE_SUBTRACT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FUNC_REVERSE_SUBTRACT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_DST_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_DST_RGB), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_SRC_RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_SRC_RGB), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_DST_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_DST_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_SRC_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_SRC_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONSTANT_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONSTANT_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_CONSTANT_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_CONSTANT_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CONSTANT_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_CONSTANT_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ONE_MINUS_CONSTANT_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ONE_MINUS_CONSTANT_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND_COLOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND_COLOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ARRAY_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_ARRAY_BUFFER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ELEMENT_ARRAY_BUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_ELEMENT_ARRAY_BUFFER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_ARRAY_BUFFER_BINDING), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ELEMENT_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_ELEMENT_ARRAY_BUFFER_BINDING), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STREAM_DRAW"), Uint32::New(v8::Isolate::GetCurrent(), GL_STREAM_DRAW), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STATIC_DRAW"), Uint32::New(v8::Isolate::GetCurrent(), GL_STATIC_DRAW), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DYNAMIC_DRAW"), Uint32::New(v8::Isolate::GetCurrent(), GL_DYNAMIC_DRAW), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BUFFER_USAGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BUFFER_USAGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_VERTEX_ATTRIB"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_VERTEX_ATTRIB), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BACK"), Uint32::New(v8::Isolate::GetCurrent(), GL_BACK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT_AND_BACK"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT_AND_BACK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_2D), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CULL_FACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CULL_FACE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLEND"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLEND), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DITHER"), Uint32::New(v8::Isolate::GetCurrent(), GL_DITHER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_TEST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_TEST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCISSOR_TEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_SCISSOR_TEST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_FILL"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_FILL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_ALPHA_TO_COVERAGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_ALPHA_TO_COVERAGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_COVERAGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_COVERAGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NO_ERROR"), Uint32::New(v8::Isolate::GetCurrent(), GL_NO_ERROR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_ENUM"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVALID_ENUM), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVALID_VALUE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVALID_OPERATION"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVALID_OPERATION), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OUT_OF_MEMORY"), Uint32::New(v8::Isolate::GetCurrent(), GL_OUT_OF_MEMORY), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CW"), Uint32::New(v8::Isolate::GetCurrent(), GL_CW), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CCW"), Uint32::New(v8::Isolate::GetCurrent(), GL_CCW), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINE_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINE_WIDTH), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALIASED_POINT_SIZE_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALIASED_POINT_SIZE_RANGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALIASED_LINE_WIDTH_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALIASED_LINE_WIDTH_RANGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CULL_FACE_MODE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CULL_FACE_MODE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRONT_FACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRONT_FACE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_RANGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_RANGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_WRITEMASK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_CLEAR_VALUE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_FUNC), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_CLEAR_VALUE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_FUNC), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_FAIL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_PASS_DEPTH_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_PASS_DEPTH_FAIL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_PASS_DEPTH_PASS"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_PASS_DEPTH_PASS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_REF"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_REF), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_VALUE_MASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_VALUE_MASK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_WRITEMASK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_FUNC"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_FUNC), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_FAIL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_PASS_DEPTH_FAIL"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_PASS_DEPTH_FAIL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_PASS_DEPTH_PASS"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_PASS_DEPTH_PASS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_REF"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_REF), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_VALUE_MASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_VALUE_MASK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BACK_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BACK_WRITEMASK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIEWPORT"), Uint32::New(v8::Isolate::GetCurrent(), GL_VIEWPORT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCISSOR_BOX"), Uint32::New(v8::Isolate::GetCurrent(), GL_SCISSOR_BOX), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_CLEAR_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_CLEAR_VALUE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_WRITEMASK"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_WRITEMASK), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNPACK_ALIGNMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNPACK_ALIGNMENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PACK_ALIGNMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_PACK_ALIGNMENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VIEWPORT_DIMS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VIEWPORT_DIMS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SUBPIXEL_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_SUBPIXEL_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RED_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_RED_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREEN_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREEN_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLUE_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_BLUE_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_BITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_BITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_UNITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "POLYGON_OFFSET_FACTOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_POLYGON_OFFSET_FACTOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BINDING_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BINDING_2D), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_BUFFERS"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_BUFFERS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLES"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLES), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_COVERAGE_VALUE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_COVERAGE_VALUE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLE_COVERAGE_INVERT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLE_COVERAGE_INVERT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_COMPRESSED_TEXTURE_FORMATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_NUM_COMPRESSED_TEXTURE_FORMATS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPRESSED_TEXTURE_FORMATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPRESSED_TEXTURE_FORMATS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DONT_CARE"), Uint32::New(v8::Isolate::GetCurrent(), GL_DONT_CARE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FASTEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_FASTEST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NICEST"), Uint32::New(v8::Isolate::GetCurrent(), GL_NICEST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GENERATE_MIPMAP_HINT"), Uint32::New(v8::Isolate::GetCurrent(), GL_GENERATE_MIPMAP_HINT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BYTE"), Uint32::New(v8::Isolate::GetCurrent(), GL_BYTE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_BYTE"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_BYTE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHORT"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHORT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_INT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FIXED"), Uint32::New(v8::Isolate::GetCurrent(), GL_FIXED), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_COMPONENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_COMPONENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE_ALPHA"), Uint32::New(v8::Isolate::GetCurrent(), GL_LUMINANCE_ALPHA), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_4_4_4_4"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_4_4_4_4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_5_5_5_1"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_5_5_5_1), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UNSIGNED_SHORT_5_6_5"), Uint32::New(v8::Isolate::GetCurrent(), GL_UNSIGNED_SHORT_5_6_5), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAGMENT_SHADER"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAGMENT_SHADER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_SHADER"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_SHADER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VERTEX_ATTRIBS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VERTEX_ATTRIBS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VERTEX_UNIFORM_VECTORS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VERTEX_UNIFORM_VECTORS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VARYING_VECTORS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VARYING_VECTORS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_COMBINED_TEXTURE_IMAGE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_VERTEX_TEXTURE_IMAGE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_TEXTURE_IMAGE_UNITS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_TEXTURE_IMAGE_UNITS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_FRAGMENT_UNIFORM_VECTORS"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_FRAGMENT_UNIFORM_VECTORS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADER_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADER_TYPE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DELETE_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_DELETE_STATUS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINK_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINK_STATUS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VALIDATE_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_VALIDATE_STATUS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ATTACHED_SHADERS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ATTACHED_SHADERS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_UNIFORMS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_UNIFORMS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_UNIFORM_MAX_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_UNIFORM_MAX_LENGTH), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_ATTRIBUTES"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_ATTRIBUTES), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_ATTRIBUTE_MAX_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_ATTRIBUTE_MAX_LENGTH), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADING_LANGUAGE_VERSION"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADING_LANGUAGE_VERSION), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURRENT_PROGRAM"), Uint32::New(v8::Isolate::GetCurrent(), GL_CURRENT_PROGRAM), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEVER"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEVER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LESS"), Uint32::New(v8::Isolate::GetCurrent(), GL_LESS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_EQUAL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LEQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_LEQUAL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREATER"), Uint32::New(v8::Isolate::GetCurrent(), GL_GREATER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NOTEQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_NOTEQUAL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GEQUAL"), Uint32::New(v8::Isolate::GetCurrent(), GL_GEQUAL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALWAYS"), Uint32::New(v8::Isolate::GetCurrent(), GL_ALWAYS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEEP"), Uint32::New(v8::Isolate::GetCurrent(), GL_KEEP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REPLACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_REPLACE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INCR"), Uint32::New(v8::Isolate::GetCurrent(), GL_INCR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DECR"), Uint32::New(v8::Isolate::GetCurrent(), GL_DECR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INVERT"), Uint32::New(v8::Isolate::GetCurrent(), GL_INVERT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INCR_WRAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_INCR_WRAP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DECR_WRAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_DECR_WRAP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VENDOR"), Uint32::New(v8::Isolate::GetCurrent(), GL_VENDOR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERER"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERSION"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERSION), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EXTENSIONS"), Uint32::New(v8::Isolate::GetCurrent(), GL_EXTENSIONS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEAREST"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEAREST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINEAR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEAREST_MIPMAP_NEAREST"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEAREST_MIPMAP_NEAREST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINEAR_MIPMAP_NEAREST"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINEAR_MIPMAP_NEAREST), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NEAREST_MIPMAP_LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_NEAREST_MIPMAP_LINEAR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LINEAR_MIPMAP_LINEAR"), Uint32::New(v8::Isolate::GetCurrent(), GL_LINEAR_MIPMAP_LINEAR), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MAG_FILTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MAG_FILTER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_MIN_FILTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_MIN_FILTER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_WRAP_S"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_WRAP_S), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_WRAP_T"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_WRAP_T), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_BINDING_CUBE_MAP"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_BINDING_CUBE_MAP), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_POSITIVE_X"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_POSITIVE_X), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_NEGATIVE_X"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_NEGATIVE_X), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_POSITIVE_Y"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_POSITIVE_Y), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_NEGATIVE_Y"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Y), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_POSITIVE_Z"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_POSITIVE_Z), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE_CUBE_MAP_NEGATIVE_Z"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE_CUBE_MAP_NEGATIVE_Z), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_CUBE_MAP_TEXTURE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_CUBE_MAP_TEXTURE_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE0"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE0), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE1"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE1), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE2"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE2), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE3"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE3), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE4"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE5"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE5), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE6"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE6), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE7"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE7), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE8"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE8), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE9"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE9), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE10"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE10), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE11"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE11), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE12"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE12), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE13"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE13), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE14"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE14), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE15"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE15), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE16"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE16), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE17"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE17), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE18"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE18), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE19"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE19), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE20"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE20), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE21"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE21), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE22"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE22), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE23"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE23), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE24"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE24), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE25"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE25), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE26"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE26), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE27"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE27), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE28"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE28), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE29"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE29), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE30"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE30), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TEXTURE31"), Uint32::New(v8::Isolate::GetCurrent(), GL_TEXTURE31), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_TEXTURE"), Uint32::New(v8::Isolate::GetCurrent(), GL_ACTIVE_TEXTURE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "REPEAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_REPEAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CLAMP_TO_EDGE"), Uint32::New(v8::Isolate::GetCurrent(), GL_CLAMP_TO_EDGE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MIRRORED_REPEAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MIRRORED_REPEAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_VEC2"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_VEC2), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_VEC3"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_VEC3), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_VEC4"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_VEC4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT_VEC2"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT_VEC2), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT_VEC3"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT_VEC3), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INT_VEC4"), Uint32::New(v8::Isolate::GetCurrent(), GL_INT_VEC4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL_VEC2"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL_VEC2), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL_VEC3"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL_VEC3), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BOOL_VEC4"), Uint32::New(v8::Isolate::GetCurrent(), GL_BOOL_VEC4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT2"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT2), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT3"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT3), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FLOAT_MAT4"), Uint32::New(v8::Isolate::GetCurrent(), GL_FLOAT_MAT4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_2D"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_2D), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SAMPLER_CUBE"), Uint32::New(v8::Isolate::GetCurrent(), GL_SAMPLER_CUBE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_ENABLED"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_ENABLED), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_STRIDE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_STRIDE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_TYPE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_NORMALIZED"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_NORMALIZED), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_POINTER"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_POINTER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COMPILE_STATUS"), Uint32::New(v8::Isolate::GetCurrent(), GL_COMPILE_STATUS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INFO_LOG_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_INFO_LOG_LENGTH), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADER_SOURCE_LENGTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADER_SOURCE_LENGTH), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADER_COMPILER"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADER_COMPILER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SHADER_BINARY_FORMATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_SHADER_BINARY_FORMATS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_SHADER_BINARY_FORMATS"), Uint32::New(v8::Isolate::GetCurrent(), GL_NUM_SHADER_BINARY_FORMATS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LOW_FLOAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LOW_FLOAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MEDIUM_FLOAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MEDIUM_FLOAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HIGH_FLOAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_HIGH_FLOAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LOW_INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_LOW_INT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MEDIUM_INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_MEDIUM_INT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HIGH_INT"), Uint32::New(v8::Isolate::GetCurrent(), GL_HIGH_INT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA4"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGBA4), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB5_A1"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB5_A1), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB565"), Uint32::New(v8::Isolate::GetCurrent(), GL_RGB565), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_COMPONENT16"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_COMPONENT16), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_INDEX"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_INDEX), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_INDEX8"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_INDEX8), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_WIDTH"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_WIDTH), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_HEIGHT"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_HEIGHT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_INTERNAL_FORMAT"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_INTERNAL_FORMAT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_RED_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_RED_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_GREEN_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_GREEN_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_BLUE_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_BLUE_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_ALPHA_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_ALPHA_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_DEPTH_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_DEPTH_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_STENCIL_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_STENCIL_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "COLOR_ATTACHMENT0"), Uint32::New(v8::Isolate::GetCurrent(), GL_COLOR_ATTACHMENT0), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH_ATTACHMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_DEPTH_ATTACHMENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL_ATTACHMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_STENCIL_ATTACHMENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NONE"), Uint32::New(v8::Isolate::GetCurrent(), GL_NONE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_COMPLETE"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_COMPLETE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_INCOMPLETE_ATTACHMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_INCOMPLETE_DIMENSIONS"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_UNSUPPORTED"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_UNSUPPORTED), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FRAMEBUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_FRAMEBUFFER_BINDING), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RENDERBUFFER_BINDING"), Uint32::New(v8::Isolate::GetCurrent(), GL_RENDERBUFFER_BINDING), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MAX_RENDERBUFFER_SIZE"), Uint32::New(v8::Isolate::GetCurrent(), GL_MAX_RENDERBUFFER_SIZE), ReadOnly);

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ActiveTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglActiveTextureCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AttachShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglAttachShaderCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindAttribLocation"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBindAttribLocationCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBindBufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindFramebuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBindFramebufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindRenderbuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBindRenderbufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BindTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBindTextureCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendColor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBlendColorCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendEquation"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBlendEquationCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendEquationSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBlendEquationSeparateCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBlendFuncCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BlendFuncSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBlendFuncSeparateCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BufferData"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBufferDataCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BufferSubData"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglBufferSubDataCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CheckFramebufferStatus"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCheckFramebufferStatusCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Clear"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglClearCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearColor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglClearColorCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearDepthf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglClearDepthfCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ClearStencil"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglClearStencilCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ColorMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglColorMaskCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CompileShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCompileShaderCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexImage2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCopyTexImage2DCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyTexSubImage2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCopyTexSubImage2DCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCreateProgramCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCreateShaderCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CullFace"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglCullFaceCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteBuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDeleteBuffersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteFramebuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDeleteFramebuffersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDeleteProgramCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteRenderbuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDeleteRenderbuffersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDeleteShaderCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeleteTextures"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDeleteTexturesCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DepthFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDepthFuncCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DepthMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDepthMaskCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DepthRangef"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDepthRangefCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DetachShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDetachShaderCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Disable"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDisableCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DisableVertexAttribArray"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDisableVertexAttribArrayCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DrawArrays"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDrawArraysCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DrawElements"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglDrawElementsCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Enable"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglEnableCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EnableVertexAttribArray"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglEnableVertexAttribArrayCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Finish"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglFinishCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Flush"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglFlushCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FramebufferRenderbuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglFramebufferRenderbufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FramebufferTexture2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglFramebufferTexture2DCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FrontFace"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglFrontFaceCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenBuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGenBuffersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenerateMipmap"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGenerateMipmapCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenFramebuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGenFramebuffersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenRenderbuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGenRenderbuffersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GenTextures"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGenTexturesCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetActiveAttrib"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetActiveAttribCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetActiveUniform"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetActiveUniformCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetAttachedShaders"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetAttachedShadersCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetAttribLocation"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetAttribLocationCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetBooleanv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetBooleanvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetBufferParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetBufferParameterivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetError"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetErrorCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetFloatv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetFloatvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetFramebufferAttachmentParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetFramebufferAttachmentParameterivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetIntegerv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetIntegervCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetProgramiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetProgramivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetProgramInfoLog"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetProgramInfoLogCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetShaderiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetShaderivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetShaderInfoLog"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetShaderInfoLogCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetShaderSource"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetShaderSourceCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetUniformiv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetUniformivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetUniformLocation"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetUniformLocationCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Hint"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglHintCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsBuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsBufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsEnabled"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsEnabledCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsFramebuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsFramebufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsProgramCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsRenderbuffer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsRenderbufferCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsShader"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsShaderCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IsTexture"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglIsTextureCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LineWidth"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglLineWidthCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LinkProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglLinkProgramCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PixelStorei"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglPixelStoreiCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PolygonOffset"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglPolygonOffsetCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ReadPixels"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglReadPixelsCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RenderbufferStorage"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglRenderbufferStorageCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SampleCoverage"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglSampleCoverageCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Scissor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglScissorCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ShaderSource"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglShaderSourceCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglStencilFuncCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilFuncSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglStencilFuncSeparateCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilMask"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglStencilMaskCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilMaskSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglStencilMaskSeparateCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilOp"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglStencilOpCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StencilOpSeparate"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglStencilOpSeparateCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexImage2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglTexImage2DCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameterf"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglTexParameterfCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameterfv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglTexParameterfvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameteri"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglTexParameteriCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexParameteriv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglTexParameterivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TexSubImage2D"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglTexSubImage2DCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform1fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform1fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform1iCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform1iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform1ivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform2fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform2fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform2iCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform2iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform2ivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform3fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform3fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform3iCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform3iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform3ivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform4fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform4fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4i"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform4iCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Uniform4iv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniform4ivCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniformMatrix2fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniformMatrix3fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UniformMatrix4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUniformMatrix4fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UseProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglUseProgramCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ValidateProgram"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglValidateProgramCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib1fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib1fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib1fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib2fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib2fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib2fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib3fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib3fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib3fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4f"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib4fCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttrib4fv"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttrib4fvCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VertexAttribPointer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglVertexAttribPointerCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Viewport"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglViewportCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetParameter"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetParameterCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetTexParameter"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetTexParameterCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetVertexAttrib"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetVertexAttribCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetRenderbufferParameter"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglGetRenderbufferParameterCallback));

     Gles->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ShaderSourceFile"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLESglShaderSourceFileCallback));


      // Again, return the result through the current handle scope.
      return Gles;
}    


<|start_filename|>src/lib/binary-b/bytestring.cc<|end_filename|>
#include <v8.h>
#include <string>
#include <vector>
#include "macros.h"
#include "gc.h"
#include "binary-b.h"
#include "bytestring.h"
#include "bytestorage-b.h"

#define WRONG_CTOR JS_TYPE_ERROR("ByteString called with wrong arguments.")

namespace {

v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > _byteStringTemplate;
v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function> > _byteString;

/**
 * ByteString constructor
 */
JS_METHOD(_ByteString) {
	if (!args.IsConstructCall()) { RETURN_CONSTRUCT_CALL; }

	try {
		int arglen = args.Length();
		switch (arglen) {
			case 0: /* empty */
				SAVE_PTR(0, new ByteStorageB());
			break;
			case 1: {
				if (args[0]->IsExternal()) { /* from a bytestorage */
					SAVE_VALUE(0, args[0]);
				} else if (args[0]->IsArray()) { /* array of numbers */
					v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(args[0]);
					SAVE_PTR(0, new ByteStorageB(arr));
				} else if (args[0]->IsObject()) { /* copy constructor */
					v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(args[0]);
					if (IS_BINARY(obj)) {
						SAVE_PTR(0, new ByteStorageB(BS_OTHER(obj)));
					} else {
						WRONG_CTOR;
						return;
					}
				} else {
					WRONG_CTOR;
					return;
				}
			} break;
			case 2: {
				/* string, charset */
				v8::String::Utf8Value str(args[0]);
				v8::String::Utf8Value charset(args[1]);
				ByteStorageB bs_tmp((unsigned char *) (*str), str.length());
				ByteStorageB * bs = bs_tmp.transcode("utf-8", *charset);
				SAVE_PTR(0, bs);
			} break;
			default:
				WRONG_CTOR;
				return;
			break;
		}
	} catch (std::string e) {
		JS_ERROR(e.c_str());
		return;
	}

	GC * gc = GC_PTR;
	gc->add(args.This(), Binary_destroy);

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_slice) {
	ByteStorageB * bs = BS_THIS;
	size_t len = args.Length();
	
	size_t start = (len > 0 ? args[0]->IntegerValue() : 0);
	int end_ = (len > 1 ? args[1]->IntegerValue() : bs->getLength());
	if (end_ < 0) { end_ += bs->getLength(); }
	size_t end = (end_ < 0 ? 0 : end_);
	
	ByteStorageB * bs2 = new ByteStorageB(bs, start, end);
	v8::Handle<v8::Value> newargs[] = { v8::External::New(JS_ISOLATE, (void*)bs2) };

	v8::Local<v8::Function> byteString = v8::Local<v8::Function>::New(JS_ISOLATE, _byteString);
	args.GetReturnValue().Set(byteString->NewInstance(1, newargs));
}

JS_METHOD(_concat) {
	v8::Handle<v8::Value> newargs[]= { args.This() };
	v8::Local<v8::Function> byteString = v8::Local<v8::Function>::New(JS_ISOLATE, _byteString);
	v8::Handle<v8::Object> result = byteString->NewInstance(1, newargs);
	Binary_concat(result, args, true);
}

void _get(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
	ByteStorageB * bs = BS_OTHER(info.This());
	size_t len = bs->getLength();
	if (index < 0 || index >= len) { info.GetReturnValue().SetUndefined(); return; }
	
	ByteStorageB * bs2 = new ByteStorageB(bs, index, index+1);
	v8::Handle<v8::Value> newargs[] = { v8::External::New(JS_ISOLATE, (void*)bs2) };
	v8::Local<v8::Function> byteString = v8::Local<v8::Function>::New(JS_ISOLATE, _byteString);
	info.GetReturnValue().Set(byteString->NewInstance(1, newargs));
}


} /* end namespace */

void ByteString_init(v8::Handle<v8::FunctionTemplate> binaryTemplate) {
	v8::Local<v8::FunctionTemplate> byteStringTemplate = v8::FunctionTemplate::New(JS_ISOLATE, _ByteString);
	byteStringTemplate->Inherit(binaryTemplate);
	byteStringTemplate->SetClassName(JS_STR("ByteString"));
	_byteStringTemplate.Reset(JS_ISOLATE, byteStringTemplate);
	
	v8::Handle<v8::ObjectTemplate> byteStringObject = byteStringTemplate->InstanceTemplate();
	byteStringObject->SetInternalFieldCount(1);	
	byteStringObject->SetAccessor(JS_STR("length"), Binary_length, 0, v8::Handle<v8::Value>(), v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete));
	byteStringObject->SetIndexedPropertyHandler(_get);

	v8::Handle<v8::ObjectTemplate> byteStringPrototype = byteStringTemplate->PrototypeTemplate();
	byteStringPrototype->Set(JS_STR("slice"), v8::FunctionTemplate::New(JS_ISOLATE, _slice));
	byteStringPrototype->Set(JS_STR("concat"), v8::FunctionTemplate::New(JS_ISOLATE, _concat));

	_byteString.Reset(JS_ISOLATE, byteStringTemplate->GetFunction());
}

v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function> > ByteString_function() {
	return _byteString;
}

v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > ByteString_template() {
	return _byteStringTemplate;
}


<|start_filename|>src/lib/tls/tls.cc<|end_filename|>
/**
 * TLS library. TLS wraps a (connected) socket.
 */

#include <v8.h>
#include "macros.h"
#include "common.h"
#include <string>

#include <openssl/ssl.h>
#include <openssl/err.h>

#ifdef windows
#  define sock_errno WSAGetLastError()
#  define CONN_RESET (sock_errno == WSAECONNRESET)
#else
#  define sock_errno errno
#  define CONN_RESET (sock_errno == ECONNRESET || sock_errno == EPIPE)
#endif 



#define NOT_SOCKET JS_TYPE_ERROR("Invalid call format. Use 'new TLS(socket)'")
#define LOAD_SOCKET LOAD_VALUE(0)->ToObject()->GetInternalField(0)->Int32Value()
#define LOAD_SSL LOAD_PTR(1, SSL *)
#define SSL_ERROR(ssl, ret) JS_ERROR(formatError(ssl, ret).c_str())

namespace {
	
SSL_CTX * ctx;

std::string formatError(SSL * ssl, int ret) {
	int code = SSL_get_error(ssl, ret);
	int errcode;
	std::string reason;

	switch (code) {
		case SSL_ERROR_NONE: reason = "SSL_ERROR_NONE"; break;
		case SSL_ERROR_ZERO_RETURN: reason = "SSL_ERROR_ZERO_RETURN"; break;
		case SSL_ERROR_WANT_READ: reason = "SSL_ERROR_WANT_READ"; break;
		case SSL_ERROR_WANT_WRITE: reason = "SSL_ERROR_WANT_WRITE"; break;
		case SSL_ERROR_WANT_ACCEPT: reason = "SSL_ERROR_WANT_ACCEPT"; break;
		case SSL_ERROR_WANT_CONNECT: reason = "SSL_ERROR_WANT_CONNECT"; break;
		case SSL_ERROR_WANT_X509_LOOKUP: reason = "SSL_ERROR_WANT_X509_LOOKUP"; break;
		case SSL_ERROR_SYSCALL: 
			errcode = ERR_get_error();
			if (errcode) {
				reason = ERR_reason_error_string(errcode);
			} else {
				reason = "SSL_ERROR_SYSCALL";
			}
		break;
		case SSL_ERROR_SSL: 
			errcode = ERR_get_error();
			if (errcode) {
				reason = ERR_reason_error_string(errcode);
			} else {
				reason = "SSL_ERROR_SSL";
			}
		break;
		
		
	}
	
	return reason;
}

void finalize(v8::Handle<v8::Object> obj) {
	SSL * ssl = LOAD_PTR_FROM(obj, 1, SSL *);
	SSL_free(ssl);
}

/**
 * TLS constructor
 * @param {Socket} socket
 */
JS_METHOD(_tls) {
	ASSERT_CONSTRUCTOR;
	if (args.Length() < 1 || !args[0]->IsObject()) { NOT_SOCKET; return; }
	
	v8::Handle<v8::Value> socket = args[0];

	try {
		v8::Handle<v8::Value> socketproto = socket->ToObject()->GetPrototype();
		v8::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object> > required = APP_PTR->require("socket", "");
		v8::Local<v8::Object> socketmodule = v8::Local<v8::Object>::New(JS_ISOLATE, required);
		v8::Handle<v8::Value> prototype = socketmodule->Get(JS_STR("Socket"))->ToObject()->Get(JS_STR("prototype"));
		if (!prototype->Equals(socketproto)) { NOT_SOCKET; return; }
	} catch (std::string e) { /* for some reasons, the socket module is not available */
		JS_ERROR("Socket module not available");
		return;
	}

	SAVE_VALUE(0, socket);

	SSL * ssl = SSL_new(ctx);
	SSL_set_fd(ssl, LOAD_SOCKET);
	SAVE_PTR(1, ssl);

	GC * gc = GC_PTR;
	gc->add(args.This(), finalize);

	args.GetReturnValue().Set(args.This());
}

JS_METHOD(_getSocket) {
	args.GetReturnValue().Set(LOAD_VALUE(0));
}

JS_METHOD(_verifyCertificate) {
	args.GetReturnValue().Set(JS_INT(SSL_get_verify_result(LOAD_SSL)));
}

JS_METHOD(_useCertificate) {
	v8::String::Utf8Value file(args[0]);
	args.GetReturnValue().Set(JS_INT(SSL_use_certificate_file(LOAD_SSL, *file, SSL_FILETYPE_PEM)));
}

JS_METHOD(_usePrivateKey) {
	v8::String::Utf8Value file(args[0]);
	args.GetReturnValue().Set(JS_INT(SSL_use_PrivateKey_file(LOAD_SSL, *file, SSL_FILETYPE_PEM)));
}

JS_METHOD(_accept) {
	SSL * ssl = LOAD_SSL;
	int result = SSL_accept(ssl);
	
	if (result == 1) {
		args.GetReturnValue().Set(args.This());
	} else if (result == -1 && SSL_get_error(ssl, result) == SSL_ERROR_WANT_READ) { /* blocking socket */
		args.GetReturnValue().Set(JS_BOOL(false));
	} else {
		SSL_ERROR(ssl, result);
	}
}

JS_METHOD(_connect) {
	SSL * ssl = LOAD_SSL;
	int result = SSL_connect(ssl);
	
	if (result == 1) {
		args.GetReturnValue().Set(args.This());
	} else {
		SSL_ERROR(ssl, result);
	}
}

JS_METHOD(_receive) {
	SSL * ssl = LOAD_SSL;
	int count = args[0]->Int32Value();
	char * data = new char[count];

	ssize_t result = SSL_read(ssl, data, count);
	if (result >= 0) {
		if (result == 0) {
			int ret = SSL_get_error(ssl, result);
			if (ret != SSL_ERROR_ZERO_RETURN)  {
				delete[] data;
				SSL_ERROR(ssl, result);
				return;
			}
		}
		v8::Handle<v8::Value> buffer = JS_BUFFER(data, result);
		delete[] data;
		args.GetReturnValue().Set(buffer);
	} else {
		delete[] data;
		if (SSL_get_error(ssl, result) == SSL_ERROR_WANT_READ) { /* blocking socket */
			args.GetReturnValue().Set(JS_BOOL(false));
		} else {
			SSL_ERROR(ssl, result);
		}
	}
}

JS_METHOD(_send) {
	if (args.Length() < 1) { JS_TYPE_ERROR("Bad argument count. Use 'tls.send(data)'"); return; }
	
	SSL * ssl = LOAD_SSL;
	ssize_t result;
	
	if (IS_BUFFER(args[0])) {
		size_t size = 0;
		char * data = JS_BUFFER_TO_CHAR(args[0], &size);	
		result = SSL_write(ssl, data, size);
	} else {
		v8::String::Utf8Value data(args[0]);
		result = SSL_write(ssl, *data, data.length());
	}
	
	if (result > 0) {
		args.GetReturnValue().Set(args.This());
	} else if (SSL_get_error(ssl, result) == SSL_ERROR_WANT_WRITE) { /* blocking socket */
		args.GetReturnValue().Set(JS_BOOL(false));
	} else {
		SSL_ERROR(ssl, result);
	}
}

JS_METHOD(_close) {
	SSL * ssl = LOAD_SSL;
	int result = SSL_shutdown(ssl);
	if (result == 0) { _close(args); return; }

	if (result > 0) {
		args.GetReturnValue().Set(args.This());
	} else if (SSL_get_error(ssl, result) == SSL_ERROR_SYSCALL && result == -1 && CONN_RESET) { /* connection reset */
		args.GetReturnValue().Set(args.This());
	} else {
		SSL_ERROR(ssl, result);
	}
}

}

SHARED_INIT() {
	SSL_library_init();
	SSL_load_error_strings();
	ctx = SSL_CTX_new(TLSv1_method());

	v8::HandleScope handle_scope(JS_ISOLATE);

	v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(JS_ISOLATE, _tls);
	ft->SetClassName(JS_STR("TLS"));
	
	v8::Handle<v8::ObjectTemplate> it = ft->InstanceTemplate();
	it->SetInternalFieldCount(2); /* socket, ssl */

	v8::Handle<v8::ObjectTemplate> pt = ft->PrototypeTemplate();
	
	/**
	 * Prototype methods (new TLS().*)
	 */
	pt->Set(JS_STR("getSocket"), v8::FunctionTemplate::New(JS_ISOLATE, _getSocket));
	pt->Set(JS_STR("verifyCertificate"), v8::FunctionTemplate::New(JS_ISOLATE, _verifyCertificate));
	pt->Set(JS_STR("useCertificate"), v8::FunctionTemplate::New(JS_ISOLATE, _useCertificate));
	pt->Set(JS_STR("usePrivateKey"), v8::FunctionTemplate::New(JS_ISOLATE, _usePrivateKey));
	pt->Set(JS_STR("accept"), v8::FunctionTemplate::New(JS_ISOLATE, _accept));
	pt->Set(JS_STR("connect"), v8::FunctionTemplate::New(JS_ISOLATE, _connect));
	pt->Set(JS_STR("receive"), v8::FunctionTemplate::New(JS_ISOLATE, _receive));
	pt->Set(JS_STR("send"), v8::FunctionTemplate::New(JS_ISOLATE, _send));
	pt->Set(JS_STR("close"), v8::FunctionTemplate::New(JS_ISOLATE, _close));

	exports->Set(JS_STR("TLS"), ft->GetFunction());
}


<|start_filename|>src/lib/GL/glutbindings/glutbind.cpp<|end_filename|>


#include "glutbind.h"

int* pargc_;
char** argv_;
map<const char*, void*> font_;
Persistent<Context> GlutFactory::glut_persistent_context;
    
    

#ifdef APIENTRY_DEFINED
void GetGLUT_APIENTRY_DEFINED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_APIENTRY_DEFINED));
}
#endif




#ifdef WINGDIAPI_DEFINED
void GetGLUT_WINGDIAPI_DEFINED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINGDIAPI_DEFINED));
}
#endif




#ifdef API_VERSION
void GetGLUT_API_VERSION(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_API_VERSION));
}
#endif




#ifdef XLIB_IMPLEMENTATION
void GetGLUT_XLIB_IMPLEMENTATION(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_XLIB_IMPLEMENTATION));
}
#endif




#ifdef MACOSX_IMPLEMENTATION
void GetGLUT_MACOSX_IMPLEMENTATION(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_MACOSX_IMPLEMENTATION));
}
#endif




#ifdef RGB
void GetGLUT_RGB(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_RGB));
}
#endif




#ifdef RGBA
void GetGLUT_RGBA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_RGBA));
}
#endif




#ifdef INDEX
void GetGLUT_INDEX(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_INDEX));
}
#endif




#ifdef SINGLE
void GetGLUT_SINGLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_SINGLE));
}
#endif




#ifdef DOUBLE
void GetGLUT_DOUBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_DOUBLE));
}
#endif




#ifdef ACCUM
void GetGLUT_ACCUM(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ACCUM));
}
#endif




#ifdef ALPHA
void GetGLUT_ALPHA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ALPHA));
}
#endif




#ifdef DEPTH
void GetGLUT_DEPTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_DEPTH));
}
#endif




#ifdef STENCIL
void GetGLUT_STENCIL(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_STENCIL));
}
#endif




#ifdef MULTISAMPLE
void GetGLUT_MULTISAMPLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_MULTISAMPLE));
}
#endif




#ifdef STEREO
void GetGLUT_STEREO(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_STEREO));
}
#endif




#ifdef LUMINANCE
void GetGLUT_LUMINANCE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_LUMINANCE));
}
#endif




#ifdef NO_RECOVERY
void GetGLUT_NO_RECOVERY(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NO_RECOVERY));
}
#endif




#ifdef LEFT_BUTTON
void GetGLUT_LEFT_BUTTON(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_LEFT_BUTTON));
}
#endif




#ifdef MIDDLE_BUTTON
void GetGLUT_MIDDLE_BUTTON(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_MIDDLE_BUTTON));
}
#endif




#ifdef RIGHT_BUTTON
void GetGLUT_RIGHT_BUTTON(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_RIGHT_BUTTON));
}
#endif




#ifdef DOWN
void GetGLUT_DOWN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_DOWN));
}
#endif




#ifdef UP
void GetGLUT_UP(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_UP));
}
#endif




#ifdef KEY_F1
void GetGLUT_KEY_F1(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F1));
}
#endif




#ifdef KEY_F2
void GetGLUT_KEY_F2(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F2));
}
#endif




#ifdef KEY_F3
void GetGLUT_KEY_F3(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F3));
}
#endif




#ifdef KEY_F4
void GetGLUT_KEY_F4(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F4));
}
#endif




#ifdef KEY_F5
void GetGLUT_KEY_F5(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F5));
}
#endif




#ifdef KEY_F6
void GetGLUT_KEY_F6(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F6));
}
#endif




#ifdef KEY_F7
void GetGLUT_KEY_F7(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F7));
}
#endif




#ifdef KEY_F8
void GetGLUT_KEY_F8(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F8));
}
#endif




#ifdef KEY_F9
void GetGLUT_KEY_F9(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F9));
}
#endif




#ifdef KEY_F10
void GetGLUT_KEY_F10(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F10));
}
#endif




#ifdef KEY_F11
void GetGLUT_KEY_F11(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F11));
}
#endif




#ifdef KEY_F12
void GetGLUT_KEY_F12(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_F12));
}
#endif




#ifdef KEY_LEFT
void GetGLUT_KEY_LEFT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_LEFT));
}
#endif




#ifdef KEY_UP
void GetGLUT_KEY_UP(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_UP));
}
#endif




#ifdef KEY_RIGHT
void GetGLUT_KEY_RIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_RIGHT));
}
#endif




#ifdef KEY_DOWN
void GetGLUT_KEY_DOWN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_DOWN));
}
#endif




#ifdef KEY_PAGE_UP
void GetGLUT_KEY_PAGE_UP(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_PAGE_UP));
}
#endif




#ifdef KEY_PAGE_DOWN
void GetGLUT_KEY_PAGE_DOWN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_PAGE_DOWN));
}
#endif




#ifdef KEY_HOME
void GetGLUT_KEY_HOME(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_HOME));
}
#endif




#ifdef KEY_END
void GetGLUT_KEY_END(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_END));
}
#endif




#ifdef KEY_INSERT
void GetGLUT_KEY_INSERT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_INSERT));
}
#endif




#ifdef LEFT
void GetGLUT_LEFT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_LEFT));
}
#endif




#ifdef ENTERED
void GetGLUT_ENTERED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ENTERED));
}
#endif




#ifdef MENU_NOT_IN_USE
void GetGLUT_MENU_NOT_IN_USE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_MENU_NOT_IN_USE));
}
#endif




#ifdef MENU_IN_USE
void GetGLUT_MENU_IN_USE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_MENU_IN_USE));
}
#endif




#ifdef NOT_VISIBLE
void GetGLUT_NOT_VISIBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NOT_VISIBLE));
}
#endif




#ifdef VISIBLE
void GetGLUT_VISIBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VISIBLE));
}
#endif




#ifdef HIDDEN
void GetGLUT_HIDDEN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HIDDEN));
}
#endif




#ifdef FULLY_RETAINED
void GetGLUT_FULLY_RETAINED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_FULLY_RETAINED));
}
#endif




#ifdef PARTIALLY_RETAINED
void GetGLUT_PARTIALLY_RETAINED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_PARTIALLY_RETAINED));
}
#endif




#ifdef FULLY_COVERED
void GetGLUT_FULLY_COVERED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_FULLY_COVERED));
}
#endif




#ifdef RED
void GetGLUT_RED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_RED));
}
#endif




#ifdef GREEN
void GetGLUT_GREEN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GREEN));
}
#endif




#ifdef BLUE
void GetGLUT_BLUE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_BLUE));
}
#endif




#ifdef NORMAL
void GetGLUT_NORMAL(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NORMAL));
}
#endif




#ifdef OVERLAY
void GetGLUT_OVERLAY(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_OVERLAY));
}
#endif




#ifdef STROKE_ROMAN
void GetGLUT_STROKE_ROMAN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STROKE_ROMAN"));

}
#endif




#ifdef STROKE_MONO_ROMAN
void GetGLUT_STROKE_MONO_ROMAN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STROKE_MONO_ROMAN"));

}
#endif




#ifdef BITMAP_9_BY_15
void GetGLUT_BITMAP_9_BY_15(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_9_BY_15"));

}
#endif




#ifdef BITMAP_8_BY_13
void GetGLUT_BITMAP_8_BY_13(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_8_BY_13"));

}
#endif




#ifdef BITMAP_TIMES_ROMAN_10
void GetGLUT_BITMAP_TIMES_ROMAN_10(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_TIMES_ROMAN_10"));

}
#endif




#ifdef BITMAP_TIMES_ROMAN_24
void GetGLUT_BITMAP_TIMES_ROMAN_24(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_TIMES_ROMAN_24"));

}
#endif




#ifdef BITMAP_HELVETICA_10
void GetGLUT_BITMAP_HELVETICA_10(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_HELVETICA_10"));

}
#endif




#ifdef BITMAP_HELVETICA_12
void GetGLUT_BITMAP_HELVETICA_12(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_HELVETICA_12"));

}
#endif




#ifdef BITMAP_HELVETICA_18
void GetGLUT_BITMAP_HELVETICA_18(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_HELVETICA_18"));

}
#endif




#ifdef WINDOW_X
void GetGLUT_WINDOW_X(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_X));
}
#endif




#ifdef WINDOW_Y
void GetGLUT_WINDOW_Y(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_Y));
}
#endif




#ifdef WINDOW_WIDTH
void GetGLUT_WINDOW_WIDTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_WIDTH));
}
#endif




#ifdef WINDOW_HEIGHT
void GetGLUT_WINDOW_HEIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_HEIGHT));
}
#endif




#ifdef WINDOW_BUFFER_SIZE
void GetGLUT_WINDOW_BUFFER_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_BUFFER_SIZE));
}
#endif




#ifdef WINDOW_STENCIL_SIZE
void GetGLUT_WINDOW_STENCIL_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_STENCIL_SIZE));
}
#endif




#ifdef WINDOW_DEPTH_SIZE
void GetGLUT_WINDOW_DEPTH_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_DEPTH_SIZE));
}
#endif




#ifdef WINDOW_RED_SIZE
void GetGLUT_WINDOW_RED_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_RED_SIZE));
}
#endif




#ifdef WINDOW_GREEN_SIZE
void GetGLUT_WINDOW_GREEN_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_GREEN_SIZE));
}
#endif




#ifdef WINDOW_BLUE_SIZE
void GetGLUT_WINDOW_BLUE_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_BLUE_SIZE));
}
#endif




#ifdef WINDOW_ALPHA_SIZE
void GetGLUT_WINDOW_ALPHA_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_ALPHA_SIZE));
}
#endif




#ifdef WINDOW_ACCUM_RED_SIZE
void GetGLUT_WINDOW_ACCUM_RED_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_ACCUM_RED_SIZE));
}
#endif




#ifdef WINDOW_ACCUM_GREEN_SIZE
void GetGLUT_WINDOW_ACCUM_GREEN_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_ACCUM_GREEN_SIZE));
}
#endif




#ifdef WINDOW_ACCUM_BLUE_SIZE
void GetGLUT_WINDOW_ACCUM_BLUE_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_ACCUM_BLUE_SIZE));
}
#endif




#ifdef WINDOW_ACCUM_ALPHA_SIZE
void GetGLUT_WINDOW_ACCUM_ALPHA_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_ACCUM_ALPHA_SIZE));
}
#endif




#ifdef WINDOW_DOUBLEBUFFER
void GetGLUT_WINDOW_DOUBLEBUFFER(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_DOUBLEBUFFER));
}
#endif




#ifdef WINDOW_RGBA
void GetGLUT_WINDOW_RGBA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_RGBA));
}
#endif




#ifdef WINDOW_PARENT
void GetGLUT_WINDOW_PARENT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_PARENT));
}
#endif




#ifdef WINDOW_NUM_CHILDREN
void GetGLUT_WINDOW_NUM_CHILDREN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_NUM_CHILDREN));
}
#endif




#ifdef WINDOW_COLORMAP_SIZE
void GetGLUT_WINDOW_COLORMAP_SIZE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_COLORMAP_SIZE));
}
#endif




#ifdef WINDOW_NUM_SAMPLES
void GetGLUT_WINDOW_NUM_SAMPLES(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_NUM_SAMPLES));
}
#endif




#ifdef WINDOW_STEREO
void GetGLUT_WINDOW_STEREO(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_STEREO));
}
#endif




#ifdef WINDOW_CURSOR
void GetGLUT_WINDOW_CURSOR(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_CURSOR));
}
#endif




#ifdef SCREEN_WIDTH
void GetGLUT_SCREEN_WIDTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_SCREEN_WIDTH));
}
#endif




#ifdef SCREEN_HEIGHT
void GetGLUT_SCREEN_HEIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_SCREEN_HEIGHT));
}
#endif




#ifdef SCREEN_WIDTH_MM
void GetGLUT_SCREEN_WIDTH_MM(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_SCREEN_WIDTH_MM));
}
#endif




#ifdef SCREEN_HEIGHT_MM
void GetGLUT_SCREEN_HEIGHT_MM(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_SCREEN_HEIGHT_MM));
}
#endif




#ifdef MENU_NUM_ITEMS
void GetGLUT_MENU_NUM_ITEMS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_MENU_NUM_ITEMS));
}
#endif




#ifdef DISPLAY_MODE_POSSIBLE
void GetGLUT_DISPLAY_MODE_POSSIBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_DISPLAY_MODE_POSSIBLE));
}
#endif




#ifdef INIT_WINDOW_X
void GetGLUT_INIT_WINDOW_X(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_INIT_WINDOW_X));
}
#endif




#ifdef INIT_WINDOW_Y
void GetGLUT_INIT_WINDOW_Y(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_INIT_WINDOW_Y));
}
#endif




#ifdef INIT_WINDOW_WIDTH
void GetGLUT_INIT_WINDOW_WIDTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_INIT_WINDOW_WIDTH));
}
#endif




#ifdef INIT_WINDOW_HEIGHT
void GetGLUT_INIT_WINDOW_HEIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_INIT_WINDOW_HEIGHT));
}
#endif




#ifdef INIT_DISPLAY_MODE
void GetGLUT_INIT_DISPLAY_MODE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_INIT_DISPLAY_MODE));
}
#endif




#ifdef ELAPSED_TIME
void GetGLUT_ELAPSED_TIME(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ELAPSED_TIME));
}
#endif




#ifdef WINDOW_FORMAT_ID
void GetGLUT_WINDOW_FORMAT_ID(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_WINDOW_FORMAT_ID));
}
#endif




#ifdef HAS_KEYBOARD
void GetGLUT_HAS_KEYBOARD(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_KEYBOARD));
}
#endif




#ifdef HAS_MOUSE
void GetGLUT_HAS_MOUSE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_MOUSE));
}
#endif




#ifdef HAS_SPACEBALL
void GetGLUT_HAS_SPACEBALL(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_SPACEBALL));
}
#endif




#ifdef HAS_DIAL_AND_BUTTON_BOX
void GetGLUT_HAS_DIAL_AND_BUTTON_BOX(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_DIAL_AND_BUTTON_BOX));
}
#endif




#ifdef HAS_TABLET
void GetGLUT_HAS_TABLET(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_TABLET));
}
#endif




#ifdef NUM_MOUSE_BUTTONS
void GetGLUT_NUM_MOUSE_BUTTONS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NUM_MOUSE_BUTTONS));
}
#endif




#ifdef NUM_SPACEBALL_BUTTONS
void GetGLUT_NUM_SPACEBALL_BUTTONS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NUM_SPACEBALL_BUTTONS));
}
#endif




#ifdef NUM_BUTTON_BOX_BUTTONS
void GetGLUT_NUM_BUTTON_BOX_BUTTONS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NUM_BUTTON_BOX_BUTTONS));
}
#endif




#ifdef NUM_DIALS
void GetGLUT_NUM_DIALS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NUM_DIALS));
}
#endif




#ifdef NUM_TABLET_BUTTONS
void GetGLUT_NUM_TABLET_BUTTONS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NUM_TABLET_BUTTONS));
}
#endif




#ifdef DEVICE_IGNORE_KEY_REPEAT
void GetGLUT_DEVICE_IGNORE_KEY_REPEAT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_DEVICE_IGNORE_KEY_REPEAT));
}
#endif




#ifdef DEVICE_KEY_REPEAT
void GetGLUT_DEVICE_KEY_REPEAT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_DEVICE_KEY_REPEAT));
}
#endif




#ifdef HAS_JOYSTICK
void GetGLUT_HAS_JOYSTICK(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_JOYSTICK));
}
#endif




#ifdef OWNS_JOYSTICK
void GetGLUT_OWNS_JOYSTICK(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_OWNS_JOYSTICK));
}
#endif




#ifdef JOYSTICK_BUTTONS
void GetGLUT_JOYSTICK_BUTTONS(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_BUTTONS));
}
#endif




#ifdef JOYSTICK_AXES
void GetGLUT_JOYSTICK_AXES(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_AXES));
}
#endif




#ifdef JOYSTICK_POLL_RATE
void GetGLUT_JOYSTICK_POLL_RATE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_POLL_RATE));
}
#endif




#ifdef OVERLAY_POSSIBLE
void GetGLUT_OVERLAY_POSSIBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_OVERLAY_POSSIBLE));
}
#endif




#ifdef LAYER_IN_USE
void GetGLUT_LAYER_IN_USE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_LAYER_IN_USE));
}
#endif




#ifdef HAS_OVERLAY
void GetGLUT_HAS_OVERLAY(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_HAS_OVERLAY));
}
#endif




#ifdef TRANSPARENT_INDEX
void GetGLUT_TRANSPARENT_INDEX(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_TRANSPARENT_INDEX));
}
#endif




#ifdef NORMAL_DAMAGED
void GetGLUT_NORMAL_DAMAGED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_NORMAL_DAMAGED));
}
#endif




#ifdef OVERLAY_DAMAGED
void GetGLUT_OVERLAY_DAMAGED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_OVERLAY_DAMAGED));
}
#endif




#ifdef VIDEO_RESIZE_POSSIBLE
void GetGLUT_VIDEO_RESIZE_POSSIBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_POSSIBLE));
}
#endif




#ifdef VIDEO_RESIZE_IN_USE
void GetGLUT_VIDEO_RESIZE_IN_USE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_IN_USE));
}
#endif




#ifdef VIDEO_RESIZE_X_DELTA
void GetGLUT_VIDEO_RESIZE_X_DELTA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_X_DELTA));
}
#endif




#ifdef VIDEO_RESIZE_Y_DELTA
void GetGLUT_VIDEO_RESIZE_Y_DELTA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_Y_DELTA));
}
#endif




#ifdef VIDEO_RESIZE_WIDTH_DELTA
void GetGLUT_VIDEO_RESIZE_WIDTH_DELTA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_WIDTH_DELTA));
}
#endif




#ifdef VIDEO_RESIZE_HEIGHT_DELTA
void GetGLUT_VIDEO_RESIZE_HEIGHT_DELTA(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_HEIGHT_DELTA));
}
#endif




#ifdef VIDEO_RESIZE_X
void GetGLUT_VIDEO_RESIZE_X(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_X));
}
#endif




#ifdef VIDEO_RESIZE_Y
void GetGLUT_VIDEO_RESIZE_Y(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_Y));
}
#endif




#ifdef VIDEO_RESIZE_WIDTH
void GetGLUT_VIDEO_RESIZE_WIDTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_WIDTH));
}
#endif




#ifdef VIDEO_RESIZE_HEIGHT
void GetGLUT_VIDEO_RESIZE_HEIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_VIDEO_RESIZE_HEIGHT));
}
#endif




#ifdef ACTIVE_SHIFT
void GetGLUT_ACTIVE_SHIFT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ACTIVE_SHIFT));
}
#endif




#ifdef ACTIVE_CTRL
void GetGLUT_ACTIVE_CTRL(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ACTIVE_CTRL));
}
#endif




#ifdef ACTIVE_ALT
void GetGLUT_ACTIVE_ALT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_ACTIVE_ALT));
}
#endif




#ifdef CURSOR_RIGHT_ARROW
void GetGLUT_CURSOR_RIGHT_ARROW(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_RIGHT_ARROW));
}
#endif




#ifdef CURSOR_LEFT_ARROW
void GetGLUT_CURSOR_LEFT_ARROW(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_LEFT_ARROW));
}
#endif




#ifdef CURSOR_INFO
void GetGLUT_CURSOR_INFO(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_INFO));
}
#endif




#ifdef CURSOR_DESTROY
void GetGLUT_CURSOR_DESTROY(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_DESTROY));
}
#endif




#ifdef CURSOR_HELP
void GetGLUT_CURSOR_HELP(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_HELP));
}
#endif




#ifdef CURSOR_CYCLE
void GetGLUT_CURSOR_CYCLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_CYCLE));
}
#endif




#ifdef CURSOR_SPRAY
void GetGLUT_CURSOR_SPRAY(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_SPRAY));
}
#endif




#ifdef CURSOR_WAIT
void GetGLUT_CURSOR_WAIT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_WAIT));
}
#endif




#ifdef CURSOR_TEXT
void GetGLUT_CURSOR_TEXT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_TEXT));
}
#endif




#ifdef CURSOR_CROSSHAIR
void GetGLUT_CURSOR_CROSSHAIR(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_CROSSHAIR));
}
#endif




#ifdef CURSOR_UP_DOWN
void GetGLUT_CURSOR_UP_DOWN(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_UP_DOWN));
}
#endif




#ifdef CURSOR_LEFT_RIGHT
void GetGLUT_CURSOR_LEFT_RIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_LEFT_RIGHT));
}
#endif




#ifdef CURSOR_TOP_SIDE
void GetGLUT_CURSOR_TOP_SIDE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_TOP_SIDE));
}
#endif




#ifdef CURSOR_BOTTOM_SIDE
void GetGLUT_CURSOR_BOTTOM_SIDE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_BOTTOM_SIDE));
}
#endif




#ifdef CURSOR_LEFT_SIDE
void GetGLUT_CURSOR_LEFT_SIDE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_LEFT_SIDE));
}
#endif




#ifdef CURSOR_RIGHT_SIDE
void GetGLUT_CURSOR_RIGHT_SIDE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_RIGHT_SIDE));
}
#endif




#ifdef CURSOR_TOP_LEFT_CORNER
void GetGLUT_CURSOR_TOP_LEFT_CORNER(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_TOP_LEFT_CORNER));
}
#endif




#ifdef CURSOR_TOP_RIGHT_CORNER
void GetGLUT_CURSOR_TOP_RIGHT_CORNER(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_TOP_RIGHT_CORNER));
}
#endif




#ifdef CURSOR_BOTTOM_RIGHT_CORNER
void GetGLUT_CURSOR_BOTTOM_RIGHT_CORNER(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_BOTTOM_RIGHT_CORNER));
}
#endif




#ifdef CURSOR_BOTTOM_LEFT_CORNER
void GetGLUT_CURSOR_BOTTOM_LEFT_CORNER(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_BOTTOM_LEFT_CORNER));
}
#endif




#ifdef CURSOR_INHERIT
void GetGLUT_CURSOR_INHERIT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_INHERIT));
}
#endif




#ifdef CURSOR_NONE
void GetGLUT_CURSOR_NONE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_NONE));
}
#endif




#ifdef CURSOR_FULL_CROSSHAIR
void GetGLUT_CURSOR_FULL_CROSSHAIR(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_CURSOR_FULL_CROSSHAIR));
}
#endif



void GLUTInitCallback(const FunctionCallbackInfo<Value>& args) {
  glutInit(( int* ) pargc_, ( char** ) argv_);
  args.GetReturnValue().SetUndefined();
}



#ifdef InitDisplayMode
void GLUTInitDisplayModeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int arg0 = args[0]->Uint32Value();

  //make call
  glutInitDisplayMode((unsigned int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef InitDisplayString
void GLUTInitDisplayStringCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;

  //make call
  glutInitDisplayString((const char*)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef InitWindowPosition
void GLUTInitWindowPositionCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glutInitWindowPosition((int)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef InitWindowSize
void GLUTInitWindowSizeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glutInitWindowSize((int)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef MainLoop
void GLUTMainLoopCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutMainLoop();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef CreateWindow
void GLUTCreateWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;

  //make call
  glutCreateWindow((const char*)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef CreateSubWindow
void GLUTCreateSubWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 5) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();
  int arg4 = args[4]->IntegerValue();

  //make call
  glutCreateSubWindow((int)arg0, (int)arg1, (int)arg2, (int)arg3, (int)arg4);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef DestroyWindow
void GLUTDestroyWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutDestroyWindow((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PostRedisplay
void GLUTPostRedisplayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutPostRedisplay();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PostWindowRedisplay
void GLUTPostWindowRedisplayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutPostWindowRedisplay((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SwapBuffers
void GLUTSwapBuffersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutSwapBuffers();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef GetWindow
void GLUTGetWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutGetWindow();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetWindow
void GLUTSetWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutSetWindow((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetWindowTitle
void GLUTSetWindowTitleCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;

  //make call
  glutSetWindowTitle((const char*)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetIconTitle
void GLUTSetIconTitleCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;

  //make call
  glutSetIconTitle((const char*)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PositionWindow
void GLUTPositionWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glutPositionWindow((int)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ReshapeWindow
void GLUTReshapeWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glutReshapeWindow((int)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PopWindow
void GLUTPopWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutPopWindow();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PushWindow
void GLUTPushWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutPushWindow();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef IconifyWindow
void GLUTIconifyWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutIconifyWindow();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ShowWindow
void GLUTShowWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutShowWindow();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef HideWindow
void GLUTHideWindowCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutHideWindow();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef FullScreen
void GLUTFullScreenCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutFullScreen();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetCursor
void GLUTSetCursorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutSetCursor((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WarpPointer
void GLUTWarpPointerCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glutWarpPointer((int)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WMCloseFunc
Persistent<Function> persistentWMCloseFunc;

void funcWMCloseFunc ( ) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[0];

  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localWMCloseFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentWMCloseFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localWMCloseFunc->Call(glut_persistent_context->Global(), 0, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in WMCloseFunc: %s\n", *error);
  }
}

void GLUTWMCloseFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentWMCloseFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentWMCloseFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutWMCloseFunc((void (*)(void)) funcWMCloseFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef CheckLoop
void GLUTCheckLoopCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutCheckLoop();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef EstablishOverlay
void GLUTEstablishOverlayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutEstablishOverlay();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef RemoveOverlay
void GLUTRemoveOverlayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutRemoveOverlay();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef UseLayer
void GLUTUseLayerCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutUseLayer((GLenum)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PostOverlayRedisplay
void GLUTPostOverlayRedisplayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutPostOverlayRedisplay();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PostWindowOverlayRedisplay
void GLUTPostWindowOverlayRedisplayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutPostWindowOverlayRedisplay((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ShowOverlay
void GLUTShowOverlayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutShowOverlay();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef HideOverlay
void GLUTHideOverlayCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutHideOverlay();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef CreateMenu
void GLUTCreateMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  void* arg0 = *value0;

  //make call
  glutCreateMenu((void (*)(int))arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef DestroyMenu
void GLUTDestroyMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutDestroyMenu((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef GetMenu
void GLUTGetMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutGetMenu();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetMenu
void GLUTSetMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutSetMenu((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef AddMenuEntry
void GLUTAddMenuEntryCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;
  int arg1 = args[1]->IntegerValue();

  //make call
  glutAddMenuEntry((const char*)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef AddSubMenu
void GLUTAddSubMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;
  int arg1 = args[1]->IntegerValue();

  //make call
  glutAddSubMenu((const char*)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ChangeToMenuEntry
void GLUTChangeToMenuEntryCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  String::Utf8Value value1(args[1]);
  char* arg1 = *value1;
  int arg2 = args[2]->IntegerValue();

  //make call
  glutChangeToMenuEntry((int)arg0, (const char*)arg1, (int)arg2);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ChangeToSubMenu
void GLUTChangeToSubMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  String::Utf8Value value1(args[1]);
  char* arg1 = *value1;
  int arg2 = args[2]->IntegerValue();

  //make call
  glutChangeToSubMenu((int)arg0, (const char*)arg1, (int)arg2);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef RemoveMenuItem
void GLUTRemoveMenuItemCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutRemoveMenuItem((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef AttachMenu
void GLUTAttachMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutAttachMenu((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef DetachMenu
void GLUTDetachMenuCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutDetachMenu((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef DisplayFunc
Persistent<Function> persistentDisplayFunc;

void funcDisplayFunc ( ) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[0];

  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localDisplayFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentDisplayFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localDisplayFunc->Call(glut_persistent_context->Global(), 0, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in DisplayFunc: %s\n", *error);
  }
}

void GLUTDisplayFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentDisplayFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentDisplayFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutDisplayFunc((void (*)(void)) funcDisplayFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ReshapeFunc
Persistent<Function> persistentReshapeFunc;

void funcReshapeFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localReshapeFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentReshapeFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localReshapeFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in ReshapeFunc: %s\n", *error);
  }
}

void GLUTReshapeFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentReshapeFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentReshapeFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutReshapeFunc((void (*)(int width, int height)) funcReshapeFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef KeyboardFunc
Persistent<Function> persistentKeyboardFunc;

void funcKeyboardFunc ( unsigned char arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localKeyboardFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentKeyboardFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localKeyboardFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in KeyboardFunc: %s\n", *error);
  }
}

void GLUTKeyboardFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentKeyboardFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentKeyboardFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutKeyboardFunc((void (*)(unsigned char key, int x, int y)) funcKeyboardFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef MouseFunc
Persistent<Function> persistentMouseFunc;

void funcMouseFunc ( int arg0,int arg1,int arg2,int arg3) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[4];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  valueArr[3] = Integer::New(v8::Isolate::GetCurrent(), arg3);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localMouseFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentMouseFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localMouseFunc->Call(glut_persistent_context->Global(), 4, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in MouseFunc: %s\n", *error);
  }
}

void GLUTMouseFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentMouseFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentMouseFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutMouseFunc((void (*)(int button, int state, int x, int y)) funcMouseFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef MotionFunc
Persistent<Function> persistentMotionFunc;

void funcMotionFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localMotionFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentMotionFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localMotionFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in MotionFunc: %s\n", *error);
  }
}

void GLUTMotionFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentMotionFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentMotionFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutMotionFunc((void (*)(int x, int y)) funcMotionFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef PassiveMotionFunc
Persistent<Function> persistentPassiveMotionFunc;

void funcPassiveMotionFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localPassiveMotionFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentPassiveMotionFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localPassiveMotionFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in PassiveMotionFunc: %s\n", *error);
  }
}

void GLUTPassiveMotionFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentPassiveMotionFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentPassiveMotionFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutPassiveMotionFunc((void (*)(int x, int y)) funcPassiveMotionFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef EntryFunc
Persistent<Function> persistentEntryFunc;

void funcEntryFunc ( int arg0) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[1];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localEntryFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentEntryFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localEntryFunc->Call(glut_persistent_context->Global(), 1, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in EntryFunc: %s\n", *error);
  }
}

void GLUTEntryFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentEntryFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentEntryFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutEntryFunc((void (*)(int state)) funcEntryFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef VisibilityFunc
Persistent<Function> persistentVisibilityFunc;

void funcVisibilityFunc ( int arg0) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[1];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localVisibilityFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentVisibilityFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localVisibilityFunc->Call(glut_persistent_context->Global(), 1, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in VisibilityFunc: %s\n", *error);
  }
}

void GLUTVisibilityFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentVisibilityFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentVisibilityFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutVisibilityFunc((void (*)(int state)) funcVisibilityFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef IdleFunc
Persistent<Function> persistentIdleFunc;

void funcIdleFunc ( ) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[0];

  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localIdleFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentIdleFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localIdleFunc->Call(glut_persistent_context->Global(), 0, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in IdleFunc: %s\n", *error);
  }
}

void GLUTIdleFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentIdleFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentIdleFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutIdleFunc((void (*)(void)) funcIdleFunc);
  args.GetReturnValue().SetUndefined();
}
#endif



typedef struct {
    int value;
    Persistent<Function> timerFunc;
} timerData;

timerData * persistentTimers[50] = { NULL };

void callbackTimerFunc(int value) {
    timerData * elem = persistentTimers[value];
    if(elem != NULL) {
      //define handle scope
      HandleScope scope(v8::Isolate::GetCurrent());
      Handle<Value> args[1];
      args[0] = Integer::New(v8::Isolate::GetCurrent(), elem->value);
      Local<Function> timer = Local<Function>::New(v8::Isolate::GetCurrent(), elem->timerFunc);
      Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
      timer->Call(glut_persistent_context->Global(), 1, args);

      delete elem;
      persistentTimers[value] = NULL;
    }
}

void GLUTTimerFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned int millisec = args[0]->Uint32Value();
  int timerId = args[2]->IntegerValue();

  //find an empty timer spot and place the function there.
  int i = 0;
  bool found = false;
  for(; i < 50; i++) {
      if(persistentTimers[i] == NULL) {
          //get the function
          Handle<Function> value = Handle<Function>::Cast(args[1]);
          //assign callback and value values.
          timerData * structElem = new timerData;
          structElem->value = timerId;
          structElem->timerFunc.Reset(v8::Isolate::GetCurrent(), value);
          persistentTimers[i] = structElem;
          found = true;
          break;
      }
  }

  //TODO add dynamic resize for persistent Timers
  if(!found) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  //make call
  //Don't pass the actual *value*, but an id to our persistent Function
  glutTimerFunc(( unsigned int ) millisec, (  void (* )( int )) callbackTimerFunc, ( int ) i);
  args.GetReturnValue().SetUndefined();
}



#ifdef MenuStateFunc
Persistent<Function> persistentMenuStateFunc;

void funcMenuStateFunc ( int arg0) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[1];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localMenuStateFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentMenuStateFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localMenuStateFunc->Call(glut_persistent_context->Global(), 1, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in MenuStateFunc: %s\n", *error);
  }
}

void GLUTMenuStateFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentMenuStateFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentMenuStateFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutMenuStateFunc((void (*)(int state)) funcMenuStateFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SpecialFunc
Persistent<Function> persistentSpecialFunc;

void funcSpecialFunc ( int arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localSpecialFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentSpecialFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localSpecialFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in SpecialFunc: %s\n", *error);
  }
}

void GLUTSpecialFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentSpecialFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentSpecialFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutSpecialFunc((void (*)(int key, int x, int y)) funcSpecialFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SpaceballMotionFunc
Persistent<Function> persistentSpaceballMotionFunc;

void funcSpaceballMotionFunc ( int arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localSpaceballMotionFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentSpaceballMotionFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localSpaceballMotionFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in SpaceballMotionFunc: %s\n", *error);
  }
}

void GLUTSpaceballMotionFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentSpaceballMotionFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentSpaceballMotionFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutSpaceballMotionFunc((void (*)(int x, int y, int z)) funcSpaceballMotionFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SpaceballRotateFunc
Persistent<Function> persistentSpaceballRotateFunc;

void funcSpaceballRotateFunc ( int arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localSpaceballRotateFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentSpaceballRotateFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localSpaceballRotateFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in SpaceballRotateFunc: %s\n", *error);
  }
}

void GLUTSpaceballRotateFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentSpaceballRotateFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentSpaceballRotateFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutSpaceballRotateFunc((void (*)(int x, int y, int z)) funcSpaceballRotateFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SpaceballButtonFunc
Persistent<Function> persistentSpaceballButtonFunc;

void funcSpaceballButtonFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localSpaceballButtonFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentSpaceballButtonFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localSpaceballButtonFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in SpaceballButtonFunc: %s\n", *error);
  }
}

void GLUTSpaceballButtonFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentSpaceballButtonFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentSpaceballButtonFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutSpaceballButtonFunc((void (*)(int button, int state)) funcSpaceballButtonFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ButtonBoxFunc
Persistent<Function> persistentButtonBoxFunc;

void funcButtonBoxFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localButtonBoxFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentButtonBoxFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localButtonBoxFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in ButtonBoxFunc: %s\n", *error);
  }
}

void GLUTButtonBoxFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentButtonBoxFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentButtonBoxFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutButtonBoxFunc((void (*)(int button, int state)) funcButtonBoxFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef DialsFunc
Persistent<Function> persistentDialsFunc;

void funcDialsFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localDialsFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentDialsFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localDialsFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in DialsFunc: %s\n", *error);
  }
}

void GLUTDialsFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentDialsFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentDialsFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutDialsFunc((void (*)(int dial, int value)) funcDialsFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef TabletMotionFunc
Persistent<Function> persistentTabletMotionFunc;

void funcTabletMotionFunc ( int arg0,int arg1) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[2];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localTabletMotionFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentTabletMotionFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localTabletMotionFunc->Call(glut_persistent_context->Global(), 2, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in TabletMotionFunc: %s\n", *error);
  }
}

void GLUTTabletMotionFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentTabletMotionFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentTabletMotionFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutTabletMotionFunc((void (*)(int x, int y)) funcTabletMotionFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef TabletButtonFunc
Persistent<Function> persistentTabletButtonFunc;

void funcTabletButtonFunc ( int arg0,int arg1,int arg2,int arg3) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[4];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  valueArr[3] = Integer::New(v8::Isolate::GetCurrent(), arg3);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localTabletButtonFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentTabletButtonFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localTabletButtonFunc->Call(glut_persistent_context->Global(), 4, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in TabletButtonFunc: %s\n", *error);
  }
}

void GLUTTabletButtonFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentTabletButtonFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentTabletButtonFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutTabletButtonFunc((void (*)(int button, int state, int x, int y)) funcTabletButtonFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef MenuStatusFunc
Persistent<Function> persistentMenuStatusFunc;

void funcMenuStatusFunc ( int arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localMenuStatusFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentMenuStatusFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localMenuStatusFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in MenuStatusFunc: %s\n", *error);
  }
}

void GLUTMenuStatusFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentMenuStatusFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentMenuStatusFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutMenuStatusFunc((void (*)(int status, int x, int y)) funcMenuStatusFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef OverlayDisplayFunc
Persistent<Function> persistentOverlayDisplayFunc;

void funcOverlayDisplayFunc ( ) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[0];

  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localOverlayDisplayFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentOverlayDisplayFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localOverlayDisplayFunc->Call(glut_persistent_context->Global(), 0, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in OverlayDisplayFunc: %s\n", *error);
  }
}

void GLUTOverlayDisplayFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentOverlayDisplayFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentOverlayDisplayFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutOverlayDisplayFunc((void (*)(void)) funcOverlayDisplayFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WindowStatusFunc
Persistent<Function> persistentWindowStatusFunc;

void funcWindowStatusFunc ( int arg0) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[1];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localWindowStatusFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentWindowStatusFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localWindowStatusFunc->Call(glut_persistent_context->Global(), 1, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in WindowStatusFunc: %s\n", *error);
  }
}

void GLUTWindowStatusFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentWindowStatusFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentWindowStatusFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutWindowStatusFunc((void (*)(int state)) funcWindowStatusFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef KeyboardUpFunc
Persistent<Function> persistentKeyboardUpFunc;

void funcKeyboardUpFunc ( unsigned char arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localKeyboardUpFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentKeyboardUpFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localKeyboardUpFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in KeyboardUpFunc: %s\n", *error);
  }
}

void GLUTKeyboardUpFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentKeyboardUpFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentKeyboardUpFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutKeyboardUpFunc((void (*)(unsigned char key, int x, int y)) funcKeyboardUpFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SpecialUpFunc
Persistent<Function> persistentSpecialUpFunc;

void funcSpecialUpFunc ( int arg0,int arg1,int arg2) {
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());

  Handle<Value> valueArr[3];
  valueArr[0] = Integer::New(v8::Isolate::GetCurrent(), arg0);
  valueArr[1] = Integer::New(v8::Isolate::GetCurrent(), arg1);
  valueArr[2] = Integer::New(v8::Isolate::GetCurrent(), arg2);
  
  TryCatch try_catch(v8::Isolate::GetCurrent());
  Local<Function> localSpecialUpFunc = Local<Function>::New(v8::Isolate::GetCurrent(), persistentSpecialUpFunc);
  Local<Context> glut_persistent_context = Local<Context>::New(v8::Isolate::GetCurrent(), GlutFactory::glut_persistent_context);
  Handle<Value> result = localSpecialUpFunc->Call(glut_persistent_context->Global(), 3, valueArr);
  if (result.IsEmpty()) {
    String::Utf8Value error(try_catch.Exception());
    fprintf(stderr, "Exception in SpecialUpFunc: %s\n", *error);
  }
}

void GLUTSpecialUpFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1 || !args[0]->IsFunction()) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //get arguments
  //delete previous assigned function
  persistentSpecialUpFunc.Reset();
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  persistentSpecialUpFunc.Reset(v8::Isolate::GetCurrent(), value0);

  //make call
  glutSpecialUpFunc((void (*)(int key, int x, int y)) funcSpecialUpFunc);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef JoystickFunc
void GLUTJoystickFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  Handle<Function> value0 = Handle<Function>::Cast(args[0]);
  void* arg0 = *value0;
  int arg1 = args[1]->IntegerValue();

  //make call
  glutJoystickFunc((void (*)(unsigned int buttonMask, int x, int y, int z))arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetColor
void GLUTSetColorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  double arg1 = args[1]->NumberValue();
  double arg2 = args[2]->NumberValue();
  double arg3 = args[3]->NumberValue();

  //make call
  glutSetColor((int)arg0, (GLfloat)arg1, (GLfloat)arg2, (GLfloat)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef GetColor
void GLUTGetColorCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();

  //make call
  glutGetColor((int)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef CopyColormap
void GLUTCopyColormapCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutCopyColormap((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef Get
void GLUTGetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutGet((GLenum)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef DeviceGet
void GLUTDeviceGetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutDeviceGet((GLenum)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ExtensionSupported
void GLUTExtensionSupportedCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;

  //make call
  glutExtensionSupported((const char*)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef GetModifiers
void GLUTGetModifiersCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutGetModifiers();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef LayerGet
void GLUTLayerGetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutLayerGet((GLenum)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef BitmapCharacter
void GLUTBitmapCharacterCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* key0 = *value0;
  void* arg0 = font_[key0];
  int arg1 = args[1]->IntegerValue();

  //make call
  glutBitmapCharacter((void*)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef BitmapWidth
void GLUTBitmapWidthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* key0 = *value0;
  void* arg0 = font_[key0];
  int arg1 = args[1]->IntegerValue();

  //make call
  glutBitmapWidth((void*)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef StrokeCharacter
void GLUTStrokeCharacterCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* key0 = *value0;
  void* arg0 = font_[key0];
  int arg1 = args[1]->IntegerValue();

  //make call
  glutStrokeCharacter((void*)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef StrokeWidth
void GLUTStrokeWidthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* key0 = *value0;
  void* arg0 = font_[key0];
  int arg1 = args[1]->IntegerValue();

  //make call
  glutStrokeWidth((void*)arg0, (int)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef BitmapLength
void GLUTBitmapLengthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* key0 = *value0;
  void* arg0 = font_[key0];
  String::Utf8Value value1(args[1]);
  char* arg1 = *value1;

  //make call
  glutBitmapLength((void*)arg0, (const unsigned char*)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef StrokeLength
void GLUTStrokeLengthCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* key0 = *value0;
  void* arg0 = font_[key0];
  String::Utf8Value value1(args[1]);
  char* arg1 = *value1;

  //make call
  glutStrokeLength((void*)arg0, (const unsigned char*)arg1);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireSphere
void GLUTWireSphereCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glutWireSphere((GLdouble)arg0, (GLint)arg1, (GLint)arg2);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidSphere
void GLUTSolidSphereCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 3) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();

  //make call
  glutSolidSphere((GLdouble)arg0, (GLint)arg1, (GLint)arg2);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireCone
void GLUTWireConeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glutWireCone((GLdouble)arg0, (GLdouble)arg1, (GLint)arg2, (GLint)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidCone
void GLUTSolidConeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glutSolidCone((GLdouble)arg0, (GLdouble)arg1, (GLint)arg2, (GLint)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireCube
void GLUTWireCubeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glutWireCube((GLdouble)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidCube
void GLUTSolidCubeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glutSolidCube((GLdouble)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireTorus
void GLUTWireTorusCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glutWireTorus((GLdouble)arg0, (GLdouble)arg1, (GLint)arg2, (GLint)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidTorus
void GLUTSolidTorusCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();
  double arg1 = args[1]->NumberValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glutSolidTorus((GLdouble)arg0, (GLdouble)arg1, (GLint)arg2, (GLint)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireDodecahedron
void GLUTWireDodecahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutWireDodecahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidDodecahedron
void GLUTSolidDodecahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutSolidDodecahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireTeapot
void GLUTWireTeapotCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glutWireTeapot((GLdouble)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidTeapot
void GLUTSolidTeapotCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  double arg0 = args[0]->NumberValue();

  //make call
  glutSolidTeapot((GLdouble)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireOctahedron
void GLUTWireOctahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutWireOctahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidOctahedron
void GLUTSolidOctahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutSolidOctahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireTetrahedron
void GLUTWireTetrahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutWireTetrahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidTetrahedron
void GLUTSolidTetrahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutSolidTetrahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef WireIcosahedron
void GLUTWireIcosahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutWireIcosahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SolidIcosahedron
void GLUTSolidIcosahedronCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutSolidIcosahedron();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef VideoResizeGet
void GLUTVideoResizeGetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutVideoResizeGet((GLenum)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetupVideoResizing
void GLUTSetupVideoResizingCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutSetupVideoResizing();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef StopVideoResizing
void GLUTStopVideoResizingCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutStopVideoResizing();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef VideoResize
void GLUTVideoResizeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glutVideoResize((int)arg0, (int)arg1, (int)arg2, (int)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef VideoPan
void GLUTVideoPanCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();
  int arg1 = args[1]->IntegerValue();
  int arg2 = args[2]->IntegerValue();
  int arg3 = args[3]->IntegerValue();

  //make call
  glutVideoPan((int)arg0, (int)arg1, (int)arg2, (int)arg3);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ReportErrors
void GLUTReportErrorsCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutReportErrors();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef KEY_REPEAT_OFF
void GetGLUT_KEY_REPEAT_OFF(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_REPEAT_OFF));
}
#endif




#ifdef KEY_REPEAT_ON
void GetGLUT_KEY_REPEAT_ON(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_REPEAT_ON));
}
#endif




#ifdef KEY_REPEAT_DEFAULT
void GetGLUT_KEY_REPEAT_DEFAULT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_KEY_REPEAT_DEFAULT));
}
#endif




#ifdef JOYSTICK_BUTTON_A
void GetGLUT_JOYSTICK_BUTTON_A(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_BUTTON_A));
}
#endif




#ifdef JOYSTICK_BUTTON_B
void GetGLUT_JOYSTICK_BUTTON_B(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_BUTTON_B));
}
#endif




#ifdef JOYSTICK_BUTTON_C
void GetGLUT_JOYSTICK_BUTTON_C(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_BUTTON_C));
}
#endif




#ifdef JOYSTICK_BUTTON_D
void GetGLUT_JOYSTICK_BUTTON_D(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_JOYSTICK_BUTTON_D));
}
#endif




#ifdef IgnoreKeyRepeat
void GLUTIgnoreKeyRepeatCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutIgnoreKeyRepeat((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef SetKeyRepeat
void GLUTSetKeyRepeatCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutSetKeyRepeat((int)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef ForceJoystickFunc
void GLUTForceJoystickFuncCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutForceJoystickFunc();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef GAME_MODE_ACTIVE
void GetGLUT_GAME_MODE_ACTIVE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_ACTIVE));
}
#endif




#ifdef GAME_MODE_POSSIBLE
void GetGLUT_GAME_MODE_POSSIBLE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_POSSIBLE));
}
#endif




#ifdef GAME_MODE_WIDTH
void GetGLUT_GAME_MODE_WIDTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_WIDTH));
}
#endif




#ifdef GAME_MODE_HEIGHT
void GetGLUT_GAME_MODE_HEIGHT(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_HEIGHT));
}
#endif




#ifdef GAME_MODE_PIXEL_DEPTH
void GetGLUT_GAME_MODE_PIXEL_DEPTH(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_PIXEL_DEPTH));
}
#endif




#ifdef GAME_MODE_REFRESH_RATE
void GetGLUT_GAME_MODE_REFRESH_RATE(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_REFRESH_RATE));
}
#endif




#ifdef GAME_MODE_DISPLAY_CHANGED
void GetGLUT_GAME_MODE_DISPLAY_CHANGED(Local<String> property,
                      const PropertyCallbackInfo<Value> &info) {
    info.GetReturnValue().Set(Uint32::New(v8::Isolate::GetCurrent(), GLUT_GAME_MODE_DISPLAY_CHANGED));
}
#endif




#ifdef GameModeString
void GLUTGameModeStringCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  String::Utf8Value value0(args[0]);
  char* arg0 = *value0;

  //make call
  glutGameModeString((const char*)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef EnterGameMode
void GLUTEnterGameModeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutEnterGameMode();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef LeaveGameMode
void GLUTLeaveGameModeCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 0) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments

  //make call
  glutLeaveGameMode();
  args.GetReturnValue().SetUndefined();
}
#endif




#ifdef GameModeGet
void GLUTGameModeGetCallback(const FunctionCallbackInfo<Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope scope(v8::Isolate::GetCurrent());
  //get arguments
  int arg0 = args[0]->IntegerValue();

  //make call
  glutGameModeGet((GLenum)arg0);
  args.GetReturnValue().SetUndefined();
}
#endif



Handle<ObjectTemplate> GlutFactory::createGlut(int* pargc, char** argv) {
      pargc_ = pargc;
      argv_  = argv;
      
      Handle<ObjectTemplate> Glut = ObjectTemplate::New();
      Glut->SetInternalFieldCount(1);

     font_["STROKE_ROMAN"] = GLUT_STROKE_ROMAN;

     font_["STROKE_MONO_ROMAN"] = GLUT_STROKE_MONO_ROMAN;

     font_["BITMAP_9_BY_15"] = GLUT_BITMAP_9_BY_15;

     font_["BITMAP_8_BY_13"] = GLUT_BITMAP_8_BY_13;

     font_["BITMAP_TIMES_ROMAN_10"] = GLUT_BITMAP_TIMES_ROMAN_10;

     font_["BITMAP_TIMES_ROMAN_24"] = GLUT_BITMAP_TIMES_ROMAN_24;

     font_["BITMAP_HELVETICA_10"] = GLUT_BITMAP_HELVETICA_10;

     font_["BITMAP_HELVETICA_12"] = GLUT_BITMAP_HELVETICA_12;

     font_["BITMAP_HELVETICA_18"] = GLUT_BITMAP_HELVETICA_18;
#ifdef APIENTRY_DEFINED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "APIENTRY_DEFINED"), GetGLUT_APIENTRY_DEFINED);
#endif

#ifdef WINGDIAPI_DEFINED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINGDIAPI_DEFINED"), GetGLUT_WINGDIAPI_DEFINED);
#endif

#ifdef API_VERSION
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "API_VERSION"), GetGLUT_API_VERSION);
#endif

#ifdef XLIB_IMPLEMENTATION
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "XLIB_IMPLEMENTATION"), GetGLUT_XLIB_IMPLEMENTATION);
#endif

#ifdef MACOSX_IMPLEMENTATION
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MACOSX_IMPLEMENTATION"), GetGLUT_MACOSX_IMPLEMENTATION);
#endif

#ifdef RGB
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGB"), GetGLUT_RGB);
#endif

#ifdef RGBA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RGBA"), GetGLUT_RGBA);
#endif

#ifdef INDEX
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INDEX"), GetGLUT_INDEX);
#endif

#ifdef SINGLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SINGLE"), GetGLUT_SINGLE);
#endif

#ifdef DOUBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOUBLE"), GetGLUT_DOUBLE);
#endif

#ifdef ACCUM
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACCUM"), GetGLUT_ACCUM);
#endif

#ifdef ALPHA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ALPHA"), GetGLUT_ALPHA);
#endif

#ifdef DEPTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEPTH"), GetGLUT_DEPTH);
#endif

#ifdef STENCIL
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STENCIL"), GetGLUT_STENCIL);
#endif

#ifdef MULTISAMPLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MULTISAMPLE"), GetGLUT_MULTISAMPLE);
#endif

#ifdef STEREO
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STEREO"), GetGLUT_STEREO);
#endif

#ifdef LUMINANCE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LUMINANCE"), GetGLUT_LUMINANCE);
#endif

#ifdef NO_RECOVERY
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NO_RECOVERY"), GetGLUT_NO_RECOVERY);
#endif

#ifdef LEFT_BUTTON
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LEFT_BUTTON"), GetGLUT_LEFT_BUTTON);
#endif

#ifdef MIDDLE_BUTTON
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MIDDLE_BUTTON"), GetGLUT_MIDDLE_BUTTON);
#endif

#ifdef RIGHT_BUTTON
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RIGHT_BUTTON"), GetGLUT_RIGHT_BUTTON);
#endif

#ifdef DOWN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DOWN"), GetGLUT_DOWN);
#endif

#ifdef UP
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UP"), GetGLUT_UP);
#endif

#ifdef KEY_F1
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F1"), GetGLUT_KEY_F1);
#endif

#ifdef KEY_F2
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F2"), GetGLUT_KEY_F2);
#endif

#ifdef KEY_F3
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F3"), GetGLUT_KEY_F3);
#endif

#ifdef KEY_F4
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F4"), GetGLUT_KEY_F4);
#endif

#ifdef KEY_F5
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F5"), GetGLUT_KEY_F5);
#endif

#ifdef KEY_F6
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F6"), GetGLUT_KEY_F6);
#endif

#ifdef KEY_F7
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F7"), GetGLUT_KEY_F7);
#endif

#ifdef KEY_F8
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F8"), GetGLUT_KEY_F8);
#endif

#ifdef KEY_F9
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F9"), GetGLUT_KEY_F9);
#endif

#ifdef KEY_F10
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F10"), GetGLUT_KEY_F10);
#endif

#ifdef KEY_F11
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F11"), GetGLUT_KEY_F11);
#endif

#ifdef KEY_F12
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_F12"), GetGLUT_KEY_F12);
#endif

#ifdef KEY_LEFT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_LEFT"), GetGLUT_KEY_LEFT);
#endif

#ifdef KEY_UP
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_UP"), GetGLUT_KEY_UP);
#endif

#ifdef KEY_RIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_RIGHT"), GetGLUT_KEY_RIGHT);
#endif

#ifdef KEY_DOWN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_DOWN"), GetGLUT_KEY_DOWN);
#endif

#ifdef KEY_PAGE_UP
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_PAGE_UP"), GetGLUT_KEY_PAGE_UP);
#endif

#ifdef KEY_PAGE_DOWN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_PAGE_DOWN"), GetGLUT_KEY_PAGE_DOWN);
#endif

#ifdef KEY_HOME
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_HOME"), GetGLUT_KEY_HOME);
#endif

#ifdef KEY_END
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_END"), GetGLUT_KEY_END);
#endif

#ifdef KEY_INSERT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_INSERT"), GetGLUT_KEY_INSERT);
#endif

#ifdef LEFT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LEFT"), GetGLUT_LEFT);
#endif

#ifdef ENTERED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ENTERED"), GetGLUT_ENTERED);
#endif

#ifdef MENU_NOT_IN_USE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MENU_NOT_IN_USE"), GetGLUT_MENU_NOT_IN_USE);
#endif

#ifdef MENU_IN_USE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MENU_IN_USE"), GetGLUT_MENU_IN_USE);
#endif

#ifdef NOT_VISIBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NOT_VISIBLE"), GetGLUT_NOT_VISIBLE);
#endif

#ifdef VISIBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VISIBLE"), GetGLUT_VISIBLE);
#endif

#ifdef HIDDEN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HIDDEN"), GetGLUT_HIDDEN);
#endif

#ifdef FULLY_RETAINED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FULLY_RETAINED"), GetGLUT_FULLY_RETAINED);
#endif

#ifdef PARTIALLY_RETAINED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PARTIALLY_RETAINED"), GetGLUT_PARTIALLY_RETAINED);
#endif

#ifdef FULLY_COVERED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FULLY_COVERED"), GetGLUT_FULLY_COVERED);
#endif

#ifdef RED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RED"), GetGLUT_RED);
#endif

#ifdef GREEN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GREEN"), GetGLUT_GREEN);
#endif

#ifdef BLUE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BLUE"), GetGLUT_BLUE);
#endif

#ifdef NORMAL
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL"), GetGLUT_NORMAL);
#endif

#ifdef OVERLAY
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OVERLAY"), GetGLUT_OVERLAY);
#endif

#ifdef STROKE_ROMAN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STROKE_ROMAN"), GetGLUT_STROKE_ROMAN);
#endif

#ifdef STROKE_MONO_ROMAN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "STROKE_MONO_ROMAN"), GetGLUT_STROKE_MONO_ROMAN);
#endif

#ifdef BITMAP_9_BY_15
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_9_BY_15"), GetGLUT_BITMAP_9_BY_15);
#endif

#ifdef BITMAP_8_BY_13
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_8_BY_13"), GetGLUT_BITMAP_8_BY_13);
#endif

#ifdef BITMAP_TIMES_ROMAN_10
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_TIMES_ROMAN_10"), GetGLUT_BITMAP_TIMES_ROMAN_10);
#endif

#ifdef BITMAP_TIMES_ROMAN_24
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_TIMES_ROMAN_24"), GetGLUT_BITMAP_TIMES_ROMAN_24);
#endif

#ifdef BITMAP_HELVETICA_10
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_HELVETICA_10"), GetGLUT_BITMAP_HELVETICA_10);
#endif

#ifdef BITMAP_HELVETICA_12
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_HELVETICA_12"), GetGLUT_BITMAP_HELVETICA_12);
#endif

#ifdef BITMAP_HELVETICA_18
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BITMAP_HELVETICA_18"), GetGLUT_BITMAP_HELVETICA_18);
#endif

#ifdef WINDOW_X
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_X"), GetGLUT_WINDOW_X);
#endif

#ifdef WINDOW_Y
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_Y"), GetGLUT_WINDOW_Y);
#endif

#ifdef WINDOW_WIDTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_WIDTH"), GetGLUT_WINDOW_WIDTH);
#endif

#ifdef WINDOW_HEIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_HEIGHT"), GetGLUT_WINDOW_HEIGHT);
#endif

#ifdef WINDOW_BUFFER_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_BUFFER_SIZE"), GetGLUT_WINDOW_BUFFER_SIZE);
#endif

#ifdef WINDOW_STENCIL_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_STENCIL_SIZE"), GetGLUT_WINDOW_STENCIL_SIZE);
#endif

#ifdef WINDOW_DEPTH_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_DEPTH_SIZE"), GetGLUT_WINDOW_DEPTH_SIZE);
#endif

#ifdef WINDOW_RED_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_RED_SIZE"), GetGLUT_WINDOW_RED_SIZE);
#endif

#ifdef WINDOW_GREEN_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_GREEN_SIZE"), GetGLUT_WINDOW_GREEN_SIZE);
#endif

#ifdef WINDOW_BLUE_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_BLUE_SIZE"), GetGLUT_WINDOW_BLUE_SIZE);
#endif

#ifdef WINDOW_ALPHA_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_ALPHA_SIZE"), GetGLUT_WINDOW_ALPHA_SIZE);
#endif

#ifdef WINDOW_ACCUM_RED_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_ACCUM_RED_SIZE"), GetGLUT_WINDOW_ACCUM_RED_SIZE);
#endif

#ifdef WINDOW_ACCUM_GREEN_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_ACCUM_GREEN_SIZE"), GetGLUT_WINDOW_ACCUM_GREEN_SIZE);
#endif

#ifdef WINDOW_ACCUM_BLUE_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_ACCUM_BLUE_SIZE"), GetGLUT_WINDOW_ACCUM_BLUE_SIZE);
#endif

#ifdef WINDOW_ACCUM_ALPHA_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_ACCUM_ALPHA_SIZE"), GetGLUT_WINDOW_ACCUM_ALPHA_SIZE);
#endif

#ifdef WINDOW_DOUBLEBUFFER
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_DOUBLEBUFFER"), GetGLUT_WINDOW_DOUBLEBUFFER);
#endif

#ifdef WINDOW_RGBA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_RGBA"), GetGLUT_WINDOW_RGBA);
#endif

#ifdef WINDOW_PARENT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_PARENT"), GetGLUT_WINDOW_PARENT);
#endif

#ifdef WINDOW_NUM_CHILDREN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_NUM_CHILDREN"), GetGLUT_WINDOW_NUM_CHILDREN);
#endif

#ifdef WINDOW_COLORMAP_SIZE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_COLORMAP_SIZE"), GetGLUT_WINDOW_COLORMAP_SIZE);
#endif

#ifdef WINDOW_NUM_SAMPLES
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_NUM_SAMPLES"), GetGLUT_WINDOW_NUM_SAMPLES);
#endif

#ifdef WINDOW_STEREO
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_STEREO"), GetGLUT_WINDOW_STEREO);
#endif

#ifdef WINDOW_CURSOR
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_CURSOR"), GetGLUT_WINDOW_CURSOR);
#endif

#ifdef SCREEN_WIDTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCREEN_WIDTH"), GetGLUT_SCREEN_WIDTH);
#endif

#ifdef SCREEN_HEIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCREEN_HEIGHT"), GetGLUT_SCREEN_HEIGHT);
#endif

#ifdef SCREEN_WIDTH_MM
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCREEN_WIDTH_MM"), GetGLUT_SCREEN_WIDTH_MM);
#endif

#ifdef SCREEN_HEIGHT_MM
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SCREEN_HEIGHT_MM"), GetGLUT_SCREEN_HEIGHT_MM);
#endif

#ifdef MENU_NUM_ITEMS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MENU_NUM_ITEMS"), GetGLUT_MENU_NUM_ITEMS);
#endif

#ifdef DISPLAY_MODE_POSSIBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DISPLAY_MODE_POSSIBLE"), GetGLUT_DISPLAY_MODE_POSSIBLE);
#endif

#ifdef INIT_WINDOW_X
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INIT_WINDOW_X"), GetGLUT_INIT_WINDOW_X);
#endif

#ifdef INIT_WINDOW_Y
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INIT_WINDOW_Y"), GetGLUT_INIT_WINDOW_Y);
#endif

#ifdef INIT_WINDOW_WIDTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INIT_WINDOW_WIDTH"), GetGLUT_INIT_WINDOW_WIDTH);
#endif

#ifdef INIT_WINDOW_HEIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INIT_WINDOW_HEIGHT"), GetGLUT_INIT_WINDOW_HEIGHT);
#endif

#ifdef INIT_DISPLAY_MODE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "INIT_DISPLAY_MODE"), GetGLUT_INIT_DISPLAY_MODE);
#endif

#ifdef ELAPSED_TIME
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ELAPSED_TIME"), GetGLUT_ELAPSED_TIME);
#endif

#ifdef WINDOW_FORMAT_ID
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WINDOW_FORMAT_ID"), GetGLUT_WINDOW_FORMAT_ID);
#endif

#ifdef HAS_KEYBOARD
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_KEYBOARD"), GetGLUT_HAS_KEYBOARD);
#endif

#ifdef HAS_MOUSE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_MOUSE"), GetGLUT_HAS_MOUSE);
#endif

#ifdef HAS_SPACEBALL
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_SPACEBALL"), GetGLUT_HAS_SPACEBALL);
#endif

#ifdef HAS_DIAL_AND_BUTTON_BOX
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_DIAL_AND_BUTTON_BOX"), GetGLUT_HAS_DIAL_AND_BUTTON_BOX);
#endif

#ifdef HAS_TABLET
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_TABLET"), GetGLUT_HAS_TABLET);
#endif

#ifdef NUM_MOUSE_BUTTONS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_MOUSE_BUTTONS"), GetGLUT_NUM_MOUSE_BUTTONS);
#endif

#ifdef NUM_SPACEBALL_BUTTONS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_SPACEBALL_BUTTONS"), GetGLUT_NUM_SPACEBALL_BUTTONS);
#endif

#ifdef NUM_BUTTON_BOX_BUTTONS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_BUTTON_BOX_BUTTONS"), GetGLUT_NUM_BUTTON_BOX_BUTTONS);
#endif

#ifdef NUM_DIALS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_DIALS"), GetGLUT_NUM_DIALS);
#endif

#ifdef NUM_TABLET_BUTTONS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NUM_TABLET_BUTTONS"), GetGLUT_NUM_TABLET_BUTTONS);
#endif

#ifdef DEVICE_IGNORE_KEY_REPEAT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEVICE_IGNORE_KEY_REPEAT"), GetGLUT_DEVICE_IGNORE_KEY_REPEAT);
#endif

#ifdef DEVICE_KEY_REPEAT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DEVICE_KEY_REPEAT"), GetGLUT_DEVICE_KEY_REPEAT);
#endif

#ifdef HAS_JOYSTICK
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_JOYSTICK"), GetGLUT_HAS_JOYSTICK);
#endif

#ifdef OWNS_JOYSTICK
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OWNS_JOYSTICK"), GetGLUT_OWNS_JOYSTICK);
#endif

#ifdef JOYSTICK_BUTTONS
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_BUTTONS"), GetGLUT_JOYSTICK_BUTTONS);
#endif

#ifdef JOYSTICK_AXES
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_AXES"), GetGLUT_JOYSTICK_AXES);
#endif

#ifdef JOYSTICK_POLL_RATE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_POLL_RATE"), GetGLUT_JOYSTICK_POLL_RATE);
#endif

#ifdef OVERLAY_POSSIBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OVERLAY_POSSIBLE"), GetGLUT_OVERLAY_POSSIBLE);
#endif

#ifdef LAYER_IN_USE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LAYER_IN_USE"), GetGLUT_LAYER_IN_USE);
#endif

#ifdef HAS_OVERLAY
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HAS_OVERLAY"), GetGLUT_HAS_OVERLAY);
#endif

#ifdef TRANSPARENT_INDEX
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TRANSPARENT_INDEX"), GetGLUT_TRANSPARENT_INDEX);
#endif

#ifdef NORMAL_DAMAGED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "NORMAL_DAMAGED"), GetGLUT_NORMAL_DAMAGED);
#endif

#ifdef OVERLAY_DAMAGED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OVERLAY_DAMAGED"), GetGLUT_OVERLAY_DAMAGED);
#endif

#ifdef VIDEO_RESIZE_POSSIBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_POSSIBLE"), GetGLUT_VIDEO_RESIZE_POSSIBLE);
#endif

#ifdef VIDEO_RESIZE_IN_USE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_IN_USE"), GetGLUT_VIDEO_RESIZE_IN_USE);
#endif

#ifdef VIDEO_RESIZE_X_DELTA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_X_DELTA"), GetGLUT_VIDEO_RESIZE_X_DELTA);
#endif

#ifdef VIDEO_RESIZE_Y_DELTA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_Y_DELTA"), GetGLUT_VIDEO_RESIZE_Y_DELTA);
#endif

#ifdef VIDEO_RESIZE_WIDTH_DELTA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_WIDTH_DELTA"), GetGLUT_VIDEO_RESIZE_WIDTH_DELTA);
#endif

#ifdef VIDEO_RESIZE_HEIGHT_DELTA
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_HEIGHT_DELTA"), GetGLUT_VIDEO_RESIZE_HEIGHT_DELTA);
#endif

#ifdef VIDEO_RESIZE_X
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_X"), GetGLUT_VIDEO_RESIZE_X);
#endif

#ifdef VIDEO_RESIZE_Y
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_Y"), GetGLUT_VIDEO_RESIZE_Y);
#endif

#ifdef VIDEO_RESIZE_WIDTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_WIDTH"), GetGLUT_VIDEO_RESIZE_WIDTH);
#endif

#ifdef VIDEO_RESIZE_HEIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VIDEO_RESIZE_HEIGHT"), GetGLUT_VIDEO_RESIZE_HEIGHT);
#endif

#ifdef ACTIVE_SHIFT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_SHIFT"), GetGLUT_ACTIVE_SHIFT);
#endif

#ifdef ACTIVE_CTRL
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_CTRL"), GetGLUT_ACTIVE_CTRL);
#endif

#ifdef ACTIVE_ALT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ACTIVE_ALT"), GetGLUT_ACTIVE_ALT);
#endif

#ifdef CURSOR_RIGHT_ARROW
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_RIGHT_ARROW"), GetGLUT_CURSOR_RIGHT_ARROW);
#endif

#ifdef CURSOR_LEFT_ARROW
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_LEFT_ARROW"), GetGLUT_CURSOR_LEFT_ARROW);
#endif

#ifdef CURSOR_INFO
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_INFO"), GetGLUT_CURSOR_INFO);
#endif

#ifdef CURSOR_DESTROY
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_DESTROY"), GetGLUT_CURSOR_DESTROY);
#endif

#ifdef CURSOR_HELP
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_HELP"), GetGLUT_CURSOR_HELP);
#endif

#ifdef CURSOR_CYCLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_CYCLE"), GetGLUT_CURSOR_CYCLE);
#endif

#ifdef CURSOR_SPRAY
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_SPRAY"), GetGLUT_CURSOR_SPRAY);
#endif

#ifdef CURSOR_WAIT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_WAIT"), GetGLUT_CURSOR_WAIT);
#endif

#ifdef CURSOR_TEXT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_TEXT"), GetGLUT_CURSOR_TEXT);
#endif

#ifdef CURSOR_CROSSHAIR
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_CROSSHAIR"), GetGLUT_CURSOR_CROSSHAIR);
#endif

#ifdef CURSOR_UP_DOWN
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_UP_DOWN"), GetGLUT_CURSOR_UP_DOWN);
#endif

#ifdef CURSOR_LEFT_RIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_LEFT_RIGHT"), GetGLUT_CURSOR_LEFT_RIGHT);
#endif

#ifdef CURSOR_TOP_SIDE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_TOP_SIDE"), GetGLUT_CURSOR_TOP_SIDE);
#endif

#ifdef CURSOR_BOTTOM_SIDE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_BOTTOM_SIDE"), GetGLUT_CURSOR_BOTTOM_SIDE);
#endif

#ifdef CURSOR_LEFT_SIDE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_LEFT_SIDE"), GetGLUT_CURSOR_LEFT_SIDE);
#endif

#ifdef CURSOR_RIGHT_SIDE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_RIGHT_SIDE"), GetGLUT_CURSOR_RIGHT_SIDE);
#endif

#ifdef CURSOR_TOP_LEFT_CORNER
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_TOP_LEFT_CORNER"), GetGLUT_CURSOR_TOP_LEFT_CORNER);
#endif

#ifdef CURSOR_TOP_RIGHT_CORNER
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_TOP_RIGHT_CORNER"), GetGLUT_CURSOR_TOP_RIGHT_CORNER);
#endif

#ifdef CURSOR_BOTTOM_RIGHT_CORNER
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_BOTTOM_RIGHT_CORNER"), GetGLUT_CURSOR_BOTTOM_RIGHT_CORNER);
#endif

#ifdef CURSOR_BOTTOM_LEFT_CORNER
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_BOTTOM_LEFT_CORNER"), GetGLUT_CURSOR_BOTTOM_LEFT_CORNER);
#endif

#ifdef CURSOR_INHERIT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_INHERIT"), GetGLUT_CURSOR_INHERIT);
#endif

#ifdef CURSOR_NONE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_NONE"), GetGLUT_CURSOR_NONE);
#endif

#ifdef CURSOR_FULL_CROSSHAIR
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CURSOR_FULL_CROSSHAIR"), GetGLUT_CURSOR_FULL_CROSSHAIR);
#endif

#ifdef KEY_REPEAT_OFF
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_REPEAT_OFF"), GetGLUT_KEY_REPEAT_OFF);
#endif

#ifdef KEY_REPEAT_ON
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_REPEAT_ON"), GetGLUT_KEY_REPEAT_ON);
#endif

#ifdef KEY_REPEAT_DEFAULT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KEY_REPEAT_DEFAULT"), GetGLUT_KEY_REPEAT_DEFAULT);
#endif

#ifdef JOYSTICK_BUTTON_A
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_BUTTON_A"), GetGLUT_JOYSTICK_BUTTON_A);
#endif

#ifdef JOYSTICK_BUTTON_B
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_BUTTON_B"), GetGLUT_JOYSTICK_BUTTON_B);
#endif

#ifdef JOYSTICK_BUTTON_C
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_BUTTON_C"), GetGLUT_JOYSTICK_BUTTON_C);
#endif

#ifdef JOYSTICK_BUTTON_D
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JOYSTICK_BUTTON_D"), GetGLUT_JOYSTICK_BUTTON_D);
#endif

#ifdef GAME_MODE_ACTIVE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_ACTIVE"), GetGLUT_GAME_MODE_ACTIVE);
#endif

#ifdef GAME_MODE_POSSIBLE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_POSSIBLE"), GetGLUT_GAME_MODE_POSSIBLE);
#endif

#ifdef GAME_MODE_WIDTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_WIDTH"), GetGLUT_GAME_MODE_WIDTH);
#endif

#ifdef GAME_MODE_HEIGHT
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_HEIGHT"), GetGLUT_GAME_MODE_HEIGHT);
#endif

#ifdef GAME_MODE_PIXEL_DEPTH
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_PIXEL_DEPTH"), GetGLUT_GAME_MODE_PIXEL_DEPTH);
#endif

#ifdef GAME_MODE_REFRESH_RATE
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_REFRESH_RATE"), GetGLUT_GAME_MODE_REFRESH_RATE);
#endif

#ifdef GAME_MODE_DISPLAY_CHANGED
     Glut->SetAccessor(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GAME_MODE_DISPLAY_CHANGED"), GetGLUT_GAME_MODE_DISPLAY_CHANGED);
#endif
#ifdef Init
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Init"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTInitCallback));
#endif

#ifdef InitDisplayMode
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "InitDisplayMode"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTInitDisplayModeCallback));
#endif

#ifdef InitDisplayString
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "InitDisplayString"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTInitDisplayStringCallback));
#endif

#ifdef InitWindowPosition
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "InitWindowPosition"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTInitWindowPositionCallback));
#endif

#ifdef InitWindowSize
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "InitWindowSize"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTInitWindowSizeCallback));
#endif

#ifdef MainLoop
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MainLoop"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTMainLoopCallback));
#endif

#ifdef CreateWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTCreateWindowCallback));
#endif

#ifdef CreateSubWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateSubWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTCreateSubWindowCallback));
#endif

#ifdef DestroyWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DestroyWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTDestroyWindowCallback));
#endif

#ifdef PostRedisplay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PostRedisplay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPostRedisplayCallback));
#endif

#ifdef PostWindowRedisplay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PostWindowRedisplay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPostWindowRedisplayCallback));
#endif

#ifdef SwapBuffers
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SwapBuffers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSwapBuffersCallback));
#endif

#ifdef GetWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGetWindowCallback));
#endif

#ifdef SetWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetWindowCallback));
#endif

#ifdef SetWindowTitle
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetWindowTitle"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetWindowTitleCallback));
#endif

#ifdef SetIconTitle
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetIconTitle"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetIconTitleCallback));
#endif

#ifdef PositionWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PositionWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPositionWindowCallback));
#endif

#ifdef ReshapeWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ReshapeWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTReshapeWindowCallback));
#endif

#ifdef PopWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PopWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPopWindowCallback));
#endif

#ifdef PushWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PushWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPushWindowCallback));
#endif

#ifdef IconifyWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IconifyWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTIconifyWindowCallback));
#endif

#ifdef ShowWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ShowWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTShowWindowCallback));
#endif

#ifdef HideWindow
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HideWindow"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTHideWindowCallback));
#endif

#ifdef FullScreen
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "FullScreen"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTFullScreenCallback));
#endif

#ifdef SetCursor
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetCursor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetCursorCallback));
#endif

#ifdef WarpPointer
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WarpPointer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWarpPointerCallback));
#endif

#ifdef WMCloseFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WMCloseFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWMCloseFuncCallback));
#endif

#ifdef CheckLoop
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CheckLoop"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTCheckLoopCallback));
#endif

#ifdef EstablishOverlay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EstablishOverlay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTEstablishOverlayCallback));
#endif

#ifdef RemoveOverlay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RemoveOverlay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTRemoveOverlayCallback));
#endif

#ifdef UseLayer
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "UseLayer"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTUseLayerCallback));
#endif

#ifdef PostOverlayRedisplay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PostOverlayRedisplay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPostOverlayRedisplayCallback));
#endif

#ifdef PostWindowOverlayRedisplay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PostWindowOverlayRedisplay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPostWindowOverlayRedisplayCallback));
#endif

#ifdef ShowOverlay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ShowOverlay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTShowOverlayCallback));
#endif

#ifdef HideOverlay
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "HideOverlay"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTHideOverlayCallback));
#endif

#ifdef CreateMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CreateMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTCreateMenuCallback));
#endif

#ifdef DestroyMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DestroyMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTDestroyMenuCallback));
#endif

#ifdef GetMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGetMenuCallback));
#endif

#ifdef SetMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetMenuCallback));
#endif

#ifdef AddMenuEntry
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AddMenuEntry"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTAddMenuEntryCallback));
#endif

#ifdef AddSubMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AddSubMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTAddSubMenuCallback));
#endif

#ifdef ChangeToMenuEntry
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ChangeToMenuEntry"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTChangeToMenuEntryCallback));
#endif

#ifdef ChangeToSubMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ChangeToSubMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTChangeToSubMenuCallback));
#endif

#ifdef RemoveMenuItem
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "RemoveMenuItem"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTRemoveMenuItemCallback));
#endif

#ifdef AttachMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "AttachMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTAttachMenuCallback));
#endif

#ifdef DetachMenu
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DetachMenu"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTDetachMenuCallback));
#endif

#ifdef DisplayFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DisplayFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTDisplayFuncCallback));
#endif

#ifdef ReshapeFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ReshapeFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTReshapeFuncCallback));
#endif

#ifdef KeyboardFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KeyboardFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTKeyboardFuncCallback));
#endif

#ifdef MouseFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MouseFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTMouseFuncCallback));
#endif

#ifdef MotionFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MotionFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTMotionFuncCallback));
#endif

#ifdef PassiveMotionFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "PassiveMotionFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTPassiveMotionFuncCallback));
#endif

#ifdef EntryFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EntryFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTEntryFuncCallback));
#endif

#ifdef VisibilityFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VisibilityFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTVisibilityFuncCallback));
#endif

#ifdef IdleFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IdleFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTIdleFuncCallback));
#endif

#ifdef TimerFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TimerFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTTimerFuncCallback));
#endif

#ifdef MenuStateFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MenuStateFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTMenuStateFuncCallback));
#endif

#ifdef SpecialFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SpecialFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSpecialFuncCallback));
#endif

#ifdef SpaceballMotionFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SpaceballMotionFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSpaceballMotionFuncCallback));
#endif

#ifdef SpaceballRotateFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SpaceballRotateFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSpaceballRotateFuncCallback));
#endif

#ifdef SpaceballButtonFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SpaceballButtonFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSpaceballButtonFuncCallback));
#endif

#ifdef ButtonBoxFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ButtonBoxFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTButtonBoxFuncCallback));
#endif

#ifdef DialsFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DialsFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTDialsFuncCallback));
#endif

#ifdef TabletMotionFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TabletMotionFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTTabletMotionFuncCallback));
#endif

#ifdef TabletButtonFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "TabletButtonFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTTabletButtonFuncCallback));
#endif

#ifdef MenuStatusFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "MenuStatusFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTMenuStatusFuncCallback));
#endif

#ifdef OverlayDisplayFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "OverlayDisplayFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTOverlayDisplayFuncCallback));
#endif

#ifdef WindowStatusFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WindowStatusFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWindowStatusFuncCallback));
#endif

#ifdef KeyboardUpFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "KeyboardUpFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTKeyboardUpFuncCallback));
#endif

#ifdef SpecialUpFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SpecialUpFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSpecialUpFuncCallback));
#endif

#ifdef JoystickFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "JoystickFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTJoystickFuncCallback));
#endif

#ifdef SetColor
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetColor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetColorCallback));
#endif

#ifdef GetColor
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetColor"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGetColorCallback));
#endif

#ifdef CopyColormap
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "CopyColormap"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTCopyColormapCallback));
#endif

#ifdef Get
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "Get"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGetCallback));
#endif

#ifdef DeviceGet
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "DeviceGet"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTDeviceGetCallback));
#endif

#ifdef ExtensionSupported
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ExtensionSupported"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTExtensionSupportedCallback));
#endif

#ifdef GetModifiers
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GetModifiers"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGetModifiersCallback));
#endif

#ifdef LayerGet
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LayerGet"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTLayerGetCallback));
#endif

#ifdef BitmapCharacter
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BitmapCharacter"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTBitmapCharacterCallback));
#endif

#ifdef BitmapWidth
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BitmapWidth"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTBitmapWidthCallback));
#endif

#ifdef StrokeCharacter
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StrokeCharacter"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTStrokeCharacterCallback));
#endif

#ifdef StrokeWidth
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StrokeWidth"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTStrokeWidthCallback));
#endif

#ifdef BitmapLength
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "BitmapLength"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTBitmapLengthCallback));
#endif

#ifdef StrokeLength
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StrokeLength"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTStrokeLengthCallback));
#endif

#ifdef WireSphere
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireSphere"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireSphereCallback));
#endif

#ifdef SolidSphere
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidSphere"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidSphereCallback));
#endif

#ifdef WireCone
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireCone"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireConeCallback));
#endif

#ifdef SolidCone
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidCone"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidConeCallback));
#endif

#ifdef WireCube
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireCube"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireCubeCallback));
#endif

#ifdef SolidCube
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidCube"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidCubeCallback));
#endif

#ifdef WireTorus
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireTorus"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireTorusCallback));
#endif

#ifdef SolidTorus
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidTorus"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidTorusCallback));
#endif

#ifdef WireDodecahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireDodecahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireDodecahedronCallback));
#endif

#ifdef SolidDodecahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidDodecahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidDodecahedronCallback));
#endif

#ifdef WireTeapot
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireTeapot"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireTeapotCallback));
#endif

#ifdef SolidTeapot
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidTeapot"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidTeapotCallback));
#endif

#ifdef WireOctahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireOctahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireOctahedronCallback));
#endif

#ifdef SolidOctahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidOctahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidOctahedronCallback));
#endif

#ifdef WireTetrahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireTetrahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireTetrahedronCallback));
#endif

#ifdef SolidTetrahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidTetrahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidTetrahedronCallback));
#endif

#ifdef WireIcosahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "WireIcosahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTWireIcosahedronCallback));
#endif

#ifdef SolidIcosahedron
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SolidIcosahedron"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSolidIcosahedronCallback));
#endif

#ifdef VideoResizeGet
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VideoResizeGet"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTVideoResizeGetCallback));
#endif

#ifdef SetupVideoResizing
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetupVideoResizing"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetupVideoResizingCallback));
#endif

#ifdef StopVideoResizing
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "StopVideoResizing"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTStopVideoResizingCallback));
#endif

#ifdef VideoResize
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VideoResize"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTVideoResizeCallback));
#endif

#ifdef VideoPan
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "VideoPan"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTVideoPanCallback));
#endif

#ifdef ReportErrors
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ReportErrors"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTReportErrorsCallback));
#endif

#ifdef IgnoreKeyRepeat
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "IgnoreKeyRepeat"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTIgnoreKeyRepeatCallback));
#endif

#ifdef SetKeyRepeat
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "SetKeyRepeat"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTSetKeyRepeatCallback));
#endif

#ifdef ForceJoystickFunc
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "ForceJoystickFunc"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTForceJoystickFuncCallback));
#endif

#ifdef GameModeString
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GameModeString"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGameModeStringCallback));
#endif

#ifdef EnterGameMode
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "EnterGameMode"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTEnterGameModeCallback));
#endif

#ifdef LeaveGameMode
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "LeaveGameMode"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTLeaveGameModeCallback));
#endif

#ifdef GameModeGet
     Glut->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "GameModeGet"), FunctionTemplate::New(v8::Isolate::GetCurrent(), GLUTGameModeGetCallback));
#endif


      // Again, return the result through the current handle scope.
      return Glut;
}    


<|start_filename|>src/lib/GL/GL.cc<|end_filename|>
/*
 *	OpenGL module for TeaJS
 *
 *	Based on <NAME>'s V8-GL project
 *	(http://github.com/philogb/v8-gl/tree/master#readme)
 *
 *	Initial version: 2009-10-07, <NAME>
 */

#include <stdlib.h>
#include <map>
#include <stdio.h>
#ifndef __APPLE__
#include <stropts.h>
#endif
#include <string.h>
#include <sstream>

#include <v8.h>
#include "macros.h"
#include "gc.h"
#include "GL.hpp"

namespace GLv8 {

  JS_METHOD(_gl) {
    Handle<ObjectTemplate> obj( GlFactory::createGl() );
    Handle<Value> ret(obj->NewInstance());
    args.GetReturnValue().Set(ret);
  }

  JS_METHOD(_glu) {
    //Handle<ObjectTemplate> obj( GluFactory::createGlu() );
    //Handle<Value> ret(obj->NewInstance());
    args.GetReturnValue().Set(args.This());
  }

  JS_METHOD(_gles) {
    Handle<ObjectTemplate> obj( GlesFactory::createGles() );
    Handle<Value> ret(obj->NewInstance());
    args.GetReturnValue().Set(ret);
  }

  JS_METHOD(_glut) {
    int pargc = 0;
    char** argv = NULL;
    v8::Handle<v8::Object> sys = JS_GLOBAL->Get(JS_STR("system"))->ToObject();
    v8::Handle<v8::Value> targs = sys->Get(JS_STR("args"));
    v8::Handle<v8::Array> arr( v8::Handle<v8::Array>::Cast(targs) );
    pargc = arr->Length();
    argv = new char*[(pargc+1)];
    std::string ctmp( "test" );
    argv[0] = strdup(ctmp.c_str());
    for (int i = 0; i < pargc; i++) {
      std::string tmp( *String::Utf8Value( arr->Get(JS_INT(i))->ToString() ) );
      argv[(i+1)] = strdup(tmp.c_str());
      fprintf(stdout,"argv[%d] : %s\n",i,argv[i]);
    }
    Handle<ObjectTemplate> object_template;
    object_template = GlutFactory::createGlut(&pargc, (char **)argv);
    Handle<Value> ret(object_template->NewInstance());
    args.This()->Set(JS_STR("obj"),ret);
    args.GetReturnValue().Set(args.This());
  }

}

SHARED_INIT() {

// void jsGL() {

  using namespace GLv8;

  // Create a handle scope to hold temporary references.
  HandleScope handle_scope(JS_ISOLATE);

  // Create a template for the global object where we set the
  // built-in global functions.
  Handle<Object> global = JS_GLOBAL;
  
  int * pargc = NULL;
  pargc = new int[1];
  char** argv = NULL;
  v8::Handle<v8::Object> sys = JS_GLOBAL->Get(JS_STR("system"))->ToObject();
  v8::Handle<v8::Value> targs = sys->Get(JS_STR("args"));
  v8::Handle<v8::Array> arr( v8::Handle<v8::Array>::Cast(targs) );

  *pargc = arr->Length();
  argv = new char*[(*pargc+1)];
  std::string ctmp( "./tea" );
  argv[0] = strdup(ctmp.c_str());
  for (int i = 0; i < *pargc; i++) {
    std::string tmp( *String::Utf8Value( arr->Get(JS_INT(i))->ToString() ) );
    argv[(i+1)] = strdup(tmp.c_str());
  }

  // Each processor gets its own context so different processors
  // don't affect each other.
  //
  Handle<ObjectTemplate> Gl_t = GlFactory::createGl();
  Handle<ObjectTemplate> Gles_t = GlesFactory::createGles();
  Handle<ObjectTemplate> Glu_t = createGlu();
  Handle<ObjectTemplate> Glut_t = GlutFactory::createGlut(pargc, argv);

  Handle<FunctionTemplate> ftGl = FunctionTemplate::New(JS_ISOLATE, _gl);
  Handle<FunctionTemplate> ftGles = FunctionTemplate::New(JS_ISOLATE, _gles);
  Handle<FunctionTemplate> ftGlu = FunctionTemplate::New(JS_ISOLATE, _glu);
  Handle<FunctionTemplate> ftGlut = FunctionTemplate::New(JS_ISOLATE, _glut);
  ftGl->SetClassName(JS_STR("Gl"));
  ftGles->SetClassName(JS_STR("Gles"));
  ftGlu->SetClassName(JS_STR("Glu"));
  ftGlut->SetClassName(JS_STR("Glut"));

  Handle<ObjectTemplate> otGl = ftGl->InstanceTemplate();
  Handle<ObjectTemplate> otGles = ftGles->InstanceTemplate();
  Handle<ObjectTemplate> otGlu = ftGlu->InstanceTemplate();
  Handle<ObjectTemplate> otGlut = ftGlut->InstanceTemplate();

  Handle<Object> Gl = Gl_t->NewInstance();
  Handle<Object> Glu = Glu_t->NewInstance();
  Handle<Object> Gles = Gles_t->NewInstance();
  Handle<Object> Glut = Glut_t->NewInstance();

  exports->Set(JS_STR("Gl"), Gl);
  exports->Set(JS_STR("Gles"), Gles);
  global->Set(JS_STR("Glu"), ftGlu->GetFunction());
  global->Set(JS_STR("Glut"), ftGlut->GetFunction());

  global->Set(JS_STR("Gl"), Gl);
  global->Set(JS_STR("Glu"), Glu);
  global->Set(JS_STR("Gles"), Gles);
  global->Set(JS_STR("Glut"), Glut);

  Handle<Context> context ( JS_ISOLATE->GetCurrentContext() );

  GlutFactory::glut_persistent_context.Reset(JS_ISOLATE, context);
  GlesFactory::gles_persistent_context.Reset(JS_ISOLATE, context);

  // Enter the new context so all the following operations take place
  // within it.
  Context::Scope context_scope(context);

  //Append *this* as Gl static variable so we can do dot-this-dot-that stuff
  GlFactory::self_.Reset(JS_ISOLATE, Gl_t->NewInstance());
  GlesFactory::self_.Reset(JS_ISOLATE, Gles_t->NewInstance());

  //Set the root_path for opening shader files with
  //relative paths
  //take path from executable
  char* pch = strrchr(argv[0], '/');
  int last_index = pch - argv[0] +1;
  char* tmp_exec_path = new char[last_index +1];
  strncpy(tmp_exec_path, argv[0], last_index);
  tmp_exec_path[last_index] = '\0';

  //take relative path from javascript file
  char* p1ch = strrchr(argv[1], '/');
  int last_index1 = p1ch - argv[1] +1;
  char* tmp_js_path = new char[last_index1 +1];
  strncpy(tmp_js_path, argv[1], last_index1);
  tmp_js_path[last_index1] = '\0';

  GlesFactory::root_path = new char[last_index + last_index1 +1];
  strcpy(GlesFactory::root_path, tmp_exec_path);
  strcat(GlesFactory::root_path, tmp_js_path);

  //GlesFactory::root_path = new char[3];
  //strcpy(GlesFactory::root_path,"./");

  delete[] tmp_exec_path;
  delete[] tmp_js_path;

  //exports->Set(JS_STR("GL"), Gl->GetFunction());
  //exports->Set(JS_STR("Glut"), ftGlut->GetFunction());

  //exports->Set(JS_STR("Gl"), ftGl->GetFunction());
  //exports->Set(JS_STR("Gles"), ftGles->GetFunction());
  //exports->Set(JS_STR("Glut"), ftGlut->GetFunction());
  //exports->Set(JS_STR("Glut"), Glut);
}

//jsGL();


<|start_filename|>src/lib/GL/glbindings/glbind.h<|end_filename|>
/*
 * glbind.h
 *
 *  Created on: Jun 15, 2009
 *      Author: nicolas
 */

#ifndef GLBIND_H_
#define GLBIND_H_

#include <v8.h>



class GlFactory {
public:
	static v8::Handle<v8::ObjectTemplate> createGl(void);

	static v8::Persistent<v8::Object> self_;
};

#endif /* GLBIND_H_ */


<|start_filename|>src/lib/GL/glesbindings/glescustom.cpp<|end_filename|>
// glGenBuffers uses an output parameter to return an array of ints.
void GLESglGenBuffersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLsizei num_buffers = args[0]->Int32Value();

  GLuint* buffers = new GLuint[num_buffers];
  glGenBuffers(num_buffers, buffers);

  // TODO(deanm): There should be a way to initialize the array faster.
  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_buffers);
  for (int i = 0; i < num_buffers; ++i) {
    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), buffers[i]));
  }

  delete[] buffers;

  args.GetReturnValue().Set(res);
}


void GLESglGenRenderbuffersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
      if (args.Length() != 1) {
        args.GetReturnValue().SetUndefined();
        return;
      }

      HandleScope handle_scope(v8::Isolate::GetCurrent());
	  GLsizei num_buffers = args[0]->Int32Value();

	  GLuint* buffers = new GLuint[num_buffers];
	  glGenRenderbuffers(num_buffers, buffers);

	  // TODO(deanm): There should be a way to initialize the array faster.
	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_buffers);
	  for (int i = 0; i < num_buffers; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), buffers[i]));
	  }

	  delete[] buffers;

	  args.GetReturnValue().Set(res);
}


void GLESglGenFramebuffersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
      if (args.Length() != 1) {
        args.GetReturnValue().SetUndefined();
        return;
      }

	  HandleScope handle_scope(v8::Isolate::GetCurrent());
	  GLsizei num_buffers = args[0]->Int32Value();

	  GLuint* buffers = new GLuint[num_buffers];
	  glGenFramebuffers(num_buffers, buffers);

	  // TODO(deanm): There should be a way to initialize the array faster.
	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_buffers);
	  for (int i = 0; i < num_buffers; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), buffers[i]));
	  }

	  delete[] buffers;

	  args.GetReturnValue().Set(res);
}

void GLESglGenTexturesCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLsizei num_textures = args[0]->Int32Value();

  GLuint* textures = new GLuint[num_textures];
  glGenTextures(num_textures, textures);

  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), num_textures);
  for (int i = 0; i < num_textures; ++i) {
    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), textures[i]));
  }

  delete[] textures;

  args.GetReturnValue().Set(res);
}


// glGetShaderiv uses an output parameter to return an int.
void GLESglGetShaderivCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned int arg0 = args[0]->Uint32Value();
  int arg1 = args[1]->IntegerValue();

  int out;
  glGetShaderiv((GLuint) arg0, (GLenum) arg1, (GLint*)&out);
  v8::Local<v8::Value> val = v8::Integer::New(v8::Isolate::GetCurrent(), out);
  args.GetReturnValue().Set(val);
}


// We expect to be called with a shader id and a single string.
void GLESglShaderSourceCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLuint shader_id = args[0]->Uint32Value();
  // GLSL source is defined as an ASCII subset.
  v8::String::Utf8Value code_ascii(args[1]);
  if (!*code_ascii){
    args.GetReturnValue().SetUndefined();
    return;
  }

  const char* code_str = *code_ascii;
  GLsizei code_len = code_ascii.length();
  glShaderSource(shader_id, 1, &code_str, &code_len);

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}


void GLESglVertexAttribPointerCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());

  unsigned int index = args[0]->Uint32Value();
  unsigned int size = args[1]->Uint32Value();
  unsigned int type = args[2]->Uint32Value();
  unsigned int normalized = args[3]->Uint32Value();
  int stride = args[4]->IntegerValue();
  void* ans;

  if(args[5]->IsArray()) {
	  Handle<Array> data = Handle<Array>::Cast(args[5]);
	  //I guess most of these types could be thrown away
	  switch(type) {
//		  case GL_BYTE:
//			  GLbyte* arg1 = new  GLbyte[data->Length()];
//			  for (unsigned j = 0; j < data->Length(); j++) {
//			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
//			      arg1[j] = (GLbyte)arg->IntegerValue();
//			  }
//			  ans = (void *)arg1;
//			  break;
//
//		  case GL_UNSIGNED_BYTE:
//			  GLubyte* arg1 = new  GLubyte[data->Length()];
//			  for (unsigned j = 0; j < data->Length(); j++) {
//			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
//			      arg1[j] = (GLubyte)arg->Uint32Value();
//			  }
//			  ans = (void *)arg1;
//			  break;

		  case GL_SHORT:
		  {
			  GLshort* arg1 = new  GLshort[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLshort)arg->IntegerValue();
			  }
			  ans = (void *)arg1;
		  }
		  break;
		  case GL_UNSIGNED_SHORT:
		  {
			  GLushort* arg1 = new  GLushort[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLushort)arg->Uint32Value();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  case GL_FLOAT:
		  {
			  GLfloat* arg1 = new  GLfloat[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLfloat)arg->NumberValue();
			  }
			  ans = (void *)arg1;
		  }
		  break;

//		  case GL_FIXED:
//		  {
//			  GLfixed* arg1 = new  GLfixed[data->Length()];
//			  for (unsigned j = 0; j < data->Length(); j++) {
//			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
//			      arg1[j] = (GLfixed)arg->IntegerValue();
//			  }
//			  ans = (void *)arg1;
//		  }
//		  break;

		  default:
            args.GetReturnValue().SetUndefined();
            return;
	  }
  } else {
	  ans = (void *)args[5]->IntegerValue();
  }

  glVertexAttribPointer((GLuint)index,
		  (GLint)size,
		  (GLenum)type,
		  (GLboolean)normalized,
		  (GLsizei)stride,
		  (const void*)ans);

  //should I delete[] ans?

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}

void GLESglDrawElementsCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned int mode  = args[0]->Uint32Value();
  int count = args[1]->IntegerValue();
  unsigned int type  = args[2]->Uint32Value();
  void* ans;

  if(args[3]->IsArray()) {
	  Handle<Array> data = Handle<Array>::Cast(args[3]);
	  switch(type) {
		  case GL_UNSIGNED_SHORT:
		  {
			  GLushort* arg1 = new  GLushort[data->Length()];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLushort)arg->Uint32Value();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  default:
            args.GetReturnValue().SetUndefined();
            return;
	  }
  } else {
	  ans = (void *)args[3]->IntegerValue();
  }

  glDrawElements((GLenum)mode,
		  (GLsizei)count,
		  (GLenum)type,
		  (const GLvoid*)ans);

  //should I delete[] ans?

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}

//Accepts GL_UNSIGNED_SHORT and GL_FLOAT as types
//TODO(nico): deal with interleaved data
void GLESglBufferDataCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 4 || !args[1]->IsArray()) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  unsigned int target  = args[0]->Uint32Value();
  unsigned int type = args[2]->Uint32Value();
  unsigned int usage  = args[3]->Uint32Value();
  Handle<Array> data = Handle<Array>::Cast(args[1]);
  unsigned int len = data->Length();

  if (type == GL_FLOAT) {
    GLfloat* arg1 = new GLfloat[len];
    for (unsigned j = 0; j < len; j++) {
        Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
        arg1[j] = (GLfloat)arg->NumberValue();
    }
    glBufferData((GLenum)target,
                 (GLsizeiptr)(len * sizeof(*arg1)),
                 (const void*)arg1,
                 (GLenum)usage);
    delete[] arg1;
  } else if (type == GL_UNSIGNED_SHORT) {
    GLushort* arg1 = new GLushort[len];
    for (unsigned j = 0; j < len; j++) {
      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
      arg1[j] = (GLushort)arg->Uint32Value();
    }
    glBufferData((GLenum)target,
                 (GLsizeiptr)(len * sizeof(*arg1)),
                 (const void*)arg1,
                 (GLenum)usage);
    delete[] arg1;
  }

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}


//Accepts GL_UNSIGNED_SHORT and GL_FLOAT as types
//TODO(nico): deal with interleaved data
void GLESglBufferSubDataCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 4) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned int target  = args[0]->Uint32Value();
  unsigned int offset = args[1]->Uint32Value();
  unsigned int type  = args[3]->Uint32Value();

  void* ans;
  if(args[2]->IsArray()) {
	  Handle<Array> data = Handle<Array>::Cast(args[2]);
	  unsigned int len = data->Length();

	  switch(type) {
		  case GL_FLOAT:
		  {
			  GLfloat* arg1 = new  GLfloat[len];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLfloat)arg->NumberValue();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  case GL_UNSIGNED_SHORT:
		  {
			  GLushort* arg1 = new  GLushort[len];
			  for (unsigned j = 0; j < data->Length(); j++) {
			      Handle<Value> arg(data->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
			      arg1[j] = (GLushort)arg->Uint32Value();
			  }
			  ans = (void *)arg1;
		  }
		  break;

		  default:
            args.GetReturnValue().SetUndefined();
            return;

	  }

	  glBufferSubData((GLenum)target,
			  (GLintptr)offset,
			  (GLsizeiptr)len,
			  (const void*)ans);

	  //should I delete[] ans?
  }

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}

void GLESglReadPixelsCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 6) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  int x = args[0]->IntegerValue();
  int y = args[1]->IntegerValue();
  unsigned width = args[2]->Uint32Value();
  unsigned height = args[3]->Uint32Value();
  unsigned format = args[4]->Uint32Value();
  unsigned type = args[5]->Uint32Value();

  //TODO(nico): should support other formats also
  if(format == GL_RGB && type == GL_UNSIGNED_BYTE) {
	  unsigned len = width * height * 3;
	  GLubyte *ans = new GLubyte[len];
	  glReadPixels((GLint)x,
			  (GLint)y,
			  (GLsizei)width,
			  (GLsizei)height,
			  (GLenum)format,
			  (GLenum)type, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), len);
	  for (unsigned i = 0; i < len; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;
	  args.GetReturnValue().Set(res);
  }

  args.GetReturnValue().SetUndefined();
}

void GLESglGetActiveAttribCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());

  unsigned program = args[0]->Uint32Value();
  unsigned index = args[1]->Uint32Value();

  char name[256];
  int length = 0;
  int size = 0;
  unsigned type = 0;

  glGetActiveAttrib((GLuint)program,
		  (GLuint)index,
		  (GLsizei)sizeof(name),
		  (GLsizei*)&length,
		  (GLint*)&size,
		  (GLenum*)&type,
		  (GLchar*)name);

  Handle<Object> ans = Object::New(v8::Isolate::GetCurrent());
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "type"), Uint32::New(v8::Isolate::GetCurrent(), type));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "size"), Integer::New(v8::Isolate::GetCurrent(), size));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "name"), String::NewFromUtf8(v8::Isolate::GetCurrent(), name, v8::String::kNormalString, length));
  args.GetReturnValue().Set(ans);
}

void GLESglGetActiveUniformCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());

  unsigned program = args[0]->Uint32Value();
  unsigned index = args[1]->Uint32Value();

  char name[256];
  int length = 0;
  int size = 0;
  unsigned type = 0;

  glGetActiveUniform((GLuint)program,
		  (GLuint)index,
		  (GLsizei)sizeof(name),
		  (GLsizei*)&length,
		  (GLint*)&size,
		  (GLenum*)&type,
		  (GLchar*)name);

  // Create a template for the answer object that'll hold
  // type/size/name as properties
  Handle<Object> ans = Object::New(v8::Isolate::GetCurrent());
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "type"), Uint32::New(v8::Isolate::GetCurrent(), type));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "size"), Integer::New(v8::Isolate::GetCurrent(), size));
  ans->Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), "name"), String::NewFromUtf8(v8::Isolate::GetCurrent(), name));
  args.GetReturnValue().Set(ans);
}

void GLESglGetAttachedShadersCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
      if (args.Length() != 1) {
        args.GetReturnValue().SetUndefined();
        return;
      }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  unsigned program = args[0]->Uint32Value();

  int maxcount = 500;
  int count = 0;
  unsigned* shaders = new unsigned[maxcount];

  glGetAttachedShaders((GLuint)program,
		  (GLsizei)maxcount,
		  (GLsizei*)&count,
		  (GLuint*)shaders);

  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), count);
  for (int i = 0; i < count; ++i) {
    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Uint32::New(v8::Isolate::GetCurrent(), shaders[i]));
  }

  delete[] shaders;

  args.GetReturnValue().Set(res);
}

void GLESglGetBufferParameterivCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->IntegerValue();
  unsigned pname = args[1]->IntegerValue();
  int ans = 0;
  //TODO(nico): does this return an array or just GLint?
  glGetBufferParameteriv((GLenum)target,
		  (GLenum)pname,
		  (GLint*)&ans);

  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
}

//GetBooleanv, GetIntegerv, GetString, GetFloatv, GetDoublev should map here.
void GLESglGetParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() < 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned pname = args[0]->Uint32Value();


  switch(pname) {
  //return 1 int value
  case GL_ALPHA_TEST_FUNC:
  case GL_ACCUM_ALPHA_BITS:
  case GL_ACCUM_BLUE_BITS:
  case GL_ACCUM_GREEN_BITS:
  case GL_ACCUM_RED_BITS:
  case GL_ALPHA_BITS:
  case GL_ATTRIB_STACK_DEPTH:
  case GL_AUX_BUFFERS:
  case GL_BLEND_DST:
  case GL_BLEND_EQUATION_EXT:
  case GL_BLEND_SRC:
  case GL_BLUE_BITS:
  case GL_SUBPIXEL_BITS:
  case GL_CLIENT_ATTRIB_STACK_DEPTH:
  case GL_COLOR_ARRAY_SIZE:
  case GL_COLOR_ARRAY_STRIDE:
  case GL_COLOR_ARRAY_TYPE:
  case GL_COLOR_MATERIAL_FACE:
  case GL_COLOR_MATERIAL_PARAMETER:
  case GL_CULL_FACE_MODE:
  case GL_DEPTH_BITS:
  case GL_DEPTH_FUNC:
  case GL_DRAW_BUFFER:
  case GL_EDGE_FLAG_ARRAY_STRIDE:
  case GL_FOG_HINT:
  case GL_FOG_MODE:
  case GL_FRONT_FACE:
  case GL_GREEN_BITS:
  case GL_INDEX_ARRAY_STRIDE:
  case GL_INDEX_ARRAY_TYPE:
  case GL_INDEX_BITS:
  case GL_INDEX_WRITEMASK:
  case GL_LINE_SMOOTH_HINT:
  case GL_LINE_STIPPLE_PATTERN:
  case GL_LINE_STIPPLE_REPEAT:
  case GL_LIST_BASE:
  case GL_LIST_INDEX: //name of the display list
  case GL_LIST_MODE:
  case GL_LOGIC_OP_MODE:
  case GL_MAP1_GRID_SEGMENTS:
  case GL_MATRIX_MODE:
  case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
  case GL_MAX_ATTRIB_STACK_DEPTH:
  case GL_MAX_CLIP_PLANES:
  case GL_MAX_EVAL_ORDER:
  case GL_MAX_LIGHTS:
  case GL_MAX_LIST_NESTING:
  case GL_MAX_MODELVIEW_STACK_DEPTH:
  case GL_MAX_NAME_STACK_DEPTH:
  case GL_MAX_PIXEL_MAP_TABLE:
  case GL_MAX_PROJECTION_STACK_DEPTH:
  case GL_MAX_TEXTURE_SIZE:
  case GL_MAX_TEXTURE_STACK_DEPTH:
  case GL_MODELVIEW_STACK_DEPTH:
  case GL_NAME_STACK_DEPTH:
  case GL_NORMAL_ARRAY_STRIDE:
  case GL_NORMAL_ARRAY_TYPE:
  case GL_PACK_ALIGNMENT:
  case GL_PACK_ROW_LENGTH:
  case GL_PACK_SKIP_PIXELS:
  case GL_PACK_SKIP_ROWS:
  case GL_PERSPECTIVE_CORRECTION_HINT:
  case GL_PIXEL_MAP_A_TO_A_SIZE:
  case GL_PIXEL_MAP_B_TO_B_SIZE:
  case GL_PIXEL_MAP_G_TO_G_SIZE:
  case GL_PIXEL_MAP_I_TO_A_SIZE:
  case GL_PIXEL_MAP_I_TO_B_SIZE:
  case GL_PIXEL_MAP_I_TO_G_SIZE:
  case GL_PIXEL_MAP_I_TO_I_SIZE:
  case GL_PIXEL_MAP_I_TO_R_SIZE:
  case GL_PIXEL_MAP_R_TO_R_SIZE:
  case GL_PIXEL_MAP_S_TO_S_SIZE:
  case GL_POINT_SMOOTH_HINT:
  case GL_POLYGON_SMOOTH_HINT:
  case GL_PROJECTION_STACK_DEPTH:
  case GL_RED_BITS:
  case GL_RENDER_MODE:
  case GL_SHADE_MODEL:
  case GL_STENCIL_BITS:
  case GL_STENCIL_CLEAR_VALUE:
  case GL_STENCIL_FAIL:
  case GL_STENCIL_FUNC:
  case GL_STENCIL_PASS_DEPTH_FAIL:
  case GL_STENCIL_PASS_DEPTH_PASS:
  case GL_STENCIL_REF:
  case GL_STENCIL_VALUE_MASK:
  case GL_STENCIL_WRITEMASK:
//  case GL_TEXTURE_1D_BINDING:
//  case GL_TEXTURE_2D_BINDING:
  case GL_TEXTURE_COORD_ARRAY_SIZE:
  case GL_TEXTURE_COORD_ARRAY_STRIDE:
  case GL_TEXTURE_COORD_ARRAY_TYPE:
  case GL_TEXTURE_STACK_DEPTH:
  case GL_UNPACK_ALIGNMENT:
  case GL_UNPACK_ROW_LENGTH:
  case GL_UNPACK_SKIP_PIXELS:
  case GL_UNPACK_SKIP_ROWS:
  case GL_VERTEX_ARRAY_SIZE:
  case GL_VERTEX_ARRAY_STRIDE:
  case GL_VERTEX_ARRAY_TYPE:
  {
	  int ans = 0;
	  glGetIntegerv((GLenum)pname, (GLint*)&ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }
  //2 values int
  case GL_LINE_WIDTH_RANGE:
  case GL_MAP2_GRID_SEGMENTS:
  case GL_MAX_VIEWPORT_DIMS:
  case GL_POLYGON_MODE:
  {
	  int* ans = new int[2];
	  glGetIntegerv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 2);
	  for (int i = 0; i < 2; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }
  //4 values int
  case GL_SCISSOR_BOX:
  case GL_VIEWPORT:
  {
	  int* ans = new int[4];
	  glGetIntegerv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //1 value boolean
  case GL_ALPHA_TEST:
  case GL_AUTO_NORMAL:
  case GL_BLEND:
  case GL_DEPTH_TEST:
//  case GL_CLIP_PLANEi:
  case GL_COLOR_ARRAY:
  case GL_COLOR_LOGIC_OP:
  case GL_COLOR_MATERIAL:
  case GL_CULL_FACE:
  case GL_CURRENT_RASTER_POSITION_VALID:
  case GL_DEPTH_WRITEMASK:
  case GL_DITHER:
  case GL_DOUBLEBUFFER:
  case GL_EDGE_FLAG:
  case GL_EDGE_FLAG_ARRAY:
  case GL_FOG:
  case GL_INDEX_ARRAY:
  case GL_INDEX_LOGIC_OP:
  case GL_INDEX_MODE:
//  case GL_LIGHTi:
  case GL_LIGHTING:
  case GL_LIGHT_MODEL_LOCAL_VIEWER:
  case GL_LIGHT_MODEL_TWO_SIDE:
  case GL_LINE_SMOOTH:
  case GL_LINE_STIPPLE:
  case GL_MAP1_COLOR_4:
  case GL_MAP1_INDEX:
  case GL_MAP1_NORMAL:
  case GL_MAP1_TEXTURE_COORD_1:
  case GL_MAP1_TEXTURE_COORD_2:
  case GL_MAP1_TEXTURE_COORD_3:
  case GL_MAP1_TEXTURE_COORD_4:
  case GL_MAP1_VERTEX_3:
  case GL_MAP1_VERTEX_4:
  case GL_MAP2_COLOR_4:
  case GL_MAP2_INDEX:
  case GL_MAP2_NORMAL:
  case GL_MAP2_TEXTURE_COORD_1:
  case GL_MAP2_TEXTURE_COORD_2:
  case GL_MAP2_TEXTURE_COORD_3:
  case GL_MAP2_TEXTURE_COORD_4:
  case GL_MAP2_VERTEX_3:
  case GL_MAP2_VERTEX_4:
  case GL_MAP_COLOR:
  case GL_MAP_STENCIL:
  case GL_NORMAL_ARRAY:
  case GL_NORMALIZE:
  case GL_PACK_LSB_FIRST:
  case GL_PACK_SWAP_BYTES:
  case GL_POINT_SMOOTH:
  case GL_POLYGON_OFFSET_FILL:
  case GL_POLYGON_OFFSET_LINE:
  case GL_POLYGON_OFFSET_POINT:
  case GL_POLYGON_SMOOTH:
  case GL_POLYGON_STIPPLE:
  case GL_READ_BUFFER:
  case GL_RGBA_MODE:
  case GL_SCISSOR_TEST:
  case GL_STENCIL_TEST:
  case GL_STEREO:
  case GL_TEXTURE_1D:
  case GL_TEXTURE_2D:
  case GL_TEXTURE_COORD_ARRAY:
  case GL_TEXTURE_GEN_Q:
  case GL_TEXTURE_GEN_R:
  case GL_TEXTURE_GEN_S:
  case GL_TEXTURE_GEN_T:
  case GL_UNPACK_LSB_FIRST:
  case GL_VERTEX_ARRAY:
  case GL_UNPACK_SWAP_BYTES:
  {
	  GLboolean ans = 0;
	  glGetBooleanv((GLenum)pname, &ans);
	  args.GetReturnValue().Set(Boolean::New(v8::Isolate::GetCurrent(), ans != GL_FALSE));
  }

  //1 value float
  case GL_ALPHA_BIAS:
  case GL_ALPHA_SCALE:
  case GL_BLUE_BIAS:
  case GL_BLUE_SCALE:
  case GL_RED_BIAS:
  case GL_RED_SCALE:
  case GL_GREEN_BIAS:
  case GL_GREEN_SCALE:
  case GL_DEPTH_BIAS:
  case GL_DEPTH_SCALE:
  case GL_ALPHA_TEST_REF:
  case GL_ZOOM_X:
  case GL_ZOOM_Y:
  case GL_CURRENT_INDEX:
  case GL_CURRENT_RASTER_DISTANCE:
  case GL_CURRENT_RASTER_INDEX:
  case GL_DEPTH_CLEAR_VALUE:
  case GL_FOG_DENSITY:
  case GL_FOG_END:
  case GL_FOG_INDEX:
  case GL_FOG_START:
  case GL_INDEX_CLEAR_VALUE:
  case GL_INDEX_OFFSET:
  case GL_INDEX_SHIFT:
  case GL_LINE_WIDTH:
  case GL_LINE_WIDTH_GRANULARITY:
  case GL_POINT_SIZE:
  case GL_POINT_SIZE_GRANULARITY:
  {
	  float ans = 0.0f;
	  glGetFloatv((GLenum)pname, &ans);
	  args.GetReturnValue().Set(Number::New(v8::Isolate::GetCurrent(), ans));
  }

  //4 values float
  case GL_BLEND_COLOR_EXT:
  case GL_ACCUM_CLEAR_VALUE:
  case GL_COLOR_CLEAR_VALUE:
  case GL_CURRENT_COLOR:
  case GL_CURRENT_RASTER_COLOR:
  case GL_CURRENT_RASTER_POSITION:
  case GL_CURRENT_RASTER_TEXTURE_COORDS:
  case GL_CURRENT_TEXTURE_COORDS:
  case GL_FOG_COLOR:
  case GL_LIGHT_MODEL_AMBIENT:
  case GL_MAP2_GRID_DOMAIN:
  case GL_POLYGON_OFFSET_FACTOR:
  case GL_POLYGON_OFFSET_UNITS:
  {
	  float* ans = new float[4];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

   //3 values float
  case GL_CURRENT_NORMAL:
  {
	  float* ans = new float[3];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 3);
	  for (int i = 0; i < 3; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //2 values float
  case GL_DEPTH_RANGE:
  case GL_MAP1_GRID_DOMAIN:
  case GL_POINT_SIZE_RANGE:
  {
	  float* ans = new float[2];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 2);
	  for (int i = 0; i < 2; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //16 values float
  case GL_MODELVIEW_MATRIX:
  case GL_PROJECTION_MATRIX:
  case GL_TEXTURE_MATRIX:
  {
	  float* ans = new float[16];
	  glGetFloatv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 16);
	  for (int i = 0; i < 16; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  //4 values boolean
  case GL_COLOR_WRITEMASK:
  {
	  GLboolean* ans = new GLboolean[4];
	  glGetBooleanv((GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Boolean::New(v8::Isolate::GetCurrent(), ans[i] != GL_FALSE));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }

  }
  args.GetReturnValue().SetUndefined();
}


void GLESglGetProgramivCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned program = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();
  int ans;

  //TODO(nico): I haven't seen any case where this function might return
  //an array.
  glGetProgramiv((GLuint)program, (GLenum)pname, (GLint*) &ans);

  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
}

void GLESglGetProgramInfoLogCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned program = args[0]->Uint32Value();

  //query string length
  int len = 0;
  glGetProgramiv((GLuint)program, GL_INFO_LOG_LENGTH, &len);

  char* log = new char[len];
  glGetProgramInfoLog((GLuint)program, (GLsizei)len, NULL, log);

  args.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), log));
}

void GLESglGetTexParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();

  switch(pname) {
  //1 int
  case GL_TEXTURE_MAG_FILTER:
  case GL_TEXTURE_MIN_FILTER:
  case GL_TEXTURE_WRAP_S:
  case GL_TEXTURE_WRAP_T:
  {
	  int ans = 0;
	  glTexParameteriv((GLenum)target, (GLenum)pname, (GLint*) &ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }
	  //4 floats
  case GL_TEXTURE_BORDER_COLOR:
  {
	  float* ans = new float[4];
	  glTexParameterfv((GLenum)target, (GLenum)pname, (GLfloat*) ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Number::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }
	  //1 float
  case GL_TEXTURE_PRIORITY:
  {
	  float ans = 0;
	  glTexParameterfv((GLenum)target, (GLenum)pname, (GLfloat*) &ans);
	  args.GetReturnValue().Set(Number::New(v8::Isolate::GetCurrent(), ans));
  }
	  //1 boolean
  case GL_TEXTURE_RESIDENT:
  {
	  int ans = 0;
	  glTexParameteriv((GLenum)target, (GLenum)pname, (GLint*) &ans);
	  args.GetReturnValue().Set(Boolean::New(v8::Isolate::GetCurrent(), ans != GL_FALSE));
  }

  }
  args.GetReturnValue().SetUndefined();
}

void GLESglGetVertexAttribCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned index = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();

  switch(pname) {
  //1 int value
  case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
  case GL_VERTEX_ATTRIB_ARRAY_SIZE:
  case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
  case GL_VERTEX_ATTRIB_ARRAY_TYPE:
  {
	  GLint ans = 0;
	  glGetVertexAttribiv((GLuint)index, (GLenum)pname, &ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }

  //1 boolean value
  case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
  case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
  {
	  GLint ans = 0;
	  glGetVertexAttribiv((GLuint)index, (GLenum)pname, &ans);
	  args.GetReturnValue().Set(Boolean::New(v8::Isolate::GetCurrent(), ans != GL_FALSE));
  }

  //4 float values
  case GL_CURRENT_VERTEX_ATTRIB: //(?)
  {
	  GLfloat* ans = new GLfloat[4];
	  glGetVertexAttribfv((GLuint)index, (GLenum)pname, ans);

	  Local<Array> res = Array::New(v8::Isolate::GetCurrent(), 4);
	  for (int i = 0; i < 4; ++i) {
	    res->Set(Integer::New(v8::Isolate::GetCurrent(), i), Integer::New(v8::Isolate::GetCurrent(), ans[i]));
	  }

	  delete[] ans;

	  args.GetReturnValue().Set(res);
  }
  }

  args.GetReturnValue().SetUndefined();
}

void GLESglTexImage2DCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 9) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  int level = args[1]->IntegerValue();
  int internal_format = args[2]->IntegerValue();
  int width = args[3]->IntegerValue();
  int height = args[4]->IntegerValue();
  int border = args[5]->IntegerValue();
  unsigned format = args[6]->Uint32Value();
  unsigned type = args[7]->Uint32Value();

  if(args[8]->IsArray()) {
	  Handle<Array> arr_handle = Handle<Array>::Cast(args[8]);

	  if( type == GL_UNSIGNED_BYTE ) {
		  GLubyte* pixels = new  GLubyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLubyte aux = (GLubyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  } else if( type == GL_BYTE ) {
		  GLbyte* pixels = new  GLbyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbyte aux = (GLbyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_BITMAP ) {
		  GLbitfield* pixels = new  GLbitfield[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbitfield aux = (GLbitfield)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_UNSIGNED_SHORT ) {
		  GLushort* pixels = new  GLushort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLushort aux = (GLushort)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_SHORT ) {
		  GLshort* pixels = new  GLshort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLshort aux = (GLshort)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_UNSIGNED_INT ) {
		  GLuint* pixels = new  GLuint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLuint aux = (GLuint)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_INT ) {
		  GLint* pixels = new  GLint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLint aux = (GLint)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;

	  } else if( type == GL_FLOAT ) {
		  GLfloat* pixels = new  GLfloat[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLfloat aux = (GLfloat)arg->NumberValue();
		      pixels[j] = aux;
		  }
		  glTexImage2D((GLenum)target,
				  (GLint)level,
				  (GLenum)internal_format,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLint)border,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
  }

  args.GetReturnValue().SetUndefined();
}



void GLESglTexSubImage2DCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 9) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  int level = args[1]->IntegerValue();
  int xoffset = args[2]->IntegerValue();
  int yoffset = args[3]->IntegerValue();
  int width = args[4]->IntegerValue();
  int height = args[5]->IntegerValue();
  unsigned format = args[6]->Uint32Value();
  unsigned type = args[7]->Uint32Value();

  if(args[8]->IsArray()) {
	  Handle<Array> arr_handle = Handle<Array>::Cast(args[8]);

	  switch(type) {
	  case GL_UNSIGNED_BYTE:
	  {
		  GLubyte* pixels = new  GLubyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLubyte aux = (GLubyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_BYTE:
	  {
		  GLbyte* pixels = new  GLbyte[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbyte aux = (GLbyte)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_BITMAP:
	  {
		  GLbitfield* pixels = new  GLbitfield[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLbitfield aux = (GLbitfield)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_UNSIGNED_SHORT:
	  {
		  GLushort* pixels = new  GLushort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLushort aux = (GLushort)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_SHORT:
	  {
		  GLshort* pixels = new  GLshort[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLshort aux = (GLshort)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_UNSIGNED_INT:
	  {
		  GLuint* pixels = new  GLuint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLuint aux = (GLuint)arg->Uint32Value();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_INT:
	  {
		  GLint* pixels = new  GLint[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLint aux = (GLint)arg->IntegerValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;

	  case GL_FLOAT:
	  {
		  GLfloat* pixels = new  GLfloat[arr_handle->Length()];
		  for (unsigned j = 0; j < arr_handle->Length(); j++) {
		      Handle<Value> arg(arr_handle->Get(Integer::New(v8::Isolate::GetCurrent(), j)));
		      GLfloat aux = (GLfloat)arg->NumberValue();
		      pixels[j] = aux;
		  }
		  glTexSubImage2D((GLenum)target,
				  (GLint)level,
				  (GLint)xoffset,
				  (GLint)yoffset,
				  (GLsizei)width,
				  (GLsizei)height,
				  (GLenum)format,
				  (GLenum)type,
				  (const void*)pixels);

		  delete[] pixels;
	  }
	  break;
	  }
  }

  args.GetReturnValue().SetUndefined();
}


void GLESglGetRenderbufferParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  unsigned pname = args[1]->Uint32Value();

  switch(pname) {
  //1 int value
  case GL_RENDERBUFFER_WIDTH:
  case GL_RENDERBUFFER_HEIGHT:
  case GL_RENDERBUFFER_INTERNAL_FORMAT:
  case GL_RENDERBUFFER_RED_SIZE:
  case GL_RENDERBUFFER_GREEN_SIZE:
  case GL_RENDERBUFFER_BLUE_SIZE:
  case GL_RENDERBUFFER_ALPHA_SIZE:
  case GL_RENDERBUFFER_DEPTH_SIZE:
  case  GL_RENDERBUFFER_STENCIL_SIZE:
  {
	  int ans = 0;
	  glGetRenderbufferParameteriv((GLenum)target, (GLenum)pname, (GLint*)&ans);
	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
  }
  }

  args.GetReturnValue().SetUndefined();
  return;
}

void GLESglGetFramebufferAttachmentParameterCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  //if less that nbr of formal parameters then do nothing
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned target = args[0]->Uint32Value();
  unsigned attachment = args[1]->Uint32Value();
  unsigned pname = args[2]->Uint32Value();

//  switch(pname) {
//  case FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
//  case FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
//  case FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
//  case FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
//  {
	  int ans = 0;
	  glGetFramebufferAttachmentParameteriv((GLenum)target,
			  (GLenum)attachment,
			  (GLenum)pname,
			  (GLint*)&ans);

	  args.GetReturnValue().Set(Integer::New(v8::Isolate::GetCurrent(), ans));
//  }
//  }

  args.GetReturnValue().SetUndefined();
}

void GLESglGetShaderInfoLogCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned shader = args[0]->Uint32Value();

  //query string length
  int len = 0;
  glGetShaderiv((GLuint)shader, GL_INFO_LOG_LENGTH, &len);

  char* log = new char[len];
  glGetShaderInfoLog((GLuint)shader, (GLsizei)len, NULL, log);

  args.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), log));
}

void GLESglGetShaderSourceCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {

  if (args.Length() != 1) {
    args.GetReturnValue().SetUndefined();
    return;
  }
  //define handle scope
  HandleScope handle_scope(v8::Isolate::GetCurrent());
  //get arguments
  unsigned shader = args[0]->Uint32Value();

  //query string length
  int len = 0;
  glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &len);

  char* log = new char[len];
  glGetShaderSource((GLuint)shader, (GLsizei)len, NULL, log);

  args.GetReturnValue().Set(String::NewFromUtf8(v8::Isolate::GetCurrent(), log));
}

// We expect to be called with a shader id and a single string.
void GLESglShaderSourceFileCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
  if (args.Length() != 2) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  HandleScope handle_scope(v8::Isolate::GetCurrent());
  GLuint shader_id = args[0]->Uint32Value();
  // GLSL source is defined as an ASCII subset.
  v8::String::Utf8Value filepath_ascii(args[1]);
  if (!*filepath_ascii) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  char* filepath_str = *filepath_ascii;

  //read the file source
  char* filename = NULL;
  if(filepath_str[0] != '/') {
	  filename = new char[strlen(GlesFactory::root_path) + strlen(filepath_str) +1];
	  strcpy(filename, GlesFactory::root_path);
	  strcat(filename, filepath_str);
  } else {
	  filename = new char[strlen(filepath_str) +1];
	  strcpy(filename, filepath_str);
  }

  std::ifstream in_file(filename);

  if(!in_file.is_open()) {
    args.GetReturnValue().SetUndefined();
    return;
  }

  std::string line, full_text = "";
  while (! in_file.eof() ) {
    std::getline (in_file, line);
    full_text += line + "\n";
  }

  char* ans = new char[full_text.length() +1];
  strcpy(ans, full_text.c_str());

  GLsizei code_len = full_text.length();
  glShaderSource(shader_id, 1, (const GLchar**) &ans, &code_len);

  delete[] ans;
  delete[] filename;

  Handle<Object> res(Local<Object>::New(v8::Isolate::GetCurrent(), GlesFactory::self_));
  args.GetReturnValue().Set(res);
}



<|start_filename|>src/lib/binary-b/bytestring.h<|end_filename|>
#ifndef _BYTESTRING_H
#define _BYTESTRING_H

#include <v8.h>
#include "macros.h"

v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > ByteString_template();
v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function> > ByteString_function();
void ByteString_init(v8::Handle<v8::FunctionTemplate> binary);

#endif


<|start_filename|>src/lib/memcached/memcached.cc<|end_filename|>
#include <v8.h>
#include "macros.h"
#include "gc.h"

#include <libmemcached/memcached.h>
#include <stdlib.h>
#include <string>
#include <cstring>

#define MEMCACHED_PTR memcached_st * memc = LOAD_PTR(0, memcached_st *)
#define JS_MEMCACHED_CAS_ERROR JS_TYPE_ERROR("Invalid arguments. Use cas(key{String}, value{String}, expiration{Int}, flags{Int}, cas{[Int,Int]})")

namespace {

void finalize(v8::Handle<v8::Object> obj) {
  memcached_st * memc = LOAD_PTR_FROM(obj, 0, memcached_st *);
  if (memc) {
    memcached_free(memc);
  }
}

/**
 * Memcached constructor does basically nothing. It just adds "this.close()"
 * method to global GC
 */
JS_METHOD(_memcached) {
  ASSERT_CONSTRUCTOR;
  if (args.Length() != 0) {
    JS_TYPE_ERROR("Invalid arguments. Use 'new Memcached()'");
    return;
  }
  memcached_st *memc = memcached_create(NULL);
  SAVE_PTR(0, memc);
  GC * gc = GC_PTR;
  gc->add(args.This(), finalize);
  args.GetReturnValue().Set(args.This());
}

/**
 * Re-initializes the underlying memcached connection and clears all state
 * previously matained. Note that this does not effect the actual memcached
 * servers but does clear the list of servers used by this connection.
 */
JS_METHOD(_reset) {
  MEMCACHED_PTR;

  if (args.Length() != 0) {
    JS_TYPE_ERROR("Invalid arguments. Use 'reset()'");
    return;
  }

  memcached_free(memc);
  SAVE_PTR(0, memcached_create(NULL));

  args.GetReturnValue().Set(args.This());
}

/**
 * Sets the prefix key. The prefix key will be used to create a domain for your
 * keys. The value specified here will be prefixed to each of your keys. The
 * value can not be greater then MEMCACHED_PREFIX_KEY_MAX_SIZE - 1 and will
 * reduce MEMCACHED_MAX_KEY by the value of your key. The prefix key is only
 * applied to the primary key, not the master key.
 */
JS_METHOD(_setPrefixKey) {
  MEMCACHED_PTR;

  if (args.Length() != 1 ||
      !args[0]->IsString()) {
    JS_TYPE_ERROR("Invalid arguments. Use 'setPrefixKey(key{String})'");
    return;
  }

  v8::String::Utf8Value key(args[0]);

  memcached_return rc =
      memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, *key);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Returns the current prefix key used.
 */
JS_METHOD(_getPrefixKey) {
  MEMCACHED_PTR;

  if (args.Length() > 0) {
    JS_TYPE_ERROR("Invalid arguments. Use 'getPrefixKey()'");
    return;
  }

  memcached_return rc;
  char *value = (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  v8::HandleScope handle_scope(JS_ISOLATE);

  v8::Handle<v8::String> result = JS_STR_LEN(value, strlen(value));

  args.GetReturnValue().Set(result);
}

/**
 * Clears the prefix key so that no prefix key will be used.
 */
JS_METHOD(_clearPrefixKey) {
  MEMCACHED_PTR;

  if (args.Length() > 0) {
    JS_TYPE_ERROR("Invalid arguments. Use 'clearPrefixKey()'");
    return;
  }

  memcached_return rc =
      memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}


/**
 * Adds a server by host, port and weight to the list of servers that will
 * handle requests.
 */
JS_METHOD(_addServerWithWeight) {
  MEMCACHED_PTR;

  if (args.Length() != 3 ||
      !args[0]->IsString() ||
      !args[1]->IsInt32() ||
      !args[2]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use addServerWithWeight(host{String}, port{Integer}, weight{Integer}).'");
    return;
  }

  v8::String::Utf8Value host(args[0]);
  int port = args[1]->Int32Value();
  uint32_t weight = args[2]->Uint32Value();

  memcached_return rc =
      memcached_server_add_with_weight(memc, *host, port, weight);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Wipes the contents of memcached servers. It will either do this immediately
 * or expire the content based on the expiration time passed to the method. An
 * expiration time of 0 causes an immediate flush. The operation is not atomic
 * to multiple servers, just atomic to a single server. That is, it will flush
 * the servers in the order that they were added.
 */
JS_METHOD(_flush) {
  MEMCACHED_PTR;

  if (args.Length() != 1 || !args[0]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use flush(expiration{Integer}).");
    return;
  }

  uint32_t expiration = args[0]->Uint32Value();

  memcached_return rc = memcached_flush(memc, expiration);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Writes an object to the server. If an object already exists it will
 * overwrite what is in the server. If the object does not exist it will be
 * written.
 */
JS_METHOD(_set) {
  MEMCACHED_PTR;

  if (args.Length() != 4 ||
      !args[0]->IsString() ||
      !args[1]->IsString() ||
      !args[2]->IsInt32() ||
      !args[3]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use set(key{String}, value{String}, expiration{Integer}, flags{Integer})");
    return;
  }

  v8::String::Utf8Value key(args[0]);
  v8::String::Utf8Value value(args[1]);
  uint32_t expiration = args[2]->Uint32Value();
  uint32_t flags = args[3]->Uint32Value();

  memcached_return rc = memcached_set(
      memc,
      *key, key.length(),
      *value, value.length(),
      expiration,
      flags);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Replaces an object on the server. If the object is not found on the server an
 * error occurs.
 */
JS_METHOD(_replace) {
  MEMCACHED_PTR;

  if (args.Length() != 4 ||
      !args[0]->IsString() ||
      !args[1]->IsString() ||
      !args[2]->IsInt32() ||
      !args[3]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use replace(key{String}, value{String}, expiration{Integer}, flags{Integer})");
    return;
  }

  v8::String::Utf8Value key(args[0]);
  v8::String::Utf8Value value(args[1]);
  uint32_t expiration = args[2]->Uint32Value();
  uint32_t flags = args[3]->Uint32Value();

  memcached_return rc = memcached_replace(
      memc,
      *key, key.length(),
      *value, value.length(),
      expiration,
      flags);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Adds an object on the server. If the object is found on the server an error
 * occurs, otherwise the value is stored.
 */
JS_METHOD(_add) {
  MEMCACHED_PTR;

  if (args.Length() != 4 ||
      !args[0]->IsString() ||
      !args[1]->IsString() ||
      !args[2]->IsInt32() ||
      !args[3]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use add(key{String}, value{String}, expiration{Integer}, flags{Integer})");
    return;
  }

  v8::String::Utf8Value key(args[0]);
  v8::String::Utf8Value value(args[1]);
  uint32_t expiration = args[2]->Uint32Value();
  uint32_t flags = args[3]->Uint32Value();

  memcached_return rc = memcached_add(
      memc,
      *key, key.length(),
      *value, value.length(),
      expiration,
      flags);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Deletes a particular key. Expiration works by placing the item into a delete
 * queue, which means that it won't possible to retrieve it by the "get"
 * command, but "add" and "replace" command with this key will also fail (the
 * "set" command will succeed, however). After the time passes, the item is
 * finally deleted from server memory.
 *
 * Please note the the Danga memcached server removed support for expiration in
 * the 1.4 version.
 */
JS_METHOD(_remove) {
  MEMCACHED_PTR;

  if (args.Length() != 2 ||
      !args[0]->IsString() ||
      !args[1]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use delete(key{String}, expiration{Integer})");
    return;
  }

  v8::String::Utf8Value key(args[0]);
  uint32_t expiration = args[1]->Uint32Value();

  memcached_return rc = memcached_delete(memc, *key, key.length(), expiration);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Fetches an individual value from the server by key. Returns undefined if no
 * value was set for the key. Note that there is currently no way of getting the
 * CAS value of the result with get in libmemcached so we do not return it here.
 *
 * If you need the CAS value you can use mget.
 */
JS_METHOD(_get) {
  MEMCACHED_PTR;

  if (args.Length() != 1 ||
      !args[0]->IsString()) {
    JS_TYPE_ERROR("Invalid arguments. Use get(key{String})");
    return;
  }

  v8::String::Utf8Value key(args[0]);
  size_t rlength;
  uint32_t rflags;

  memcached_return rc;
  char *rvalue = memcached_get(memc, *key, key.length(), &rlength, &rflags, &rc);
  if (rc == MEMCACHED_NOTFOUND) {
    args.GetReturnValue().SetUndefined();
    return;
  } else if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  v8::HandleScope handle_scope(JS_ISOLATE);
  v8::Handle<v8::Array> js_array = v8::Array::New(JS_ISOLATE, 2);
  js_array->Set(JS_INT(0), JS_STR_LEN(rvalue, rlength));
  js_array->Set(JS_INT(1), JS_INT(rflags));

  free(rvalue);

  args.GetReturnValue().Set(js_array);
}

/**
 * Check and set operation. Like set, but will only update the value, flags, and
 * expiration if the CAS value passed in matches that which is still associated
 * with the key. This can be used to ensure that no other clients have modified
 * a value since you read it with mget.
 */
JS_METHOD(_cas) {
  MEMCACHED_PTR;

  if (args.Length() != 5 ||
      !args[0]->IsString() ||
      !args[1]->IsString() ||
      !args[2]->IsInt32() ||
      !args[3]->IsInt32() ||
      !args[4]->IsArray()) {
    JS_MEMCACHED_CAS_ERROR;
    return;
  }

  v8::String::Utf8Value key(args[0]);
  v8::String::Utf8Value value(args[1]);
  uint32_t expiration = args[2]->Uint32Value();
  uint32_t flags = args[3]->Uint32Value();
  v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(args[4]);
  if (arr->Length() != 2) {
    JS_MEMCACHED_CAS_ERROR;
    return;
  }
  v8::Local<v8::Value> arr0 = arr->Get(JS_INT(0));
  v8::Local<v8::Value> arr1 = arr->Get(JS_INT(1));
  if (!arr0->IsInt32() ||
      !arr1->IsInt32()) {
    JS_MEMCACHED_CAS_ERROR;
    return;
  }
  uint64_t cas =
      (((uint64_t)arr0->Uint32Value()) << 32) + ((uint64_t)arr1->Uint32Value());

  memcached_return_t rc = memcached_cas(
      memc, *key, key.length(), *value, value.length(), expiration, flags, cas);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

/**
 * Fetches multiple keys at once by key. Returns an array of arrays where each
 * nested array is a [key, value, flags, cas] tuple. If a given key was found
 * then there will be a tuple for it, otherwise no tuple will exist for the key.
 */
JS_METHOD(_mget) {
  MEMCACHED_PTR;

  if (args.Length() != 1 ||
      !args[0]->IsArray()) {
    JS_TYPE_ERROR("Invalid arguments. Use mget(keys{Array<String>})");
    return;
  }

  v8::Handle<v8::Array> arr = v8::Handle<v8::Array>::Cast(args[0]);
  uint32_t key_count = arr->Length();
  char* keys[key_count];
  size_t key_lengths[key_count];
  for (unsigned int i = 0; i < key_count; i++) {
    v8::Local<v8::Value> value = arr->Get(JS_INT(i));
    if (!value->IsString()) {
      JS_TYPE_ERROR("Invalid arguments. All keys must be Strings.");
      return;
    }
    // Copying the strings was the only way I could figure out how to get
    // an array of string pointers for the memcached_mget call. There may be
    // a more efficient way of doing this that does not require new memory
    // allocation.
    v8::Local<v8::String> string = value->ToString();
    keys[i] = new char[string->Utf8Length()];
    string->WriteUtf8(keys[i], string->Utf8Length());
    key_lengths[i] = (size_t)string->Utf8Length();
  }

  memcached_return_t rc;
  rc = memcached_mget(memc, keys, key_lengths, key_count);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  for (unsigned int i = 0; i < key_count; i++) {
    delete[] keys[i];
  }

  uint32_t flags;
  uint64_t cas;
  const char *return_key;
  size_t return_key_length;
  const char *return_value;
  size_t return_value_length;

  memcached_result_st results;

  // Prepare result structure.
  memcached_result_create(memc, &results);

  // In binary mode, libmemcached adds the prefix to each key returned so
  // we strip it if necessary to make binary and text mode more similar.
  size_t prefix_key_offset = 0;
  if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1) {
    char *prefix_key = (char *)memcached_callback_get(
        memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc);
    if (rc == MEMCACHED_SUCCESS) {
      prefix_key_offset = strlen(prefix_key);
    }
  }

  v8::HandleScope handle_scope(JS_ISOLATE);
  v8::Handle<v8::Array> js_array = v8::Array::New(JS_ISOLATE);

  // It is more efficient to use memcached_fetch_result than memcached_fetch
  // because you can re-use the memory between invocations according to the
  // libmemcached docs. It is also the only way to get the CAS value of the
  // result.
  unsigned int i = 0;
  while ((memcached_fetch_result(memc, &results, &rc)) != NULL) {
    if (rc != MEMCACHED_SUCCESS) {
      JS_ERROR(memcached_strerror(memc, rc));
      return;
    }
    return_key = memcached_result_key_value(&results) + prefix_key_offset;
    return_key_length = memcached_result_key_length(&results) - prefix_key_offset;
    return_value = memcached_result_value(&results);
    return_value_length = memcached_result_length(&results);
    flags = memcached_result_flags(&results);
    cas = memcached_result_cas(&results);

    v8::Handle<v8::Array> js_return_value = v8::Array::New(JS_ISOLATE, 4);

    // Encode 64bit CAS value into two 32bit integers so they do not
    // exceed the 52bit integer range of Javascript integers.
    v8::Handle<v8::Array> js_cas = v8::Array::New(JS_ISOLATE, 2);
    js_cas->Set(JS_INT(0), JS_INT(cas >> 32));
    js_cas->Set(JS_INT(1), JS_INT(cas & 0xFFFFFFFF));

    js_return_value->Set(JS_INT(0), JS_STR_LEN(return_key, return_key_length));
    js_return_value->Set(JS_INT(1), JS_STR_LEN(return_value, return_value_length));
    js_return_value->Set(JS_INT(2), JS_INT(flags));
    js_return_value->Set(JS_INT(3), js_cas);
    js_array->Set(JS_INT(i), js_return_value);
    i++;
  }
  // According to examples in the memcached tests, and my interpretation of
  // the documentation - it is only necessary to free the memcached results
  // after you are done using, and not on each iteratation of
  // memcached_fetch_result. This implies that memcached is re-using the memory
  // allocated to the string value and freeing it at the end.
  memcached_result_free(&results);

  // Does this ensure that all the members of the array are also 'Close'd to the
  // parent handle_scope? It seems to based on similar usage in list_items of
  // fs.cc
  args.GetReturnValue().Set(js_array);
}

JS_METHOD(_behaviorSet) {
  MEMCACHED_PTR;

  if (args.Length() != 2 ||
      !args[0]->IsInt32() ||
      !args[1]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use behaviorSet(behavior{Int}, data{Int}).");
    return;
  }

  memcached_behavior_t behavior = (memcached_behavior_t)args[0]->Uint32Value();
  uint32_t data = args[1]->Uint32Value();

  memcached_return_t rc = memcached_behavior_set(memc, behavior, data);
  if (rc != MEMCACHED_SUCCESS) {
    JS_ERROR(memcached_strerror(memc, rc));
    return;
  }

  args.GetReturnValue().Set(args.This());
}

JS_METHOD(_behaviorGet) {
  MEMCACHED_PTR;

  if (args.Length() != 1 ||
      !args[0]->IsInt32()) {
    JS_TYPE_ERROR("Invalid arguments. Use behaviorGet(behavior{Int})");
    return;
  }

  memcached_behavior_t behavior = (memcached_behavior_t)args[0]->Uint32Value();

  uint64_t data = memcached_behavior_get(memc, behavior);
  args.GetReturnValue().Set(JS_INT(data));
}

} /* end namespace */

SHARED_INIT() {
  v8::HandleScope handle_scope(JS_ISOLATE);
  v8::Handle<v8::FunctionTemplate> ft = v8::FunctionTemplate::New(JS_ISOLATE, _memcached);
  ft->SetClassName(JS_STR("Memcached"));

  v8::Handle<v8::ObjectTemplate> ot = ft->InstanceTemplate();
  ot->SetInternalFieldCount(1); /* connection */

  v8::Handle<v8::ObjectTemplate> pt = ft->PrototypeTemplate();

  /**
   * Memcached prototype methods (new Memcached().*)
   */
  pt->Set(JS_STR("reset"), v8::FunctionTemplate::New(JS_ISOLATE, _reset));
  pt->Set(JS_STR("getPrefixKey"), v8::FunctionTemplate::New(JS_ISOLATE, _getPrefixKey));
  pt->Set(JS_STR("setPrefixKey"), v8::FunctionTemplate::New(JS_ISOLATE, _setPrefixKey));
  pt->Set(JS_STR("clearPrefixKey"), v8::FunctionTemplate::New(JS_ISOLATE, _clearPrefixKey));
  pt->Set(JS_STR("addServerWithWeight"), v8::FunctionTemplate::New(JS_ISOLATE, _addServerWithWeight));
  pt->Set(JS_STR("flush"), v8::FunctionTemplate::New(JS_ISOLATE, _flush));
  pt->Set(JS_STR("set"), v8::FunctionTemplate::New(JS_ISOLATE, _set));
  pt->Set(JS_STR("replace"), v8::FunctionTemplate::New(JS_ISOLATE, _replace));
  pt->Set(JS_STR("add"), v8::FunctionTemplate::New(JS_ISOLATE, _add));
  pt->Set(JS_STR("remove"), v8::FunctionTemplate::New(JS_ISOLATE, _remove));
  pt->Set(JS_STR("get"), v8::FunctionTemplate::New(JS_ISOLATE, _get));
  pt->Set(JS_STR("cas"), v8::FunctionTemplate::New(JS_ISOLATE, _cas));
  pt->Set(JS_STR("mget"), v8::FunctionTemplate::New(JS_ISOLATE, _mget));
  pt->Set(JS_STR("behaviorSet"), v8::FunctionTemplate::New(JS_ISOLATE, _behaviorSet));
  pt->Set(JS_STR("behaviorGet"), v8::FunctionTemplate::New(JS_ISOLATE, _behaviorGet));

  /**
   * Memcached behavior values. These are copied from the
   * memcached_behavior_t enum in constants.h of libmemcached.
   */
  ft->Set(JS_STR("BEHAVIOR_NO_BLOCK"), JS_INT(MEMCACHED_BEHAVIOR_NO_BLOCK));
  ft->Set(JS_STR("BEHAVIOR_TCP_NODELAY"), JS_INT(MEMCACHED_BEHAVIOR_TCP_NODELAY));
  ft->Set(JS_STR("BEHAVIOR_HASH"), JS_INT(MEMCACHED_BEHAVIOR_HASH));
  ft->Set(JS_STR("BEHAVIOR_KETAMA"), JS_INT(MEMCACHED_BEHAVIOR_KETAMA));
  ft->Set(JS_STR("BEHAVIOR_SOCKET_SEND_SIZE"), JS_INT(MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE));
  ft->Set(JS_STR("BEHAVIOR_SOCKET_RECV_SIZE"), JS_INT(MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE));
  ft->Set(JS_STR("BEHAVIOR_CACHE_LOOKUPS"), JS_INT(MEMCACHED_BEHAVIOR_CACHE_LOOKUPS));
  ft->Set(JS_STR("BEHAVIOR_SUPPORT_CAS"), JS_INT(MEMCACHED_BEHAVIOR_SUPPORT_CAS));
  ft->Set(JS_STR("BEHAVIOR_POLL_TIMEOUT"), JS_INT(MEMCACHED_BEHAVIOR_POLL_TIMEOUT));
  ft->Set(JS_STR("BEHAVIOR_DISTRIBUTION"), JS_INT(MEMCACHED_BEHAVIOR_DISTRIBUTION));
  ft->Set(JS_STR("BEHAVIOR_BUFFER_REQUESTS"), JS_INT(MEMCACHED_BEHAVIOR_BUFFER_REQUESTS));
  ft->Set(JS_STR("BEHAVIOR_USER_DATA"), JS_INT(MEMCACHED_BEHAVIOR_USER_DATA));
  ft->Set(JS_STR("BEHAVIOR_SORT_HOSTS"), JS_INT(MEMCACHED_BEHAVIOR_SORT_HOSTS));
  ft->Set(JS_STR("BEHAVIOR_VERIFY_KEY"), JS_INT(MEMCACHED_BEHAVIOR_VERIFY_KEY));
  ft->Set(JS_STR("BEHAVIOR_CONNECT_TIMEOUT"), JS_INT(MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT));
  ft->Set(JS_STR("BEHAVIOR_RETRY_TIMEOUT"), JS_INT(MEMCACHED_BEHAVIOR_RETRY_TIMEOUT));
  ft->Set(JS_STR("BEHAVIOR_KETAMA_WEIGHTED"), JS_INT(MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED));
  ft->Set(JS_STR("BEHAVIOR_KETAMA_HASH"), JS_INT(MEMCACHED_BEHAVIOR_KETAMA_HASH));
  ft->Set(JS_STR("BEHAVIOR_BINARY_PROTOCOL"), JS_INT(MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
  ft->Set(JS_STR("BEHAVIOR_SND_TIMEOUT"), JS_INT(MEMCACHED_BEHAVIOR_SND_TIMEOUT));
  ft->Set(JS_STR("BEHAVIOR_RCV_TIMEOUT"), JS_INT(MEMCACHED_BEHAVIOR_RCV_TIMEOUT));
  ft->Set(JS_STR("BEHAVIOR_SERVER_FAILURE_LIMIT"), JS_INT(MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT));
  ft->Set(JS_STR("BEHAVIOR_IO_MSG_WATERMARK"), JS_INT(MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK));
  ft->Set(JS_STR("BEHAVIOR_IO_BYTES_WATERMARK"), JS_INT(MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK));
  ft->Set(JS_STR("BEHAVIOR_IO_KEY_PREFETCH"), JS_INT(MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH));
  ft->Set(JS_STR("BEHAVIOR_HASH_WITH_PREFIX_KEY"), JS_INT(MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY));
  ft->Set(JS_STR("BEHAVIOR_NOREPLY"), JS_INT(MEMCACHED_BEHAVIOR_NOREPLY));
  ft->Set(JS_STR("BEHAVIOR_USE_UDP"), JS_INT(MEMCACHED_BEHAVIOR_USE_UDP));
  ft->Set(JS_STR("BEHAVIOR_AUTO_EJECT_HOSTS"), JS_INT(MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS));
  ft->Set(JS_STR("BEHAVIOR_NUMBER_OF_REPLICAS"), JS_INT(MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS));
  ft->Set(JS_STR("BEHAVIOR_RANDOMIZE_REPLICA_READ"), JS_INT(MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ));
  ft->Set(JS_STR("BEHAVIOR_CORK"), JS_INT(MEMCACHED_BEHAVIOR_CORK));
  ft->Set(JS_STR("BEHAVIOR_TCP_KEEPALIVE"), JS_INT(MEMCACHED_BEHAVIOR_TCP_KEEPALIVE));
  ft->Set(JS_STR("BEHAVIOR_TCP_KEEPIDLE"), JS_INT(MEMCACHED_BEHAVIOR_TCP_KEEPIDLE));
  ft->Set(JS_STR("BEHAVIOR_MAX"), JS_INT(MEMCACHED_BEHAVIOR_MAX));

  exports->Set(JS_STR("Memcached"), ft->GetFunction());
}
