From 26f1bd51712404a5a7d794f1d73aa217bb2f5d8b Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Mon, 17 Jun 2013 14:19:00 +0800 Subject: [PATCH 1/5] issue #2277: Add OpenGL lua binding --- .../project.pbxproj.REMOVED.git-id | 2 +- .../cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id | 1 + scripting/lua/cocos2dx_support/LuaOpengl.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id create mode 100644 scripting/lua/cocos2dx_support/LuaOpengl.h diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id index 363b49cf1a..e30bde7975 100644 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -393bddc01d5ea9a3d98e1d0c03c902424d05346e \ No newline at end of file +da31505b1daa8313b3e96c8e7d6113631d12f5f5 \ No newline at end of file diff --git a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id new file mode 100644 index 0000000000..590fa7f0f3 --- /dev/null +++ b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id @@ -0,0 +1 @@ +5f7a7be1a869fb3302b56d48463bdb61a06550f7 \ No newline at end of file diff --git a/scripting/lua/cocos2dx_support/LuaOpengl.h b/scripting/lua/cocos2dx_support/LuaOpengl.h new file mode 100644 index 0000000000..68b8d94018 --- /dev/null +++ b/scripting/lua/cocos2dx_support/LuaOpengl.h @@ -0,0 +1,15 @@ +#ifndef __LUA_OPENGL_H__ +#define __LUA_OPENGL_H__ + +#ifdef __cplusplus +extern "C" { +#endif +#include "tolua++.h" +#ifdef __cplusplus +} +#endif + + +TOLUA_API int tolua_opengl_open(lua_State* tolua_S); + +#endif //__LUA_OPENGL_H__ From b48cf5997dd6bd9e504bd13af7f926f0672cbc5e Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Wed, 19 Jun 2013 16:40:02 +0800 Subject: [PATCH 2/5] issue #2277: Add OpenGL lua test samples --- .../Resources/Shaders/example_ColorBars.vsh | 18 + samples/Lua/TestLua/Classes/AppDelegate.cpp | 2 + .../luaScript/OpenGLTest/OpenGLTest.lua | 1177 +++++++++++++++++ .../TestLua/Resources/luaScript/mainMenu.lua | 4 +- .../project.pbxproj.REMOVED.git-id | 2 +- .../LuaOpengl.cpp.REMOVED.git-id | 2 +- scripting/lua/script/Cocos2dConstants.lua | 178 +++ scripting/lua/script/OpenglConstants.lua | 838 ++++++++++++ 8 files changed, 2218 insertions(+), 3 deletions(-) create mode 100644 samples/Cpp/TestCpp/Resources/Shaders/example_ColorBars.vsh create mode 100644 samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua create mode 100644 scripting/lua/script/Cocos2dConstants.lua create mode 100644 scripting/lua/script/OpenglConstants.lua diff --git a/samples/Cpp/TestCpp/Resources/Shaders/example_ColorBars.vsh b/samples/Cpp/TestCpp/Resources/Shaders/example_ColorBars.vsh new file mode 100644 index 0000000000..71dea345f4 --- /dev/null +++ b/samples/Cpp/TestCpp/Resources/Shaders/example_ColorBars.vsh @@ -0,0 +1,18 @@ +// http://www.cocos2d-iphone.org + +attribute vec4 a_position; +attribute vec2 a_texCoord; + +#ifdef GL_ES +varying mediump vec2 v_texCoord; +#else +varying vec2 v_texCoord; +#endif + +void main() +{ + //gl_Position = CC_MVPMatrix * a_position; + gl_Position = (CC_PMatrix * CC_MVMatrix) * a_position; + v_texCoord = a_texCoord; +} + diff --git a/samples/Lua/TestLua/Classes/AppDelegate.cpp b/samples/Lua/TestLua/Classes/AppDelegate.cpp index bd74b111a9..36527db7a3 100644 --- a/samples/Lua/TestLua/Classes/AppDelegate.cpp +++ b/samples/Lua/TestLua/Classes/AppDelegate.cpp @@ -7,6 +7,7 @@ #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #include "Lua_web_socket.h" #endif +#include "LuaOpengl.h" using namespace CocosDenshion; @@ -45,6 +46,7 @@ bool AppDelegate::applicationDidFinishLaunching() tolua_s = pStack->getLuaState(); tolua_web_socket_open(tolua_s); #endif + tolua_opengl_open(tolua_s); std::vector searchPaths; searchPaths.push_back("cocosbuilderRes"); diff --git a/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua b/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua new file mode 100644 index 0000000000..2145081c62 --- /dev/null +++ b/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua @@ -0,0 +1,1177 @@ +require "OpenglConstants" +require "Cocos2dConstants" +local function OpenGLTestMainLayer() + local kItemTagBasic = 1000 + local testCount = 16 + local maxCases = testCount + local curCase = 0 + local accum = 0 + local labelBMFont = nil + local size = CCDirector:sharedDirector():getWinSize() + local curLayer = nil + local schedulEntry = nil + local function OrderCallbackMenu() + local function backCallback() + curCase = curCase - 1 + if curCase < 0 then + curCase = curCase + maxCases + end + ShowCurrentTest() + end + + local function restartCallback() + ShowCurrentTest() + end + + local function nextCallback() + curCase = curCase + 1 + curCase = curCase % maxCases + ShowCurrentTest() + end + + local ordercallbackmenu = CCMenu:create() + local size = CCDirector:sharedDirector():getWinSize() + local item1 = CCMenuItemImage:create(s_pPathB1, s_pPathB2) + item1:registerScriptTapHandler(backCallback) + ordercallbackmenu:addChild(item1,kItemTagBasic) + local item2 = CCMenuItemImage:create(s_pPathR1, s_pPathR2) + item2:registerScriptTapHandler(restartCallback) + ordercallbackmenu:addChild(item2,kItemTagBasic) + local item3 = CCMenuItemImage:create(s_pPathF1, s_pPathF2) + ordercallbackmenu:addChild(item3,kItemTagBasic) + item3:registerScriptTapHandler(nextCallback) + + item1:setPosition(CCPointMake(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) + item2:setPosition(CCPointMake(size.width / 2, item2:getContentSize().height / 2)) + item3:setPosition(CCPointMake(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) + + ordercallbackmenu:setPosition(ccp(0, 0)) + + return ordercallbackmenu + end + + local function GetTitle() + if 0 == curCase then + return "Shader Retro Effect" + elseif 1 == curCase then + return "Shader Monjori Test" + elseif 2 == curCase then + return "Shader Mandelbrot Test" + elseif 3 == curCase then + return "Shader Heart Test" + elseif 4 == curCase then + return "Shader Plasma Test" + elseif 5 == curCase then + return "Shader Flower Test" + elseif 6 == curCase then + return "Shader Julia Test" + elseif 7 == curCase then + return "gl.getActive***" + elseif 8 == curCase then + return "TexImage2DTest" + elseif 9 == curCase then + return "GetSupportedExtensionsTest" + elseif 10 == curCase then + return "gl.ReadPixels()" + elseif 11 == curCase then + return "gl.clear(gl.COLOR_BUFFER_BIT)" + elseif 12 == curCase then + return "GLNode + WebGL API" + elseif 13 == curCase then + return "GLNode + cocos2d API" + elseif 14 == curCase then + return "GLTexParamterTest" + elseif 15 == curCase then + return "GLGetUniformTest" + end + end + + local function GetSubTitle() + if 0 == curCase then + return "Should see moving colors, and a sin effect on the letters" + elseif 1 == curCase then + return "Monjori plane deformations" + elseif 2 == curCase then + return "Mandelbrot shader with Zoom" + elseif 3 == curCase then + return "You should see a heart in the center" + elseif 4 == curCase then + return "You should see a plasma in the center" + elseif 5 == curCase then + return "You should see a moving Flower in the center" + elseif 6 == curCase then + return "You should see Julia effect" + elseif 7 == curCase then + return "Tests gl.getActiveUniform / getActiveAttrib. See console" + elseif 8 == curCase then + return "Testing Texture creation" + elseif 9 == curCase then + return "See console for the supported GL extensions" + elseif 10 == curCase then + return "Tests ReadPixels. See console" + elseif 11 == curCase then + return "Testing gl.clear() with cc.GLNode" + elseif 12 == curCase then + return "blue background with a red triangle in the middle" + elseif 13 == curCase then + return "blue background with a red triangle in the middle" + elseif 14 == curCase then + return "tests texParameter()" + elseif 15 == curCase then + return "tests texParameter()" + end + end + + local function InitTitle(layer) + --Title + local lableTitle = CCLabelTTF:create(GetTitle(), "Arial", 40) + layer:addChild(lableTitle, 15) + lableTitle:setPosition(ccp(size.width/2, size.height-32)) + lableTitle:setColor(ccc3(255,255,40)) + --SubTitle + local subLabelTitle = CCLabelTTF:create(GetSubTitle(), "Thonburi", 16) + layer:addChild(subLabelTitle, 15) + subLabelTitle:setPosition(ccp(size.width/2, size.height-80)) + end + + local function updateRetroEffect(fTime) + if nil == labelBMFont then + return + end + accum = accum + fTime + local children = labelBMFont:getChildren() + if nil == children then + return + end + local i = 0 + local len = children:count() + for i= 0 ,len - 1 do + local child = tolua.cast(children:objectAtIndex(i), "CCSprite") + local oldPosX,oldPosY = child:getPosition() + child:setPosition(oldPosX,math.sin(accum * 2 + i / 2.0) * 20) + local scaleY = math.sin(accum * 2 + i / 2.0 + 0.707) + child:setScaleY(scaleY) + end + end + + local function createShaderRetroEffect() + local RetroEffectlayer = CCLayer:create() + InitTitle(RetroEffectlayer) + local program = CCGLProgram:create("Shaders/example_ColorBars.vsh", "Shaders/example_ColorBars.fsh") + program:addAttribute(CCConstants.ATTRIBUTE_NAME_POSITION, CCConstants.VERTEX_ATTRIB_POSITION) + program:addAttribute(CCConstants.ATTRIBUTE_NAME_TEX_COORD, CCConstants.VERTEX_ATTRIB_TEX_COORDS) + program:link() + program:updateUniforms() + + label = CCLabelBMFont:create("RETRO EFFECT","fonts/west_england-64.fnt") + label:setShaderProgram( program ) + + label:setPosition(size.width/2, size.height/2) + RetroEffectlayer:addChild(label) + labelBMFont = label + RetroEffectlayer:scheduleUpdateWithPriorityLua(updateRetroEffect,0) + return RetroEffectlayer + end + + local function createShaderMajoriTest() + local uniformCenter = 0 + local uniformResolution = 0 + local time = 0 + local squareVertexPositionBuffer = {} + local majorLayer = CCLayer:create() + + InitTitle(majorLayer) + --loadShaderVertex + local shader = CCGLProgram:create("Shaders/example_Monjori.vsh", "Shaders/example_Monjori.fsh") + + shader:addAttribute("aVertex", CCConstants.VERTEX_ATTRIB_POSITION) + shader:link() + shader:updateUniforms() + + local program = shader:getProgram() + + local glNode = GLNode:create() + glNode:setContentSize(CCSizeMake(256,256)) + glNode:setAnchorPoint(ccp(0.5, 0.5)) + uniformCenter = glNode:_getUniformLocation(program,"center") + uniformResolution = glNode:_getUniformLocation( program, "resolution") + glNode:setShaderProgram(shader) + + local function initBuffer() + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + local vertices = { 256,256,0,256,256,0,0,0} + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function updateMajori(fTime) + time = time + fTime + end + + local function majoriDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + --Uniforms + shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2) + shader:setUniformLocationWith2f( uniformResolution, 256, 256) + + glNode:glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_POSITION) + + --Draw fullscreen Square + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + initBuffer() + majorLayer:scheduleUpdateWithPriorityLua(updateMajori,0) + glNode:registerScriptDrawHandler(majoriDraw) + time = 0 + majorLayer:addChild(glNode,-10) + glNode:setPosition( size.width/2, size.height/2) + return majorLayer + end + + local function createShaderMandelbrotTest() + local uniformCenter = 0 + local uniformResolution = 0 + local time = 0 + local squareVertexPositionBuffer = {} + local mandelbrotLayer = CCLayer:create() + + InitTitle(mandelbrotLayer) + --loadShaderVertex + local shader = CCGLProgram:create("Shaders/example_Mandelbrot.vsh", "Shaders/example_Mandelbrot.fsh") + + shader:addAttribute("aVertex", 0) + shader:link() + shader:updateUniforms() + + local program = shader:getProgram() + + local glNode = GLNode:create() + glNode:setContentSize(CCSizeMake(256,256)) + glNode:setAnchorPoint(ccp(0.5, 0.5)) + uniformCenter = glNode:_getUniformLocation(program,"center") + uniformResolution = glNode:_getUniformLocation( program, "resolution") + glNode:setShaderProgram(shader) + + local function initBuffer() + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + local vertices = { 256,256,0,256,256,0,0,0} + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function updateMandelbrot(fTime) + time = time + fTime + end + + local function mandelbrotDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + --Uniforms + shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2) + shader:setUniformLocationWith2f( uniformResolution, 256, 256) + + glNode:glEnableVertexAttribs(0x1) + + --Draw fullscreen Square + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + initBuffer() + mandelbrotLayer:scheduleUpdateWithPriorityLua(updateMandelbrot,0) + glNode:registerScriptDrawHandler(mandelbrotDraw) + time = 0 + mandelbrotLayer:addChild(glNode,-10) + glNode:setPosition( size.width/2, size.height/2) + return mandelbrotLayer + end + + local function createShaderHeartTest() + local uniformCenter = 0 + local uniformResolution = 0 + local time = 0 + local squareVertexPositionBuffer = {} + local heartLayer = CCLayer:create() + + InitTitle(heartLayer) + --loadShaderVertex + local shader = CCGLProgram:create("Shaders/example_Heart.vsh", "Shaders/example_Heart.fsh") + + shader:addAttribute("aVertex", 0) + shader:link() + shader:updateUniforms() + + local program = shader:getProgram() + + local glNode = GLNode:create() + glNode:setContentSize(CCSizeMake(256,256)) + glNode:setAnchorPoint(ccp(0.5, 0.5)) + uniformCenter = glNode:_getUniformLocation(program,"center") + uniformResolution = glNode:_getUniformLocation( program, "resolution") + glNode:setShaderProgram(shader) + + local function initBuffer() + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + local vertices = { 256,256,0,256,256,0,0,0} + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function updateHeart(fTime) + time = time + fTime + end + + local function heartDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + --Uniforms + shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2) + shader:setUniformLocationWith2f( uniformResolution, 256, 256) + + glNode:glEnableVertexAttribs(0x1) + + --Draw fullscreen Square + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + initBuffer() + heartLayer:scheduleUpdateWithPriorityLua(updateHeart,0) + glNode:registerScriptDrawHandler(heartDraw) + time = 0 + heartLayer:addChild(glNode,-10) + glNode:setPosition( size.width/2, size.height/2) + return heartLayer + end + + local function createShaderPlasmaTest() + local uniformCenter = 0 + local uniformResolution = 0 + local time = 0 + local squareVertexPositionBuffer = {} + local plasmaLayer = CCLayer:create() + + InitTitle(plasmaLayer) + --loadShaderVertex + local shader = CCGLProgram:create("Shaders/example_Plasma.vsh", "Shaders/example_Plasma.fsh") + + shader:addAttribute("aVertex", 0) + shader:link() + shader:updateUniforms() + + local program = shader:getProgram() + + local glNode = GLNode:create() + glNode:setContentSize(CCSizeMake(256,256)) + glNode:setAnchorPoint(ccp(0.5, 0.5)) + uniformCenter = glNode:_getUniformLocation(program,"center") + uniformResolution = glNode:_getUniformLocation( program, "resolution") + glNode:setShaderProgram(shader) + + local function initBuffer() + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + local vertices = { 256,256,0,256,256,0,0,0} + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function updatePlasma(fTime) + time = time + fTime + end + + local function plasmaDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + --Uniforms + shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2) + shader:setUniformLocationWith2f( uniformResolution, 256, 256) + + glNode:glEnableVertexAttribs(0x1) + + --Draw fullscreen Square + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + initBuffer() + plasmaLayer:scheduleUpdateWithPriorityLua(updatePlasma,0) + glNode:registerScriptDrawHandler(plasmaDraw) + time = 0 + plasmaLayer:addChild(glNode,-10) + glNode:setPosition( size.width/2, size.height/2) + return plasmaLayer + end + + local function createShaderFlowerTest() + local uniformCenter = 0 + local uniformResolution = 0 + local time = 0 + local squareVertexPositionBuffer = {} + local flowerLayer = CCLayer:create() + + InitTitle(flowerLayer) + --loadShaderVertex + local shader = CCGLProgram:create("Shaders/example_Flower.vsh", "Shaders/example_Flower.fsh") + + shader:addAttribute("aVertex", 0) + shader:link() + shader:updateUniforms() + + local program = shader:getProgram() + + local glNode = GLNode:create() + glNode:setContentSize(CCSizeMake(256,256)) + glNode:setAnchorPoint(ccp(0.5, 0.5)) + uniformCenter = glNode:_getUniformLocation(program,"center") + uniformResolution = glNode:_getUniformLocation( program, "resolution") + glNode:setShaderProgram(shader) + + local function initBuffer() + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + local vertices = { 256,256,0,256,256,0,0,0} + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function updateFlower(fTime) + time = time + fTime + end + + local function flowerDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + --Uniforms + shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2) + shader:setUniformLocationWith2f( uniformResolution, 256, 256) + + glNode:glEnableVertexAttribs(0x1) + + --Draw fullscreen Square + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + initBuffer() + flowerLayer:scheduleUpdateWithPriorityLua(updateFlower,0) + glNode:registerScriptDrawHandler(flowerDraw) + time = 0 + flowerLayer:addChild(glNode,-10) + glNode:setPosition( size.width/2, size.height/2) + return flowerLayer + end + + local function createShaderJuliaTest() + local uniformCenter = 0 + local uniformResolution = 0 + local time = 0 + local squareVertexPositionBuffer = {} + local juliaLayer = CCLayer:create() + + InitTitle(juliaLayer) + --loadShaderVertex + local shader = CCGLProgram:create("Shaders/example_Julia.vsh", "Shaders/example_Julia.fsh") + + shader:addAttribute("aVertex", 0) + shader:link() + shader:updateUniforms() + + local program = shader:getProgram() + + local glNode = GLNode:create() + glNode:setContentSize(CCSizeMake(256,256)) + glNode:setAnchorPoint(ccp(0.5, 0.5)) + uniformCenter = glNode:_getUniformLocation(program,"center") + uniformResolution = glNode:_getUniformLocation( program, "resolution") + glNode:setShaderProgram(shader) + + local function initBuffer() + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + local vertices = { 256,256,0,256,256,0,0,0} + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function updateJulia(fTime) + time = time + fTime + end + + local function juliaDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + --Uniforms + shader:setUniformLocationWith2f( uniformCenter, size.width/2, size.height/2) + shader:setUniformLocationWith2f( uniformResolution, 256, 256) + + glNode:glEnableVertexAttribs(0x1) + + --Draw fullscreen Square + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + initBuffer() + juliaLayer:scheduleUpdateWithPriorityLua(updateJulia,0) + glNode:registerScriptDrawHandler(juliaDraw) + time = 0 + juliaLayer:addChild(glNode,-10) + glNode:setPosition( size.width/2, size.height/2) + return juliaLayer + end + + local function createGLGetActiveTest() + local glGetActiveLayer = CCLayer:create() + InitTitle(glGetActiveLayer) + local sprite = CCSprite:create("Images/grossini.png") + sprite:setPosition( size.width/2, size.height/2) + glGetActiveLayer:addChild(sprite) + local glNode = GLNode:create() + glGetActiveLayer:addChild(glNode,-10) + local scheduler = CCDirector:sharedDirector():getScheduler() + + local function getCurrentResult() + local var = {} + local glProgam = tolua.cast(sprite:getShaderProgram(),"CCGLProgram") + if nil ~= glProgam then + local p = glProgam:getProgram() + local aaSize,aaType,aaName = glNode:_getActiveAttrib(p,0) + local strFmt = "size:"..aaSize.." type:"..aaType.." name:"..aaName + print(strFmt) + local auSize,auType,auName = glNode:_getActiveUniform(p,0) + strFmt = "size:"..auSize.." type:"..auType.." name:"..auName + print(strFmt) + local shadersTable = glNode:_getAttachedShaders(p) + if type(shadersTable) == "table" then + local count = table.getn(shadersTable) + local i = 1 + strFmt = "" + for i=1, count do + strFmt = strFmt..shadersTable[i].." " + end + print(strFmt) + end + + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + end + end + + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + schedulEntry = scheduler:scheduleScriptFunc(getCurrentResult, 0.5, false) + + return glGetActiveLayer + end + + --Have problem + local function createTexImage2DTest() + local texture = {} + local squareVertexPositionBuffer = {} + local squareVertexTextureBuffer = {} + local texImage2dLayer = CCLayer:create() + InitTitle(texImage2dLayer) + local glNode = GLNode:create() + texImage2dLayer:addChild(glNode, 10) + glNode:setPosition(size.width/2, size.height/2) + glNode:setContentSize(CCSizeMake(128,128)) + glNode:setAnchorPoint(ccp(0.5,0.5)) + local shaderCache = CCShaderCache:getInstance() + local shader = shaderCache:getProgram("ShaderPositionTexture") + local function initGL() + texture.texture_id = glNode:_createTexture() + glNode:_bindTexture(GLConstant.TEXTURE_2D,texture.texture_id ) + local pixels = {} + local i = 1 + while i <= 4096 do + pixels[i] = math.floor(i / 4) + i = i + 1 + pixels[i] = math.floor(i / 16) + i = i + 1 + pixels[i] = math.floor(i / 8) + i = i + 1 + pixels[i] = 255 + i = i + 1 + end + + glNode:_texImage2D(GLConstant.TEXTURE_2D, 0, GLConstant.RGBA, 32, 32, 0, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, 4096,pixels) + print(glNode:getError()) + glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER, GLConstant.NEAREST) + glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER, GLConstant.NEAREST) + glNode:_bindTexture(GLConstant.TEXTURE_2D, 0) + + --Square + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) + local vertices = { 128, 128, 0, 128, 128, 0, 0, 0 } + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + + squareVertexTextureBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id) + local texcoords = { 1, 1, 0, 1, 1, 0, 0, 0 } + glNode:bufferData(GLConstant.ARRAY_BUFFER,8,texcoords,GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + + local function TexImage2DDraw() + if nil ~= shader then + shader:use() + shader:setUniformsForBuiltins() + + glNode:_bindTexture(GLConstant.TEXTURE_2D, texture.texture_id) + glNode:glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_TEX_COORDS or CCConstants.VERTEX_ATTRIB_FLAG_POSITION) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION,2,GLConstant.FLOAT,false,0,0) + + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_TEX_COORDS,2,GLConstant.FLOAT,false,0,0) + + glNode:drawArrays(GLConstant.TRIANGLE_STRIP,0,4) + + glNode:_bindTexture(GLConstant.TEXTURE_2D,0) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) + end + end + + initGL() + glNode:registerScriptDrawHandler(TexImage2DDraw) + return texImage2dLayer + end + + local function CreateSupportedExtensionsLayer() + local extensionsLayer = CCLayer:create() + InitTitle(extensionsLayer) + local glNode = GLNode:create() + extensionsLayer:addChild(glNode,-10) + local supportExtensions = glNode:getSupportedExtensions() + if type(supportExtensions) ~= "table" then + print("error:return value not table") + return + end + local count = table.getn(supportExtensions) + local i = 1 + for i=1,count do + print(supportExtensions[i]) + end + + return extensionsLayer + end + + local function CreateReadPixelsTest() + local readPixelsLayer = CCLayer:create() + InitTitle(readPixelsLayer) + local glNode = GLNode:create() + readPixelsLayer:addChild(glNode,-10) + + local x = size.width + local y = size.height + + local blue = CCLayerColor:create(ccc4(0, 0, 255, 255)) + local red = CCLayerColor:create(ccc4(255, 0, 0, 255)) + local green = CCLayerColor:create(ccc4(0, 255, 0, 255)) + local white = CCLayerColor:create(ccc4(255, 255, 255, 255)) + + blue:setScale(0.5) + blue:setPosition(-x / 4, -y / 4) + + red:setScale(0.5) + red:setPosition(x / 4, -y / 4) + + green:setScale(0.5) + green:setPosition(-x / 4, y / 4) + + white:setScale(0.5) + white:setPosition(x / 4, y / 4) + + readPixelsLayer:addChild(blue,10) + readPixelsLayer:addChild(white,11) + readPixelsLayer:addChild(green,12) + readPixelsLayer:addChild(red,13) + + local scheduler = CCDirector:sharedDirector():getScheduler() + + local function getCurrentResult() + local x = size.width + local y = size.height + + local pixelCount = 4 + local i = 1 + local strFmt = "" + --blue + local bPixels = glNode:readPixels(0, 0, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount) + for i=1,pixelCount do + local strTmp = string.format("%d:%d ",i,bPixels[i]) + strFmt = strFmt .. strTmp + end + print(strFmt) + strFmt = "" + --red + local rPixels = glNode:readPixels(x-1, 0, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount) + for i=1,pixelCount do + local strTmp = string.format("%d:%d ",i,rPixels[i]) + strFmt = strFmt .. strTmp + end + print(strFmt) + strFmt = "" + --green + local gPixels = glNode:readPixels(0, y-1, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount) + for i=1,pixelCount do + local strTmp = string.format("%d:%d ",i,gPixels[i]) + strFmt = strFmt .. strTmp + end + print(strFmt) + strFmt = "" + --white + local wPixels = glNode:readPixels(x-1, y-1, 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, pixelCount) + for i=1,pixelCount do + local strTmp = string.format("%d:%d ",i,wPixels[i]) + strFmt = strFmt .. strTmp + end + print(strFmt) + + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + end + + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + + schedulEntry = scheduler:scheduleScriptFunc(getCurrentResult, 0.5, false) + + return readPixelsLayer + end + + local function createClearTest() + local clearLayer = CCLayer:create() + InitTitle(clearLayer) + + local blue = CCLayerColor:create(ccc4(0, 0, 255, 255)) + clearLayer:addChild( blue, 1 ) + + local glNode = GLNode:create() + clearLayer:addChild(glNode,10) + --glNode:init() + local scheduler = CCDirector:sharedDirector():getScheduler() + + local function clearDraw() + glNode:clear(GLConstant.COLOR_BUFFER_BIT) + end + + local function getCurrentResult() + + local pixels = glNode:readPixels(math.floor(size.width/2), math.floor(size.height/2), 1, 1, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, 4) + local strFmt = "" + for i=1,4 do + local strTmp = string.format("%d:%d ",i,pixels[i]) + strFmt = strFmt .. strTmp + end + print(strFmt) + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + end + glNode:setPosition( size.width/2, size.height/2 ) + glNode:registerScriptDrawHandler(clearDraw) + + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + + schedulEntry = scheduler:scheduleScriptFunc(getCurrentResult, 0.5, false) + return clearLayer + end + + local function createNodeWebGLAPITest() + local nodeWebGLAPILayer = CCLayer:create() + InitTitle(nodeWebGLAPILayer) + local glNode = GLNode:create() + nodeWebGLAPILayer:addChild(glNode,10) + local shaderProgram = {} + local triangleVertexPositionBuffer = {} + local triangleVertexColorBuffer = {} + local squareVertexPositionBuffer = {} + local squareVertexColorBuffer = {} + local pMatrix = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1} + local mvMatrix = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1} + + local vsh = "\n".."attribute vec3 aVertexPosition;\n".."attribute vec4 aVertexColor;\n".. + "uniform mat4 uMVMatrix;\n".."uniform mat4 uPMatrix;\n".."varying vec4 vColor;\n".. + "void main(void) {\n".." gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n".." vColor = aVertexColor;\n".. + "}\n" + + local fsh = "\n".. + "#ifdef GL_ES\n".. + "precision mediump float;\n".. + "#endif\n".. + "varying vec4 vColor;\n".. + "void main(void) {\n".. + " gl_FragColor = vColor;\n".. + "}\n" + + local function compileShader(source,type) + local shader + if type == "fragment" then + shader = glNode:_createShader(GLConstant.FRAGMENT_SHADER) + else + shader = glNode:_createShader(GLConstant.VERTEX_SHADER) + end + glNode:_shaderSource(shader,source) + glNode:_compileShader(shader) + local ret = glNode:_getShaderParameter(shader,GLConstant.COMPILE_STATUS) + if not ret then + --throw + print("Could not compile "..type.." shader") + end + return shader + end + + local function initBuffers() + triangleVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id) + local vertices = { + 0.0, 1.0, 0.0, + -1.0, -1.0, 0.0, + 1.0, -1.0, 0.0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, 9, vertices,GLConstant.STATIC_DRAW) + triangleVertexPositionBuffer.itemSize = 3 + triangleVertexPositionBuffer.numItems = 3 + + triangleVertexColorBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id) + local colors = { + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, 12, colors , GLConstant.STATIC_DRAW) + triangleVertexColorBuffer.itemSize = 4 + triangleVertexColorBuffer.numItems = 3 + + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) + vertices = { + 1.0, 1.0, 0.0, + -1.0, 1.0, 0.0, + 1.0, -1.0, 0.0, + -1.0, -1.0, 0.0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, 12, vertices,GLConstant.STATIC_DRAW) + squareVertexPositionBuffer.itemSize = 3 + squareVertexPositionBuffer.numItems = 4 + + squareVertexColorBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id) + colors = { + 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, 16,colors, GLConstant.STATIC_DRAW) + squareVertexColorBuffer.itemSize = 4 + squareVertexColorBuffer.numItems = 4 + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function setMatrixUniforms() + glNode:uniformMatrix4fv(shaderProgram.pMatrixUniform,false,table.getn(pMatrix), pMatrix) + glNode:uniformMatrix4fv(shaderProgram.mvMatrixUniform,false,table.getn(mvMatrix),mvMatrix) + end + + local function nodeWebGLDraw() + glNode:_useProgram(shaderProgram.program_id) + glNode:uniformMatrix4fv(shaderProgram.pMatrixUniform,false,table.getn(pMatrix),pMatrix) + glNode:uniformMatrix4fv(shaderProgram.mvMatrixUniform,false,table.getn(mvMatrix),mvMatrix) + + glNode:enableVertexAttribArray(shaderProgram.vertexPositionAttribute) + glNode:enableVertexAttribArray(shaderProgram.vertexColorAttribute) + + --Draw + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(shaderProgram.vertexPositionAttribute, squareVertexPositionBuffer.itemSize, GLConstant.FLOAT, false, 0, 0) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id) + glNode:vertexAttribPointer(shaderProgram.vertexColorAttribute, squareVertexColorBuffer.itemSize, GLConstant.FLOAT, false, 0, 0) + + setMatrixUniforms() + + glNode:drawArrays(GLConstant.TRIANGLE_STRIP, 0, squareVertexPositionBuffer.numItems) + + --DrawArray + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(shaderProgram.vertexPositionAttribute, triangleVertexPositionBuffer.itemSize, GLConstant.FLOAT, false, 0, 0) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id) + glNode:vertexAttribPointer(shaderProgram.vertexColorAttribute, triangleVertexColorBuffer.itemSize, GLConstant.FLOAT, false, 0, 0) + + glNode:drawArrays(GLConstant.TRIANGLES, 0, triangleVertexPositionBuffer.numItems) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local fshader = compileShader(fsh, 'fragment') + local vshader = compileShader(vsh, 'vertex') + shaderProgram.program_id = glNode:_createProgram() + glNode:_attachShader(shaderProgram.program_id,vshader) + glNode:_attachShader(shaderProgram.program_id,fshader) + glNode:_linkProgram(shaderProgram.program_id) + if not glNode:_getProgramParameter(shaderProgram.program_id, GLConstant.LINK_STATUS) then + --throw + print("Could not initialise shaders") + end + glNode:_useProgram(shaderProgram.program_id) + + shaderProgram.vertexPositionAttribute = glNode:_getAttribLocation(shaderProgram.program_id,"aVertexPosition") + glNode:enableVertexAttribArray(shaderProgram.vertexPositionAttribute) + + shaderProgram.vertexColorAttribute = glNode:_getAttribLocation(shaderProgram.program_id,"aVertexColor") + glNode:enableVertexAttribArray(shaderProgram.vertexColorAttribute) + + shaderProgram.pMatrixUniform = glNode:_getUniformLocation(shaderProgram.program_id, "uPMatrix") + shaderProgram.mvMatrixUniform = glNode:_getUniformLocation(shaderProgram.program_id, "uMVMatrix") + + initBuffers() + + glNode:registerScriptDrawHandler(nodeWebGLDraw) + + return nodeWebGLAPILayer + end + + local function createGLNodeCCAPITest() + local nodeCCAPILayer = CCLayer:create() + InitTitle(nodeCCAPILayer) + local glNode = GLNode:create() + nodeCCAPILayer:addChild(glNode,10) + local shader = CCShaderCache:getInstance():getProgram("ShaderPositionColor") + local triangleVertexPositionBuffer = {} + local triangleVertexColorBuffer = {} + local squareVertexPositionBuffer = {} + local squareVertexColorBuffer = {} + + local function initBuffers() + triangleVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id) + local vertices = { + size.width / 2, size.height, + 0, 0, + size.width, 0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(vertices), vertices, GLConstant.STATIC_DRAW) + + triangleVertexColorBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id) + local colors = { + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0, 1.0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(colors),colors, GLConstant.STATIC_DRAW) + + --Square + squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) + vertices = { + size.width, size.height, + 0, size.height, + size.width, 0, + 0, 0 + } + glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(vertices), vertices, GLConstant.STATIC_DRAW) + + squareVertexColorBuffer.buffer_id = glNode:_createBuffer() + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id) + colors = { + 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0, + 0.0, 0.0, 1.0, 1.0 + }; + glNode:bufferData(GLConstant.ARRAY_BUFFER, table.getn(colors), colors, GLConstant.STATIC_DRAW) + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + end + + local function GLNodeCCAPIDraw() + shader:use() + shader:setUniformsForBuiltins() + glNode:glEnableVertexAttribs(CCConstants.VERTEX_ATTRIB_FLAG_COLOR or CCConstants.VERTEX_ATTRIB_FLAG_POSITION) + + -- + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexColorBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_COLOR, 4, GLConstant.FLOAT, false, 0, 0) + + glNode:drawArrays(GLConstant.TRIANGLE_STRIP, 0, 4) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexPositionBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_POSITION, 2, GLConstant.FLOAT, false, 0, 0) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, triangleVertexColorBuffer.buffer_id) + glNode:vertexAttribPointer(CCConstants.VERTEX_ATTRIB_COLOR, 4, GLConstant.FLOAT, false, 0, 0) + + glNode:drawArrays(GLConstant.TRIANGLE_STRIP, 0, 3) + + glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, 0) + + end + + initBuffers() + glNode:registerScriptDrawHandler(GLNodeCCAPIDraw) + + return nodeCCAPILayer + end + + local function createGLTexParamterTest() + local glTexParamLayer = CCLayer:create() + InitTitle(glTexParamLayer) + local glNode = GLNode:create() + glTexParamLayer:addChild(glNode,10) + local function getTexValues() + glNode:_bindTexture(GLConstant.TEXTURE_2D, 0) + glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER, GLConstant.NEAREST) + glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER, GLConstant.NEAREST) + glNode:texParameteri( GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S, GLConstant.CLAMP_TO_EDGE ) + glNode:texParameteri( GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S, GLConstant.CLAMP_TO_EDGE ) + + local mag = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER) + local min = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER) + local w_s = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S) + local w_t = glNode:getTexParameter(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_WRAP_S) + local strFmt = string.format("%d %d %d %d",mag,min,w_s,w_t) + print(strFmt) + end + getTexValues() + return glTexParamLayer + end + + local function createGetUniformTest() + local getUniformLayer = CCLayer:create() + InitTitle(getUniformLayer) + local glNode = GLNode:create() + getUniformLayer:addChild(glNode,10) + local pMatrix = {1,2,3,4, 4,3,2,1, 1,2,4,8, 1.1,1.2,1.3,1.4} + + local function runTest() + local shader = CCShaderCache:getInstance():getProgram("ShaderPositionTextureColor") + local program = shader:getProgram() + + shader:use() + + local loc = glNode:_getUniformLocation( program, "CC_MVPMatrix") + + glNode:uniformMatrix4fv(loc, false, table.getn(pMatrix), pMatrix) + + local uniformTable = glNode:_getUniform( program, loc ) + local count = table.getn(uniformTable) + local strFmt = "" + for i=1,count do + local strTmp = string.format("%d: %.16f ",i - 1, uniformTable[i]) + strFmt = strFmt..strTmp + end + print(strFmt) + end + + runTest() + + return getUniformLayer + end + + local function createLayerByCurCase(curCase) + if 0 == curCase then + return createShaderRetroEffect() + elseif 1 == curCase then + return createShaderMajoriTest() + elseif 2 == curCase then + return createShaderMandelbrotTest() + elseif 3 == curCase then + return createShaderHeartTest() + elseif 4 == curCase then + return createShaderPlasmaTest() + elseif 5 == curCase then + return createShaderFlowerTest() + elseif 6 == curCase then + return createShaderJuliaTest() + elseif 7 == curCase then + return createGLGetActiveTest() + elseif 8 == curCase then + return createTexImage2DTest() + elseif 9 == curCase then + return CreateSupportedExtensionsLayer() + elseif 10 == curCase then + return CreateReadPixelsTest() + elseif 11 == curCase then + return createClearTest() + elseif 12 == curCase then + return createNodeWebGLAPITest() + elseif 13 == curCase then + return createGLNodeCCAPITest() + elseif 14 == curCase then + return createGLTexParamterTest() + elseif 15 == curCase then + return createGetUniformTest() + end + end + + function ShowCurrentTest() + local curScene = CCScene:create() + if nil ~= curScene then + if nil ~= curLayer then + local scheduler = CCDirector:sharedDirector():getScheduler() + if nil ~= schedulEntry then + scheduler:unscheduleScriptEntry(schedulEntry) + end + end + curLayer = createLayerByCurCase(curCase) + if nil ~= curLayer then + curScene:addChild(curLayer) + curLayer:addChild(OrderCallbackMenu(),15) + curScene:addChild(CreateBackMenuItem()) + CCDirector:sharedDirector():replaceScene(curScene) + end + end + end + curLayer = createLayerByCurCase(curCase) + curLayer:addChild(OrderCallbackMenu(),15) + return curLayer +end + +function OpenGLTestMain() + local scene = CCScene:create() + scene:addChild(OpenGLTestMainLayer()) + scene:addChild(CreateBackMenuItem()) + return scene +end diff --git a/samples/Lua/TestLua/Resources/luaScript/mainMenu.lua b/samples/Lua/TestLua/Resources/luaScript/mainMenu.lua index 85576ac2ef..37e2fe38c7 100644 --- a/samples/Lua/TestLua/Resources/luaScript/mainMenu.lua +++ b/samples/Lua/TestLua/Resources/luaScript/mainMenu.lua @@ -35,6 +35,7 @@ require "luaScript/BugsTest/BugsTest" require "luaScript/ExtensionTest/ExtensionTest" require "luaScript/AccelerometerTest/AccelerometerTest" require "luaScript/KeypadTest/KeypadTest" +require "luaScript/OpenGLTest/OpenGLTest" local LINE_SPACE = 40 @@ -87,7 +88,8 @@ local _allTests = { { isSupported = false, name = "TextureCacheTest" , create_func= TextureCacheTestMain }, { isSupported = true, name = "ExtensionsTest" , create_func= ExtensionsTestMain }, { isSupported = false, name = "ShaderTest" , create_func= ShaderTestMain }, - { isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain } + { isSupported = false, name = "MutiTouchTest" , create_func= MutiTouchTestMain }, + { isSupported = true, name = "OpenGLTest" , create_func= OpenGLTestMain } } local TESTS_COUNT = table.getn(_allTests) diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id index 861077555b..dea58677f2 100644 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -065e7159e1cb93cc78cec22a648e4f82465fd848 \ No newline at end of file +1fde9badf7ef3c49ce55760ac6a3d8a8f69ff309 \ No newline at end of file diff --git a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id index 590fa7f0f3..0779bd3239 100644 --- a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id @@ -1 +1 @@ -5f7a7be1a869fb3302b56d48463bdb61a06550f7 \ No newline at end of file +1778c5b2673e902d72ddcfcae4f9825375d4a333 \ No newline at end of file diff --git a/scripting/lua/script/Cocos2dConstants.lua b/scripting/lua/script/Cocos2dConstants.lua new file mode 100644 index 0000000000..55828a8f51 --- /dev/null +++ b/scripting/lua/script/Cocos2dConstants.lua @@ -0,0 +1,178 @@ +local CCConstants = {} + +CCConstants.SPRITE_INDEX_NOT_INITIALIZED = 0xffffffff +CCConstants.TMX_ORIENTATION_HEX = 0x1 +CCConstants.TMX_ORIENTATION_ISO = 0x2 +CCConstants.TMX_ORIENTATION_ORTHO = 0x0 +CCConstants.Z_COMPRESSION_BZIP2 = 0x1 +CCConstants.Z_COMPRESSION_GZIP = 0x2 +CCConstants.Z_COMPRESSION_NONE = 0x3 +CCConstants.Z_COMPRESSION_ZLIB = 0x0 +CCConstants.BLEND_DST = 0x303 +CCConstants.BLEND_SRC = 0x1 +CCConstants.DIRECTOR_IOS_USE_BACKGROUND_THREAD = 0x0 +CCConstants.DIRECTOR_MAC_THREAD = 0x0 +CCConstants.DIRECTOR_STATS_INTERVAL = 0.1 +CCConstants.ENABLE_BOX2_D_INTEGRATION = 0x0 +CCConstants.ENABLE_DEPRECATED = 0x1 +CCConstants.ENABLE_GL_STATE_CACHE = 0x1 +CCConstants.ENABLE_PROFILERS = 0x0 +CCConstants.ENABLE_STACKABLE_ACTIONS = 0x1 +CCConstants.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0x0 +CCConstants.GL_ALL = 0x0 +CCConstants.LABELATLAS_DEBUG_DRAW = 0x0 +CCConstants.LABELBMFONT_DEBUG_DRAW = 0x0 +CCConstants.MAC_USE_DISPLAY_LINK_THREAD = 0x0 +CCConstants.MAC_USE_MAIN_THREAD = 0x2 +CCConstants.MAC_USE_OWN_THREAD = 0x1 +CCConstants.NODE_RENDER_SUBPIXEL = 0x1 +CCConstants.PVRMIPMAP_MAX = 0x10 +CCConstants.SPRITEBATCHNODE_RENDER_SUBPIXEL = 0x1 +CCConstants.SPRITE_DEBUG_DRAW = 0x0 +CCConstants.TEXTURE_ATLAS_USE_TRIANGLE_STRIP = 0x0 +CCConstants.TEXTURE_ATLAS_USE_VAO = 0x1 +CCConstants.USE_L_A88_LABELS = 0x1 +CCConstants.ACTION_TAG_INVALID = -1 +CCConstants.DEVICE_MAC = 0x6 +CCConstants.DEVICE_MAC_RETINA_DISPLAY = 0x7 +CCConstants.DEVICEI_PAD = 0x4 +CCConstants.DEVICEI_PAD_RETINA_DISPLAY = 0x5 +CCConstants.DEVICEI_PHONE = 0x0 +CCConstants.DEVICEI_PHONE5 = 0x2 +CCConstants.DEVICEI_PHONE5_RETINA_DISPLAY = 0x3 +CCConstants.DEVICEI_PHONE_RETINA_DISPLAY = 0x1 +CCConstants.DIRECTOR_PROJECTION2_D = 0x0 +CCConstants.DIRECTOR_PROJECTION3_D = 0x1 +CCConstants.DIRECTOR_PROJECTION_CUSTOM = 0x2 +CCConstants.DIRECTOR_PROJECTION_DEFAULT = 0x1 +CCConstants.FILE_UTILS_SEARCH_DIRECTORY_MODE = 0x1 +CCConstants.FILE_UTILS_SEARCH_SUFFIX_MODE = 0x0 +CCConstants.FLIPED_ALL = 0xe0000000 +CCConstants.FLIPPED_MASK = 0x1fffffff +CCConstants.IMAGE_FORMAT_JPEG = 0x0 +CCConstants.IMAGE_FORMAT_PNG = 0x1 +CCConstants.ITEM_SIZE = 0x20 +CCConstants.LABEL_AUTOMATIC_WIDTH = -1 +CCConstants.LINE_BREAK_MODE_CHARACTER_WRAP = 0x1 +CCConstants.LINE_BREAK_MODE_CLIP = 0x2 +CCConstants.LINE_BREAK_MODE_HEAD_TRUNCATION = 0x3 +CCConstants.LINE_BREAK_MODE_MIDDLE_TRUNCATION = 0x5 +CCConstants.LINE_BREAK_MODE_TAIL_TRUNCATION = 0x4 +CCConstants.LINE_BREAK_MODE_WORD_WRAP = 0x0 +CCConstants.MAC_VERSION_10_6 = 0xa060000 +CCConstants.MAC_VERSION_10_7 = 0xa070000 +CCConstants.MAC_VERSION_10_8 = 0xa080000 +CCConstants.MENU_HANDLER_PRIORITY = -128 +CCConstants.MENU_STATE_TRACKING_TOUCH = 0x1 +CCConstants.MENU_STATE_WAITING = 0x0 +CCConstants.NODE_TAG_INVALID = -1 +CCConstants.PARTICLE_DURATION_INFINITY = -1 +CCConstants.PARTICLE_MODE_GRAVITY = 0x0 +CCConstants.PARTICLE_MODE_RADIUS = 0x1 +CCConstants.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1 +CCConstants.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1 +CCConstants.POSITION_TYPE_FREE = 0x0 +CCConstants.POSITION_TYPE_GROUPED = 0x2 +CCConstants.POSITION_TYPE_RELATIVE = 0x1 +CCConstants.PRIORITY_NON_SYSTEM_MIN = -2147483647 +CCConstants.PRIORITY_SYSTEM = -2147483648 +CCConstants.PROGRESS_TIMER_TYPE_BAR = 0x1 +CCConstants.PROGRESS_TIMER_TYPE_RADIAL = 0x0 +CCConstants.REPEAT_FOREVER = 0xfffffffe +CCConstants.RESOLUTION_MAC = 0x1 +CCConstants.RESOLUTION_MAC_RETINA_DISPLAY = 0x2 +CCConstants.RESOLUTION_UNKNOWN = 0x0 +CCConstants.TMX_TILE_DIAGONAL_FLAG = 0x20000000 +CCConstants.TMX_TILE_HORIZONTAL_FLAG = 0x80000000 +CCConstants.TMX_TILE_VERTICAL_FLAG = 0x40000000 +CCConstants.TEXT_ALIGNMENT_CENTER = 0x1 +CCConstants.TEXT_ALIGNMENT_LEFT = 0x0 +CCConstants.TEXT_ALIGNMENT_RIGHT = 0x2 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_A8 = 0x3 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_A_I88 = 0x5 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_DEFAULT = 0x0 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_I8 = 0x4 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_PVRTC2 = 0x9 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_PVRTC4 = 0x8 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_RG_B565 = 0x2 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_RGB5_A1 = 0x7 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_RG_B888 = 0x1 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444 = 0x6 +CCConstants.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888 = 0x0 +CCConstants.TOUCHES_ALL_AT_ONCE = 0x0 +CCConstants.TOUCHES_ONE_BY_ONE = 0x1 +CCConstants.TRANSITION_ORIENTATION_DOWN_OVER = 0x1 +CCConstants.TRANSITION_ORIENTATION_LEFT_OVER = 0x0 +CCConstants.TRANSITION_ORIENTATION_RIGHT_OVER = 0x1 +CCConstants.TRANSITION_ORIENTATION_UP_OVER = 0x0 +CCConstants.UNIFORM_COS_TIME = 0x5 +CCConstants.UNIFORM_MV_MATRIX = 0x1 +CCConstants.UNIFORM_MVP_MATRIX = 0x2 +CCConstants.UNIFORM_P_MATRIX = 0x0 +CCConstants.UNIFORM_RANDOM01 = 0x6 +CCConstants.UNIFORM_SAMPLER = 0x7 +CCConstants.UNIFORM_SIN_TIME = 0x4 +CCConstants.UNIFORM_TIME = 0x3 +CCConstants.UNIFORM_MAX = 0x8 +CCConstants.VERTEX_ATTRIB_FLAG_COLOR = 0x2 +CCConstants.VERTEX_ATTRIB_FLAG_NONE = 0x0 +CCConstants.VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = 0x7 +CCConstants.VERTEX_ATTRIB_FLAG_POSITION = 0x1 +CCConstants.VERTEX_ATTRIB_FLAG_TEX_COORDS = 0x4 +CCConstants.VERTEX_ATTRIB_COLOR = 0x1 +CCConstants.VERTEX_ATTRIB_MAX = 0x3 +CCConstants.VERTEX_ATTRIB_POSITION = 0x0 +CCConstants.VERTEX_ATTRIB_TEX_COORDS = 0x2 +CCConstants.VERTICAL_TEXT_ALIGNMENT_BOTTOM = 0x2 +CCConstants.VERTICAL_TEXT_ALIGNMENT_CENTER = 0x1 +CCConstants.VERTICAL_TEXT_ALIGNMENT_TOP = 0x0 +CCConstants.OS_VERSION_4_0 = 0x4000000 +CCConstants.OS_VERSION_4_0_1 = 0x4000100 +CCConstants.OS_VERSION_4_1 = 0x4010000 +CCConstants.OS_VERSION_4_2 = 0x4020000 +CCConstants.OS_VERSION_4_2_1 = 0x4020100 +CCConstants.OS_VERSION_4_3 = 0x4030000 +CCConstants.OS_VERSION_4_3_1 = 0x4030100 +CCConstants.OS_VERSION_4_3_2 = 0x4030200 +CCConstants.OS_VERSION_4_3_3 = 0x4030300 +CCConstants.OS_VERSION_4_3_4 = 0x4030400 +CCConstants.OS_VERSION_4_3_5 = 0x4030500 +CCConstants.OS_VERSION_5_0 = 0x5000000 +CCConstants.OS_VERSION_5_0_1 = 0x5000100 +CCConstants.OS_VERSION_5_1_0 = 0x5010000 +CCConstants.OS_VERSION_6_0_0 = 0x6000000 +CCConstants.ANIMATION_FRAME_DISPLAYED_NOTIFICATION = 'CCAnimationFrameDisplayedNotification' +CCConstants.CHIPMUNK_IMPORT = 'chipmunk.h' +CCConstants.ATTRIBUTE_NAME_COLOR = 'a_color' +CCConstants.ATTRIBUTE_NAME_POSITION = 'a_position' +CCConstants.ATTRIBUTE_NAME_TEX_COORD = 'a_texCoord' +CCConstants.SHADER_POSITION_COLOR = 'ShaderPositionColor' +CCConstants.SHADER_POSITION_LENGTH_TEXURE_COLOR = 'ShaderPositionLengthTextureColor' +CCConstants.SHADER_POSITION_TEXTURE = 'ShaderPositionTexture' +CCConstants.SHADER_POSITION_TEXTURE_A8_COLOR = 'ShaderPositionTextureA8Color' +CCConstants.SHADER_POSITION_TEXTURE_COLOR = 'ShaderPositionTextureColor' +CCConstants.SHADER_POSITION_TEXTURE_COLOR_ALPHA_TEST = 'ShaderPositionTextureColorAlphaTest' +CCConstants.SHADER_POSITION_TEXTURE_U_COLOR = 'ShaderPositionTexture_uColor' +CCConstants.SHADER_POSITION_U_COLOR = 'ShaderPosition_uColor' +CCConstants.UNIFORM_ALPHA_TEST_VALUE_S = 'CC_AlphaValue' +CCConstants.UNIFORM_COS_TIME_S = 'CC_CosTime' +CCConstants.UNIFORM_MV_MATRIX_S = 'CC_MVMatrix' +CCConstants.UNIFORM_MVP_MATRIX_S = 'CC_MVPMatrix' +CCConstants.UNIFORM_P_MATRIX_S = 'CC_PMatrix' +CCConstants.UNIFORM_RANDOM01_S = 'CC_Random01' +CCConstants.UNIFORM_SAMPLER_S = 'CC_Texture0' +CCConstants.UNIFORM_SIN_TIME_S = 'CC_SinTime' +CCConstants.UNIFORM_TIME_S = 'CC_Time' + + +local modename = "CCConstants" +local CCConstantsproxy = {} +local CCConstantsMt = { + __index = CCConstants, + __newindex = function (t ,k ,v) + print("attemp to update a read-only table") + end +} +setmetatable(CCConstantsproxy,CCConstantsMt) +_G[modename] = CCConstantsproxy +package.loaded[modename] = CCConstantsproxy diff --git a/scripting/lua/script/OpenglConstants.lua b/scripting/lua/script/OpenglConstants.lua new file mode 100644 index 0000000000..661c496ca2 --- /dev/null +++ b/scripting/lua/script/OpenglConstants.lua @@ -0,0 +1,838 @@ +--Encapsulate opengl constants. +local GLConstant = {} + +GLConstant.GCCSO_SHADER_BINARY_FJ = 0x9260 +GLConstant._3DC_XY_AMD = 0x87fa +GLConstant._3DC_X_AMD = 0x87f9 +GLConstant.ACTIVE_ATTRIBUTES = 0x8b89 +GLConstant.ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8b8a +GLConstant.ACTIVE_PROGRAM_EXT = 0x8259 +GLConstant.ACTIVE_TEXTURE = 0x84e0 +GLConstant.ACTIVE_UNIFORMS = 0x8b86 +GLConstant.ACTIVE_UNIFORM_MAX_LENGTH = 0x8b87 +GLConstant.ALIASED_LINE_WIDTH_RANGE = 0x846e +GLConstant.ALIASED_POINT_SIZE_RANGE = 0x846d +GLConstant.ALL_COMPLETED_NV = 0x84f2 +GLConstant.ALL_SHADER_BITS_EXT = 0xffffffff +GLConstant.ALPHA = 0x1906 +GLConstant.ALPHA16F_EXT = 0x881c +GLConstant.ALPHA32F_EXT = 0x8816 +GLConstant.ALPHA8_EXT = 0x803c +GLConstant.ALPHA8_OES = 0x803c +GLConstant.ALPHA_BITS = 0xd55 +GLConstant.ALPHA_TEST_FUNC_QCOM = 0xbc1 +GLConstant.ALPHA_TEST_QCOM = 0xbc0 +GLConstant.ALPHA_TEST_REF_QCOM = 0xbc2 +GLConstant.ALREADY_SIGNALED_APPLE = 0x911a +GLConstant.ALWAYS = 0x207 +GLConstant.AMD_compressed_3DC_texture = 0x1 +GLConstant.AMD_compressed_ATC_texture = 0x1 +GLConstant.AMD_performance_monitor = 0x1 +GLConstant.AMD_program_binary_Z400 = 0x1 +GLConstant.ANGLE_depth_texture = 0x1 +GLConstant.ANGLE_framebuffer_blit = 0x1 +GLConstant.ANGLE_framebuffer_multisample = 0x1 +GLConstant.ANGLE_instanced_arrays = 0x1 +GLConstant.ANGLE_pack_reverse_row_order = 0x1 +GLConstant.ANGLE_program_binary = 0x1 +GLConstant.ANGLE_texture_compression_dxt3 = 0x1 +GLConstant.ANGLE_texture_compression_dxt5 = 0x1 +GLConstant.ANGLE_texture_usage = 0x1 +GLConstant.ANGLE_translated_shader_source = 0x1 +GLConstant.ANY_SAMPLES_PASSED_CONSERVATIVE_EXT = 0x8d6a +GLConstant.ANY_SAMPLES_PASSED_EXT = 0x8c2f +GLConstant.APPLE_copy_texture_levels = 0x1 +GLConstant.APPLE_framebuffer_multisample = 0x1 +GLConstant.APPLE_rgb_422 = 0x1 +GLConstant.APPLE_sync = 0x1 +GLConstant.APPLE_texture_format_BGRA8888 = 0x1 +GLConstant.APPLE_texture_max_level = 0x1 +GLConstant.ARM_mali_program_binary = 0x1 +GLConstant.ARM_mali_shader_binary = 0x1 +GLConstant.ARM_rgba8 = 0x1 +GLConstant.ARRAY_BUFFER = 0x8892 +GLConstant.ARRAY_BUFFER_BINDING = 0x8894 +GLConstant.ATC_RGBA_EXPLICIT_ALPHA_AMD = 0x8c93 +GLConstant.ATC_RGBA_INTERPOLATED_ALPHA_AMD = 0x87ee +GLConstant.ATC_RGB_AMD = 0x8c92 +GLConstant.ATTACHED_SHADERS = 0x8b85 +GLConstant.BACK = 0x405 +GLConstant.BGRA8_EXT = 0x93a1 +GLConstant.BGRA_EXT = 0x80e1 +GLConstant.BGRA_IMG = 0x80e1 +GLConstant.BINNING_CONTROL_HINT_QCOM = 0x8fb0 +GLConstant.BLEND = 0xbe2 +GLConstant.BLEND_COLOR = 0x8005 +GLConstant.BLEND_DST_ALPHA = 0x80ca +GLConstant.BLEND_DST_RGB = 0x80c8 +GLConstant.BLEND_EQUATION = 0x8009 +GLConstant.BLEND_EQUATION_ALPHA = 0x883d +GLConstant.BLEND_EQUATION_RGB = 0x8009 +GLConstant.BLEND_SRC_ALPHA = 0x80cb +GLConstant.BLEND_SRC_RGB = 0x80c9 +GLConstant.BLUE_BITS = 0xd54 +GLConstant.BOOL = 0x8b56 +GLConstant.BOOL_VEC2 = 0x8b57 +GLConstant.BOOL_VEC3 = 0x8b58 +GLConstant.BOOL_VEC4 = 0x8b59 +GLConstant.BUFFER = 0x82e0 +GLConstant.BUFFER_ACCESS_OES = 0x88bb +GLConstant.BUFFER_MAPPED_OES = 0x88bc +GLConstant.BUFFER_MAP_POINTER_OES = 0x88bd +GLConstant.BUFFER_OBJECT_EXT = 0x9151 +GLConstant.BUFFER_SIZE = 0x8764 +GLConstant.BUFFER_USAGE = 0x8765 +GLConstant.BYTE = 0x1400 +GLConstant.CCW = 0x901 +GLConstant.CLAMP_TO_BORDER_NV = 0x812d +GLConstant.CLAMP_TO_EDGE = 0x812f +GLConstant.COLOR_ATTACHMENT0 = 0x8ce0 +GLConstant.COLOR_ATTACHMENT0_NV = 0x8ce0 +GLConstant.COLOR_ATTACHMENT10_NV = 0x8cea +GLConstant.COLOR_ATTACHMENT11_NV = 0x8ceb +GLConstant.COLOR_ATTACHMENT12_NV = 0x8cec +GLConstant.COLOR_ATTACHMENT13_NV = 0x8ced +GLConstant.COLOR_ATTACHMENT14_NV = 0x8cee +GLConstant.COLOR_ATTACHMENT15_NV = 0x8cef +GLConstant.COLOR_ATTACHMENT1_NV = 0x8ce1 +GLConstant.COLOR_ATTACHMENT2_NV = 0x8ce2 +GLConstant.COLOR_ATTACHMENT3_NV = 0x8ce3 +GLConstant.COLOR_ATTACHMENT4_NV = 0x8ce4 +GLConstant.COLOR_ATTACHMENT5_NV = 0x8ce5 +GLConstant.COLOR_ATTACHMENT6_NV = 0x8ce6 +GLConstant.COLOR_ATTACHMENT7_NV = 0x8ce7 +GLConstant.COLOR_ATTACHMENT8_NV = 0x8ce8 +GLConstant.COLOR_ATTACHMENT9_NV = 0x8ce9 +GLConstant.COLOR_ATTACHMENT_EXT = 0x90f0 +GLConstant.COLOR_BUFFER_BIT = 0x4000 +GLConstant.COLOR_BUFFER_BIT0_QCOM = 0x1 +GLConstant.COLOR_BUFFER_BIT1_QCOM = 0x2 +GLConstant.COLOR_BUFFER_BIT2_QCOM = 0x4 +GLConstant.COLOR_BUFFER_BIT3_QCOM = 0x8 +GLConstant.COLOR_BUFFER_BIT4_QCOM = 0x10 +GLConstant.COLOR_BUFFER_BIT5_QCOM = 0x20 +GLConstant.COLOR_BUFFER_BIT6_QCOM = 0x40 +GLConstant.COLOR_BUFFER_BIT7_QCOM = 0x80 +GLConstant.COLOR_CLEAR_VALUE = 0xc22 +GLConstant.COLOR_EXT = 0x1800 +GLConstant.COLOR_WRITEMASK = 0xc23 +GLConstant.COMPARE_REF_TO_TEXTURE_EXT = 0x884e +GLConstant.COMPILE_STATUS = 0x8b81 +GLConstant.COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93bb +GLConstant.COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93b8 +GLConstant.COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93b9 +GLConstant.COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93ba +GLConstant.COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93bc +GLConstant.COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93bd +GLConstant.COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93b0 +GLConstant.COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93b1 +GLConstant.COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93b2 +GLConstant.COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93b3 +GLConstant.COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93b4 +GLConstant.COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93b5 +GLConstant.COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93b6 +GLConstant.COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93b7 +GLConstant.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8c03 +GLConstant.COMPRESSED_RGBA_PVRTC_2BPPV2_IMG = 0x9137 +GLConstant.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8c02 +GLConstant.COMPRESSED_RGBA_PVRTC_4BPPV2_IMG = 0x9138 +GLConstant.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83f1 +GLConstant.COMPRESSED_RGBA_S3TC_DXT3_ANGLE = 0x83f2 +GLConstant.COMPRESSED_RGBA_S3TC_DXT5_ANGLE = 0x83f3 +GLConstant.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8c01 +GLConstant.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8c00 +GLConstant.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83f0 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93db +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93d8 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93d9 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93da +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93dc +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93dd +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93d0 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93d1 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93d2 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93d3 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93d4 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93d5 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93d6 +GLConstant.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93d7 +GLConstant.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV = 0x8c4d +GLConstant.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV = 0x8c4e +GLConstant.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV = 0x8c4f +GLConstant.COMPRESSED_SRGB_S3TC_DXT1_NV = 0x8c4c +GLConstant.COMPRESSED_TEXTURE_FORMATS = 0x86a3 +GLConstant.CONDITION_SATISFIED_APPLE = 0x911c +GLConstant.CONSTANT_ALPHA = 0x8003 +GLConstant.CONSTANT_COLOR = 0x8001 +GLConstant.CONTEXT_FLAG_DEBUG_BIT = 0x2 +GLConstant.CONTEXT_ROBUST_ACCESS_EXT = 0x90f3 +GLConstant.COUNTER_RANGE_AMD = 0x8bc1 +GLConstant.COUNTER_TYPE_AMD = 0x8bc0 +GLConstant.COVERAGE_ALL_FRAGMENTS_NV = 0x8ed5 +GLConstant.COVERAGE_ATTACHMENT_NV = 0x8ed2 +GLConstant.COVERAGE_AUTOMATIC_NV = 0x8ed7 +GLConstant.COVERAGE_BUFFERS_NV = 0x8ed3 +GLConstant.COVERAGE_BUFFER_BIT_NV = 0x8000 +GLConstant.COVERAGE_COMPONENT4_NV = 0x8ed1 +GLConstant.COVERAGE_COMPONENT_NV = 0x8ed0 +GLConstant.COVERAGE_EDGE_FRAGMENTS_NV = 0x8ed6 +GLConstant.COVERAGE_SAMPLES_NV = 0x8ed4 +GLConstant.CPU_OPTIMIZED_QCOM = 0x8fb1 +GLConstant.CULL_FACE = 0xb44 +GLConstant.CULL_FACE_MODE = 0xb45 +GLConstant.CURRENT_PROGRAM = 0x8b8d +GLConstant.CURRENT_QUERY_EXT = 0x8865 +GLConstant.CURRENT_VERTEX_ATTRIB = 0x8626 +GLConstant.CW = 0x900 +GLConstant.DEBUG_CALLBACK_FUNCTION = 0x8244 +GLConstant.DEBUG_CALLBACK_USER_PARAM = 0x8245 +GLConstant.DEBUG_GROUP_STACK_DEPTH = 0x826d +GLConstant.DEBUG_LOGGED_MESSAGES = 0x9145 +GLConstant.DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 0x8243 +GLConstant.DEBUG_OUTPUT = 0x92e0 +GLConstant.DEBUG_OUTPUT_SYNCHRONOUS = 0x8242 +GLConstant.DEBUG_SEVERITY_HIGH = 0x9146 +GLConstant.DEBUG_SEVERITY_LOW = 0x9148 +GLConstant.DEBUG_SEVERITY_MEDIUM = 0x9147 +GLConstant.DEBUG_SEVERITY_NOTIFICATION = 0x826b +GLConstant.DEBUG_SOURCE_API = 0x8246 +GLConstant.DEBUG_SOURCE_APPLICATION = 0x824a +GLConstant.DEBUG_SOURCE_OTHER = 0x824b +GLConstant.DEBUG_SOURCE_SHADER_COMPILER = 0x8248 +GLConstant.DEBUG_SOURCE_THIRD_PARTY = 0x8249 +GLConstant.DEBUG_SOURCE_WINDOW_SYSTEM = 0x8247 +GLConstant.DEBUG_TYPE_DEPRECATED_BEHAVIOR = 0x824d +GLConstant.DEBUG_TYPE_ERROR = 0x824c +GLConstant.DEBUG_TYPE_MARKER = 0x8268 +GLConstant.DEBUG_TYPE_OTHER = 0x8251 +GLConstant.DEBUG_TYPE_PERFORMANCE = 0x8250 +GLConstant.DEBUG_TYPE_POP_GROUP = 0x826a +GLConstant.DEBUG_TYPE_PORTABILITY = 0x824f +GLConstant.DEBUG_TYPE_PUSH_GROUP = 0x8269 +GLConstant.DEBUG_TYPE_UNDEFINED_BEHAVIOR = 0x824e +GLConstant.DECR = 0x1e03 +GLConstant.DECR_WRAP = 0x8508 +GLConstant.DELETE_STATUS = 0x8b80 +GLConstant.DEPTH24_STENCIL8_OES = 0x88f0 +GLConstant.DEPTH_ATTACHMENT = 0x8d00 +GLConstant.DEPTH_BITS = 0xd56 +GLConstant.DEPTH_BUFFER_BIT = 0x100 +GLConstant.DEPTH_BUFFER_BIT0_QCOM = 0x100 +GLConstant.DEPTH_BUFFER_BIT1_QCOM = 0x200 +GLConstant.DEPTH_BUFFER_BIT2_QCOM = 0x400 +GLConstant.DEPTH_BUFFER_BIT3_QCOM = 0x800 +GLConstant.DEPTH_BUFFER_BIT4_QCOM = 0x1000 +GLConstant.DEPTH_BUFFER_BIT5_QCOM = 0x2000 +GLConstant.DEPTH_BUFFER_BIT6_QCOM = 0x4000 +GLConstant.DEPTH_BUFFER_BIT7_QCOM = 0x8000 +GLConstant.DEPTH_CLEAR_VALUE = 0xb73 +GLConstant.DEPTH_COMPONENT = 0x1902 +GLConstant.DEPTH_COMPONENT16 = 0x81a5 +GLConstant.DEPTH_COMPONENT16_NONLINEAR_NV = 0x8e2c +GLConstant.DEPTH_COMPONENT16_OES = 0x81a5 +GLConstant.DEPTH_COMPONENT24_OES = 0x81a6 +GLConstant.DEPTH_COMPONENT32_OES = 0x81a7 +GLConstant.DEPTH_EXT = 0x1801 +GLConstant.DEPTH_FUNC = 0xb74 +GLConstant.DEPTH_RANGE = 0xb70 +GLConstant.DEPTH_STENCIL_OES = 0x84f9 +GLConstant.DEPTH_TEST = 0xb71 +GLConstant.DEPTH_WRITEMASK = 0xb72 +GLConstant.DITHER = 0xbd0 +GLConstant.DMP_shader_binary = 0x1 +GLConstant.DONT_CARE = 0x1100 +GLConstant.DRAW_BUFFER0_NV = 0x8825 +GLConstant.DRAW_BUFFER10_NV = 0x882f +GLConstant.DRAW_BUFFER11_NV = 0x8830 +GLConstant.DRAW_BUFFER12_NV = 0x8831 +GLConstant.DRAW_BUFFER13_NV = 0x8832 +GLConstant.DRAW_BUFFER14_NV = 0x8833 +GLConstant.DRAW_BUFFER15_NV = 0x8834 +GLConstant.DRAW_BUFFER1_NV = 0x8826 +GLConstant.DRAW_BUFFER2_NV = 0x8827 +GLConstant.DRAW_BUFFER3_NV = 0x8828 +GLConstant.DRAW_BUFFER4_NV = 0x8829 +GLConstant.DRAW_BUFFER5_NV = 0x882a +GLConstant.DRAW_BUFFER6_NV = 0x882b +GLConstant.DRAW_BUFFER7_NV = 0x882c +GLConstant.DRAW_BUFFER8_NV = 0x882d +GLConstant.DRAW_BUFFER9_NV = 0x882e +GLConstant.DRAW_BUFFER_EXT = 0xc01 +GLConstant.DRAW_FRAMEBUFFER_ANGLE = 0x8ca9 +GLConstant.DRAW_FRAMEBUFFER_APPLE = 0x8ca9 +GLConstant.DRAW_FRAMEBUFFER_BINDING_ANGLE = 0x8ca6 +GLConstant.DRAW_FRAMEBUFFER_BINDING_APPLE = 0x8ca6 +GLConstant.DRAW_FRAMEBUFFER_BINDING_NV = 0x8ca6 +GLConstant.DRAW_FRAMEBUFFER_NV = 0x8ca9 +GLConstant.DST_ALPHA = 0x304 +GLConstant.DST_COLOR = 0x306 +GLConstant.DYNAMIC_DRAW = 0x88e8 +GLConstant.ELEMENT_ARRAY_BUFFER = 0x8893 +GLConstant.ELEMENT_ARRAY_BUFFER_BINDING = 0x8895 +GLConstant.EQUAL = 0x202 +GLConstant.ES_VERSION_2_0 = 0x1 +GLConstant.ETC1_RGB8_OES = 0x8d64 +GLConstant.ETC1_SRGB8_NV = 0x88ee +GLConstant.EXTENSIONS = 0x1f03 +GLConstant.EXT_blend_minmax = 0x1 +GLConstant.EXT_color_buffer_half_float = 0x1 +GLConstant.EXT_debug_label = 0x1 +GLConstant.EXT_debug_marker = 0x1 +GLConstant.EXT_discard_framebuffer = 0x1 +GLConstant.EXT_map_buffer_range = 0x1 +GLConstant.EXT_multi_draw_arrays = 0x1 +GLConstant.EXT_multisampled_render_to_texture = 0x1 +GLConstant.EXT_multiview_draw_buffers = 0x1 +GLConstant.EXT_occlusion_query_boolean = 0x1 +GLConstant.EXT_read_format_bgra = 0x1 +GLConstant.EXT_robustness = 0x1 +GLConstant.EXT_sRGB = 0x1 +GLConstant.EXT_separate_shader_objects = 0x1 +GLConstant.EXT_shader_framebuffer_fetch = 0x1 +GLConstant.EXT_shader_texture_lod = 0x1 +GLConstant.EXT_shadow_samplers = 0x1 +GLConstant.EXT_texture_compression_dxt1 = 0x1 +GLConstant.EXT_texture_filter_anisotropic = 0x1 +GLConstant.EXT_texture_format_BGRA8888 = 0x1 +GLConstant.EXT_texture_rg = 0x1 +GLConstant.EXT_texture_storage = 0x1 +GLConstant.EXT_texture_type_2_10_10_10_REV = 0x1 +GLConstant.EXT_unpack_subimage = 0x1 +GLConstant.FALSE = 0x0 +GLConstant.FASTEST = 0x1101 +GLConstant.FENCE_CONDITION_NV = 0x84f4 +GLConstant.FENCE_STATUS_NV = 0x84f3 +GLConstant.FIXED = 0x140c +GLConstant.FJ_shader_binary_GCCSO = 0x1 +GLConstant.FLOAT = 0x1406 +GLConstant.FLOAT_MAT2 = 0x8b5a +GLConstant.FLOAT_MAT3 = 0x8b5b +GLConstant.FLOAT_MAT4 = 0x8b5c +GLConstant.FLOAT_VEC2 = 0x8b50 +GLConstant.FLOAT_VEC3 = 0x8b51 +GLConstant.FLOAT_VEC4 = 0x8b52 +GLConstant.FRAGMENT_SHADER = 0x8b30 +GLConstant.FRAGMENT_SHADER_BIT_EXT = 0x2 +GLConstant.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8b8b +GLConstant.FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT = 0x8a52 +GLConstant.FRAMEBUFFER = 0x8d40 +GLConstant.FRAMEBUFFER_ATTACHMENT_ANGLE = 0x93a3 +GLConstant.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210 +GLConstant.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211 +GLConstant.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8cd1 +GLConstant.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8cd0 +GLConstant.FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = 0x8cd4 +GLConstant.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8cd3 +GLConstant.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8cd2 +GLConstant.FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT = 0x8d6c +GLConstant.FRAMEBUFFER_BINDING = 0x8ca6 +GLConstant.FRAMEBUFFER_COMPLETE = 0x8cd5 +GLConstant.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8cd6 +GLConstant.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8cd9 +GLConstant.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8cd7 +GLConstant.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE = 0x8d56 +GLConstant.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE = 0x8d56 +GLConstant.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT = 0x8d56 +GLConstant.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG = 0x9134 +GLConstant.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV = 0x8d56 +GLConstant.FRAMEBUFFER_UNDEFINED_OES = 0x8219 +GLConstant.FRAMEBUFFER_UNSUPPORTED = 0x8cdd +GLConstant.FRONT = 0x404 +GLConstant.FRONT_AND_BACK = 0x408 +GLConstant.FRONT_FACE = 0xb46 +GLConstant.FUNC_ADD = 0x8006 +GLConstant.FUNC_REVERSE_SUBTRACT = 0x800b +GLConstant.FUNC_SUBTRACT = 0x800a +GLConstant.GENERATE_MIPMAP_HINT = 0x8192 +GLConstant.GEQUAL = 0x206 +GLConstant.GPU_OPTIMIZED_QCOM = 0x8fb2 +GLConstant.GREATER = 0x204 +GLConstant.GREEN_BITS = 0xd53 +GLConstant.GUILTY_CONTEXT_RESET_EXT = 0x8253 +GLConstant.HALF_FLOAT_OES = 0x8d61 +GLConstant.HIGH_FLOAT = 0x8df2 +GLConstant.HIGH_INT = 0x8df5 +GLConstant.IMG_multisampled_render_to_texture = 0x1 +GLConstant.IMG_program_binary = 0x1 +GLConstant.IMG_read_format = 0x1 +GLConstant.IMG_shader_binary = 0x1 +GLConstant.IMG_texture_compression_pvrtc = 0x1 +GLConstant.IMG_texture_compression_pvrtc2 = 0x1 +GLConstant.IMPLEMENTATION_COLOR_READ_FORMAT = 0x8b9b +GLConstant.IMPLEMENTATION_COLOR_READ_TYPE = 0x8b9a +GLConstant.INCR = 0x1e02 +GLConstant.INCR_WRAP = 0x8507 +GLConstant.INFO_LOG_LENGTH = 0x8b84 +GLConstant.INNOCENT_CONTEXT_RESET_EXT = 0x8254 +GLConstant.INT = 0x1404 +GLConstant.INT_10_10_10_2_OES = 0x8df7 +GLConstant.INT_VEC2 = 0x8b53 +GLConstant.INT_VEC3 = 0x8b54 +GLConstant.INT_VEC4 = 0x8b55 +GLConstant.INVALID_ENUM = 0x500 +GLConstant.INVALID_FRAMEBUFFER_OPERATION = 0x506 +GLConstant.INVALID_OPERATION = 0x502 +GLConstant.INVALID_VALUE = 0x501 +GLConstant.INVERT = 0x150a +GLConstant.KEEP = 0x1e00 +GLConstant.KHR_debug = 0x1 +GLConstant.KHR_texture_compression_astc_ldr = 0x1 +GLConstant.LEQUAL = 0x203 +GLConstant.LESS = 0x201 +GLConstant.LINEAR = 0x2601 +GLConstant.LINEAR_MIPMAP_LINEAR = 0x2703 +GLConstant.LINEAR_MIPMAP_NEAREST = 0x2701 +GLConstant.LINES = 0x1 +GLConstant.LINE_LOOP = 0x2 +GLConstant.LINE_STRIP = 0x3 +GLConstant.LINE_WIDTH = 0xb21 +GLConstant.LINK_STATUS = 0x8b82 +GLConstant.LOSE_CONTEXT_ON_RESET_EXT = 0x8252 +GLConstant.LOW_FLOAT = 0x8df0 +GLConstant.LOW_INT = 0x8df3 +GLConstant.LUMINANCE = 0x1909 +GLConstant.LUMINANCE16F_EXT = 0x881e +GLConstant.LUMINANCE32F_EXT = 0x8818 +GLConstant.LUMINANCE4_ALPHA4_OES = 0x8043 +GLConstant.LUMINANCE8_ALPHA8_EXT = 0x8045 +GLConstant.LUMINANCE8_ALPHA8_OES = 0x8045 +GLConstant.LUMINANCE8_EXT = 0x8040 +GLConstant.LUMINANCE8_OES = 0x8040 +GLConstant.LUMINANCE_ALPHA = 0x190a +GLConstant.LUMINANCE_ALPHA16F_EXT = 0x881f +GLConstant.LUMINANCE_ALPHA32F_EXT = 0x8819 +GLConstant.MALI_PROGRAM_BINARY_ARM = 0x8f61 +GLConstant.MALI_SHADER_BINARY_ARM = 0x8f60 +GLConstant.MAP_FLUSH_EXPLICIT_BIT_EXT = 0x10 +GLConstant.MAP_INVALIDATE_BUFFER_BIT_EXT = 0x8 +GLConstant.MAP_INVALIDATE_RANGE_BIT_EXT = 0x4 +GLConstant.MAP_READ_BIT_EXT = 0x1 +GLConstant.MAP_UNSYNCHRONIZED_BIT_EXT = 0x20 +GLConstant.MAP_WRITE_BIT_EXT = 0x2 +GLConstant.MAX_3D_TEXTURE_SIZE_OES = 0x8073 +GLConstant.MAX_COLOR_ATTACHMENTS_NV = 0x8cdf +GLConstant.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8b4d +GLConstant.MAX_CUBE_MAP_TEXTURE_SIZE = 0x851c +GLConstant.MAX_DEBUG_GROUP_STACK_DEPTH = 0x826c +GLConstant.MAX_DEBUG_LOGGED_MESSAGES = 0x9144 +GLConstant.MAX_DEBUG_MESSAGE_LENGTH = 0x9143 +GLConstant.MAX_DRAW_BUFFERS_NV = 0x8824 +GLConstant.MAX_EXT = 0x8008 +GLConstant.MAX_FRAGMENT_UNIFORM_VECTORS = 0x8dfd +GLConstant.MAX_LABEL_LENGTH = 0x82e8 +GLConstant.MAX_MULTIVIEW_BUFFERS_EXT = 0x90f2 +GLConstant.MAX_RENDERBUFFER_SIZE = 0x84e8 +GLConstant.MAX_SAMPLES_ANGLE = 0x8d57 +GLConstant.MAX_SAMPLES_APPLE = 0x8d57 +GLConstant.MAX_SAMPLES_EXT = 0x8d57 +GLConstant.MAX_SAMPLES_IMG = 0x9135 +GLConstant.MAX_SAMPLES_NV = 0x8d57 +GLConstant.MAX_SERVER_WAIT_TIMEOUT_APPLE = 0x9111 +GLConstant.MAX_TEXTURE_IMAGE_UNITS = 0x8872 +GLConstant.MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84ff +GLConstant.MAX_TEXTURE_SIZE = 0xd33 +GLConstant.MAX_VARYING_VECTORS = 0x8dfc +GLConstant.MAX_VERTEX_ATTRIBS = 0x8869 +GLConstant.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8b4c +GLConstant.MAX_VERTEX_UNIFORM_VECTORS = 0x8dfb +GLConstant.MAX_VIEWPORT_DIMS = 0xd3a +GLConstant.MEDIUM_FLOAT = 0x8df1 +GLConstant.MEDIUM_INT = 0x8df4 +GLConstant.MIN_EXT = 0x8007 +GLConstant.MIRRORED_REPEAT = 0x8370 +GLConstant.MULTISAMPLE_BUFFER_BIT0_QCOM = 0x1000000 +GLConstant.MULTISAMPLE_BUFFER_BIT1_QCOM = 0x2000000 +GLConstant.MULTISAMPLE_BUFFER_BIT2_QCOM = 0x4000000 +GLConstant.MULTISAMPLE_BUFFER_BIT3_QCOM = 0x8000000 +GLConstant.MULTISAMPLE_BUFFER_BIT4_QCOM = 0x10000000 +GLConstant.MULTISAMPLE_BUFFER_BIT5_QCOM = 0x20000000 +GLConstant.MULTISAMPLE_BUFFER_BIT6_QCOM = 0x40000000 +GLConstant.MULTISAMPLE_BUFFER_BIT7_QCOM = 0x80000000 +GLConstant.MULTIVIEW_EXT = 0x90f1 +GLConstant.NEAREST = 0x2600 +GLConstant.NEAREST_MIPMAP_LINEAR = 0x2702 +GLConstant.NEAREST_MIPMAP_NEAREST = 0x2700 +GLConstant.NEVER = 0x200 +GLConstant.NICEST = 0x1102 +GLConstant.NONE = 0x0 +GLConstant.NOTEQUAL = 0x205 +GLConstant.NO_ERROR = 0x0 +GLConstant.NO_RESET_NOTIFICATION_EXT = 0x8261 +GLConstant.NUM_COMPRESSED_TEXTURE_FORMATS = 0x86a2 +GLConstant.NUM_PROGRAM_BINARY_FORMATS_OES = 0x87fe +GLConstant.NUM_SHADER_BINARY_FORMATS = 0x8df9 +GLConstant.NV_coverage_sample = 0x1 +GLConstant.NV_depth_nonlinear = 0x1 +GLConstant.NV_draw_buffers = 0x1 +GLConstant.NV_draw_instanced = 0x1 +GLConstant.NV_fbo_color_attachments = 0x1 +GLConstant.NV_fence = 0x1 +GLConstant.NV_framebuffer_blit = 0x1 +GLConstant.NV_framebuffer_multisample = 0x1 +GLConstant.NV_generate_mipmap_sRGB = 0x1 +GLConstant.NV_instanced_arrays = 0x1 +GLConstant.NV_read_buffer = 0x1 +GLConstant.NV_read_buffer_front = 0x1 +GLConstant.NV_read_depth = 0x1 +GLConstant.NV_read_depth_stencil = 0x1 +GLConstant.NV_read_stencil = 0x1 +GLConstant.NV_sRGB_formats = 0x1 +GLConstant.NV_shadow_samplers_array = 0x1 +GLConstant.NV_shadow_samplers_cube = 0x1 +GLConstant.NV_texture_border_clamp = 0x1 +GLConstant.NV_texture_compression_s3tc_update = 0x1 +GLConstant.NV_texture_npot_2D_mipmap = 0x1 +GLConstant.OBJECT_TYPE_APPLE = 0x9112 +GLConstant.OES_EGL_image = 0x1 +GLConstant.OES_EGL_image_external = 0x1 +GLConstant.OES_compressed_ETC1_RGB8_texture = 0x1 +GLConstant.OES_compressed_paletted_texture = 0x1 +GLConstant.OES_depth24 = 0x1 +GLConstant.OES_depth32 = 0x1 +GLConstant.OES_depth_texture = 0x1 +GLConstant.OES_element_index_uint = 0x1 +GLConstant.OES_fbo_render_mipmap = 0x1 +GLConstant.OES_fragment_precision_high = 0x1 +GLConstant.OES_get_program_binary = 0x1 +GLConstant.OES_mapbuffer = 0x1 +GLConstant.OES_packed_depth_stencil = 0x1 +GLConstant.OES_required_internalformat = 0x1 +GLConstant.OES_rgb8_rgba8 = 0x1 +GLConstant.OES_standard_derivatives = 0x1 +GLConstant.OES_stencil1 = 0x1 +GLConstant.OES_stencil4 = 0x1 +GLConstant.OES_surfaceless_context = 0x1 +GLConstant.OES_texture_3D = 0x1 +GLConstant.OES_texture_float = 0x1 +GLConstant.OES_texture_float_linear = 0x1 +GLConstant.OES_texture_half_float = 0x1 +GLConstant.OES_texture_half_float_linear = 0x1 +GLConstant.OES_texture_npot = 0x1 +GLConstant.OES_vertex_array_object = 0x1 +GLConstant.OES_vertex_half_float = 0x1 +GLConstant.OES_vertex_type_10_10_10_2 = 0x1 +GLConstant.ONE = 0x1 +GLConstant.ONE_MINUS_CONSTANT_ALPHA = 0x8004 +GLConstant.ONE_MINUS_CONSTANT_COLOR = 0x8002 +GLConstant.ONE_MINUS_DST_ALPHA = 0x305 +GLConstant.ONE_MINUS_DST_COLOR = 0x307 +GLConstant.ONE_MINUS_SRC_ALPHA = 0x303 +GLConstant.ONE_MINUS_SRC_COLOR = 0x301 +GLConstant.OUT_OF_MEMORY = 0x505 +GLConstant.PACK_ALIGNMENT = 0xd05 +GLConstant.PACK_REVERSE_ROW_ORDER_ANGLE = 0x93a4 +GLConstant.PALETTE4_R5_G6_B5_OES = 0x8b92 +GLConstant.PALETTE4_RGB5_A1_OES = 0x8b94 +GLConstant.PALETTE4_RGB8_OES = 0x8b90 +GLConstant.PALETTE4_RGBA4_OES = 0x8b93 +GLConstant.PALETTE4_RGBA8_OES = 0x8b91 +GLConstant.PALETTE8_R5_G6_B5_OES = 0x8b97 +GLConstant.PALETTE8_RGB5_A1_OES = 0x8b99 +GLConstant.PALETTE8_RGB8_OES = 0x8b95 +GLConstant.PALETTE8_RGBA4_OES = 0x8b98 +GLConstant.PALETTE8_RGBA8_OES = 0x8b96 +GLConstant.PERCENTAGE_AMD = 0x8bc3 +GLConstant.PERFMON_GLOBAL_MODE_QCOM = 0x8fa0 +GLConstant.PERFMON_RESULT_AMD = 0x8bc6 +GLConstant.PERFMON_RESULT_AVAILABLE_AMD = 0x8bc4 +GLConstant.PERFMON_RESULT_SIZE_AMD = 0x8bc5 +GLConstant.POINTS = 0x0 +GLConstant.POLYGON_OFFSET_FACTOR = 0x8038 +GLConstant.POLYGON_OFFSET_FILL = 0x8037 +GLConstant.POLYGON_OFFSET_UNITS = 0x2a00 +GLConstant.PROGRAM = 0x82e2 +GLConstant.PROGRAM_BINARY_ANGLE = 0x93a6 +GLConstant.PROGRAM_BINARY_FORMATS_OES = 0x87ff +GLConstant.PROGRAM_BINARY_LENGTH_OES = 0x8741 +GLConstant.PROGRAM_OBJECT_EXT = 0x8b40 +GLConstant.PROGRAM_PIPELINE_BINDING_EXT = 0x825a +GLConstant.PROGRAM_PIPELINE_OBJECT_EXT = 0x8a4f +GLConstant.PROGRAM_SEPARABLE_EXT = 0x8258 +GLConstant.QCOM_alpha_test = 0x1 +GLConstant.QCOM_binning_control = 0x1 +GLConstant.QCOM_driver_control = 0x1 +GLConstant.QCOM_extended_get = 0x1 +GLConstant.QCOM_extended_get2 = 0x1 +GLConstant.QCOM_perfmon_global_mode = 0x1 +GLConstant.QCOM_tiled_rendering = 0x1 +GLConstant.QCOM_writeonly_rendering = 0x1 +GLConstant.QUERY = 0x82e3 +GLConstant.QUERY_OBJECT_EXT = 0x9153 +GLConstant.QUERY_RESULT_AVAILABLE_EXT = 0x8867 +GLConstant.QUERY_RESULT_EXT = 0x8866 +GLConstant.R16F_EXT = 0x822d +GLConstant.R32F_EXT = 0x822e +GLConstant.R8_EXT = 0x8229 +GLConstant.READ_BUFFER_EXT = 0xc02 +GLConstant.READ_BUFFER_NV = 0xc02 +GLConstant.READ_FRAMEBUFFER_ANGLE = 0x8ca8 +GLConstant.READ_FRAMEBUFFER_APPLE = 0x8ca8 +GLConstant.READ_FRAMEBUFFER_BINDING_ANGLE = 0x8caa +GLConstant.READ_FRAMEBUFFER_BINDING_APPLE = 0x8caa +GLConstant.READ_FRAMEBUFFER_BINDING_NV = 0x8caa +GLConstant.READ_FRAMEBUFFER_NV = 0x8ca8 +GLConstant.RED_BITS = 0xd52 +GLConstant.RED_EXT = 0x1903 +GLConstant.RENDERBUFFER = 0x8d41 +GLConstant.RENDERBUFFER_ALPHA_SIZE = 0x8d53 +GLConstant.RENDERBUFFER_BINDING = 0x8ca7 +GLConstant.RENDERBUFFER_BLUE_SIZE = 0x8d52 +GLConstant.RENDERBUFFER_DEPTH_SIZE = 0x8d54 +GLConstant.RENDERBUFFER_GREEN_SIZE = 0x8d51 +GLConstant.RENDERBUFFER_HEIGHT = 0x8d43 +GLConstant.RENDERBUFFER_INTERNAL_FORMAT = 0x8d44 +GLConstant.RENDERBUFFER_RED_SIZE = 0x8d50 +GLConstant.RENDERBUFFER_SAMPLES_ANGLE = 0x8cab +GLConstant.RENDERBUFFER_SAMPLES_APPLE = 0x8cab +GLConstant.RENDERBUFFER_SAMPLES_EXT = 0x8cab +GLConstant.RENDERBUFFER_SAMPLES_IMG = 0x9133 +GLConstant.RENDERBUFFER_SAMPLES_NV = 0x8cab +GLConstant.RENDERBUFFER_STENCIL_SIZE = 0x8d55 +GLConstant.RENDERBUFFER_WIDTH = 0x8d42 +GLConstant.RENDERER = 0x1f01 +GLConstant.RENDER_DIRECT_TO_FRAMEBUFFER_QCOM = 0x8fb3 +GLConstant.REPEAT = 0x2901 +GLConstant.REPLACE = 0x1e01 +GLConstant.REQUIRED_TEXTURE_IMAGE_UNITS_OES = 0x8d68 +GLConstant.RESET_NOTIFICATION_STRATEGY_EXT = 0x8256 +GLConstant.RG16F_EXT = 0x822f +GLConstant.RG32F_EXT = 0x8230 +GLConstant.RG8_EXT = 0x822b +GLConstant.RGB = 0x1907 +GLConstant.RGB10_A2_EXT = 0x8059 +GLConstant.RGB10_EXT = 0x8052 +GLConstant.RGB16F_EXT = 0x881b +GLConstant.RGB32F_EXT = 0x8815 +GLConstant.RGB565 = 0x8d62 +GLConstant.RGB565_OES = 0x8d62 +GLConstant.RGB5_A1 = 0x8057 +GLConstant.RGB5_A1_OES = 0x8057 +GLConstant.RGB8_OES = 0x8051 +GLConstant.RGBA = 0x1908 +GLConstant.RGBA16F_EXT = 0x881a +GLConstant.RGBA32F_EXT = 0x8814 +GLConstant.RGBA4 = 0x8056 +GLConstant.RGBA4_OES = 0x8056 +GLConstant.RGBA8_OES = 0x8058 +GLConstant.RGB_422_APPLE = 0x8a1f +GLConstant.RG_EXT = 0x8227 +GLConstant.SAMPLER = 0x82e6 +GLConstant.SAMPLER_2D = 0x8b5e +GLConstant.SAMPLER_2D_ARRAY_SHADOW_NV = 0x8dc4 +GLConstant.SAMPLER_2D_SHADOW_EXT = 0x8b62 +GLConstant.SAMPLER_3D_OES = 0x8b5f +GLConstant.SAMPLER_CUBE = 0x8b60 +GLConstant.SAMPLER_CUBE_SHADOW_NV = 0x8dc5 +GLConstant.SAMPLER_EXTERNAL_OES = 0x8d66 +GLConstant.SAMPLES = 0x80a9 +GLConstant.SAMPLE_ALPHA_TO_COVERAGE = 0x809e +GLConstant.SAMPLE_BUFFERS = 0x80a8 +GLConstant.SAMPLE_COVERAGE = 0x80a0 +GLConstant.SAMPLE_COVERAGE_INVERT = 0x80ab +GLConstant.SAMPLE_COVERAGE_VALUE = 0x80aa +GLConstant.SCISSOR_BOX = 0xc10 +GLConstant.SCISSOR_TEST = 0xc11 +GLConstant.SGX_BINARY_IMG = 0x8c0a +GLConstant.SGX_PROGRAM_BINARY_IMG = 0x9130 +GLConstant.SHADER = 0x82e1 +GLConstant.SHADER_BINARY_DMP = 0x9250 +GLConstant.SHADER_BINARY_FORMATS = 0x8df8 +GLConstant.SHADER_BINARY_VIV = 0x8fc4 +GLConstant.SHADER_COMPILER = 0x8dfa +GLConstant.SHADER_OBJECT_EXT = 0x8b48 +GLConstant.SHADER_SOURCE_LENGTH = 0x8b88 +GLConstant.SHADER_TYPE = 0x8b4f +GLConstant.SHADING_LANGUAGE_VERSION = 0x8b8c +GLConstant.SHORT = 0x1402 +GLConstant.SIGNALED_APPLE = 0x9119 +GLConstant.SLUMINANCE8_ALPHA8_NV = 0x8c45 +GLConstant.SLUMINANCE8_NV = 0x8c47 +GLConstant.SLUMINANCE_ALPHA_NV = 0x8c44 +GLConstant.SLUMINANCE_NV = 0x8c46 +GLConstant.SRC_ALPHA = 0x302 +GLConstant.SRC_ALPHA_SATURATE = 0x308 +GLConstant.SRC_COLOR = 0x300 +GLConstant.SRGB8_ALPHA8_EXT = 0x8c43 +GLConstant.SRGB8_NV = 0x8c41 +GLConstant.SRGB_ALPHA_EXT = 0x8c42 +GLConstant.SRGB_EXT = 0x8c40 +GLConstant.STACK_OVERFLOW = 0x503 +GLConstant.STACK_UNDERFLOW = 0x504 +GLConstant.STATE_RESTORE = 0x8bdc +GLConstant.STATIC_DRAW = 0x88e4 +GLConstant.STENCIL_ATTACHMENT = 0x8d20 +GLConstant.STENCIL_BACK_FAIL = 0x8801 +GLConstant.STENCIL_BACK_FUNC = 0x8800 +GLConstant.STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802 +GLConstant.STENCIL_BACK_PASS_DEPTH_PASS = 0x8803 +GLConstant.STENCIL_BACK_REF = 0x8ca3 +GLConstant.STENCIL_BACK_VALUE_MASK = 0x8ca4 +GLConstant.STENCIL_BACK_WRITEMASK = 0x8ca5 +GLConstant.STENCIL_BITS = 0xd57 +GLConstant.STENCIL_BUFFER_BIT = 0x400 +GLConstant.STENCIL_BUFFER_BIT0_QCOM = 0x10000 +GLConstant.STENCIL_BUFFER_BIT1_QCOM = 0x20000 +GLConstant.STENCIL_BUFFER_BIT2_QCOM = 0x40000 +GLConstant.STENCIL_BUFFER_BIT3_QCOM = 0x80000 +GLConstant.STENCIL_BUFFER_BIT4_QCOM = 0x100000 +GLConstant.STENCIL_BUFFER_BIT5_QCOM = 0x200000 +GLConstant.STENCIL_BUFFER_BIT6_QCOM = 0x400000 +GLConstant.STENCIL_BUFFER_BIT7_QCOM = 0x800000 +GLConstant.STENCIL_CLEAR_VALUE = 0xb91 +GLConstant.STENCIL_EXT = 0x1802 +GLConstant.STENCIL_FAIL = 0xb94 +GLConstant.STENCIL_FUNC = 0xb92 +GLConstant.STENCIL_INDEX1_OES = 0x8d46 +GLConstant.STENCIL_INDEX4_OES = 0x8d47 +GLConstant.STENCIL_INDEX8 = 0x8d48 +GLConstant.STENCIL_PASS_DEPTH_FAIL = 0xb95 +GLConstant.STENCIL_PASS_DEPTH_PASS = 0xb96 +GLConstant.STENCIL_REF = 0xb97 +GLConstant.STENCIL_TEST = 0xb90 +GLConstant.STENCIL_VALUE_MASK = 0xb93 +GLConstant.STENCIL_WRITEMASK = 0xb98 +GLConstant.STREAM_DRAW = 0x88e0 +GLConstant.SUBPIXEL_BITS = 0xd50 +GLConstant.SYNC_CONDITION_APPLE = 0x9113 +GLConstant.SYNC_FENCE_APPLE = 0x9116 +GLConstant.SYNC_FLAGS_APPLE = 0x9115 +GLConstant.SYNC_FLUSH_COMMANDS_BIT_APPLE = 0x1 +GLConstant.SYNC_GPU_COMMANDS_COMPLETE_APPLE = 0x9117 +GLConstant.SYNC_OBJECT_APPLE = 0x8a53 +GLConstant.SYNC_STATUS_APPLE = 0x9114 +GLConstant.TEXTURE = 0x1702 +GLConstant.TEXTURE0 = 0x84c0 +GLConstant.TEXTURE1 = 0x84c1 +GLConstant.TEXTURE10 = 0x84ca +GLConstant.TEXTURE11 = 0x84cb +GLConstant.TEXTURE12 = 0x84cc +GLConstant.TEXTURE13 = 0x84cd +GLConstant.TEXTURE14 = 0x84ce +GLConstant.TEXTURE15 = 0x84cf +GLConstant.TEXTURE16 = 0x84d0 +GLConstant.TEXTURE17 = 0x84d1 +GLConstant.TEXTURE18 = 0x84d2 +GLConstant.TEXTURE19 = 0x84d3 +GLConstant.TEXTURE2 = 0x84c2 +GLConstant.TEXTURE20 = 0x84d4 +GLConstant.TEXTURE21 = 0x84d5 +GLConstant.TEXTURE22 = 0x84d6 +GLConstant.TEXTURE23 = 0x84d7 +GLConstant.TEXTURE24 = 0x84d8 +GLConstant.TEXTURE25 = 0x84d9 +GLConstant.TEXTURE26 = 0x84da +GLConstant.TEXTURE27 = 0x84db +GLConstant.TEXTURE28 = 0x84dc +GLConstant.TEXTURE29 = 0x84dd +GLConstant.TEXTURE3 = 0x84c3 +GLConstant.TEXTURE30 = 0x84de +GLConstant.TEXTURE31 = 0x84df +GLConstant.TEXTURE4 = 0x84c4 +GLConstant.TEXTURE5 = 0x84c5 +GLConstant.TEXTURE6 = 0x84c6 +GLConstant.TEXTURE7 = 0x84c7 +GLConstant.TEXTURE8 = 0x84c8 +GLConstant.TEXTURE9 = 0x84c9 +GLConstant.TEXTURE_2D = 0xde1 +GLConstant.TEXTURE_3D_OES = 0x806f +GLConstant.TEXTURE_BINDING_2D = 0x8069 +GLConstant.TEXTURE_BINDING_3D_OES = 0x806a +GLConstant.TEXTURE_BINDING_CUBE_MAP = 0x8514 +GLConstant.TEXTURE_BINDING_EXTERNAL_OES = 0x8d67 +GLConstant.TEXTURE_BORDER_COLOR_NV = 0x1004 +GLConstant.TEXTURE_COMPARE_FUNC_EXT = 0x884d +GLConstant.TEXTURE_COMPARE_MODE_EXT = 0x884c +GLConstant.TEXTURE_CUBE_MAP = 0x8513 +GLConstant.TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516 +GLConstant.TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518 +GLConstant.TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851a +GLConstant.TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515 +GLConstant.TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517 +GLConstant.TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519 +GLConstant.TEXTURE_DEPTH_QCOM = 0x8bd4 +GLConstant.TEXTURE_EXTERNAL_OES = 0x8d65 +GLConstant.TEXTURE_FORMAT_QCOM = 0x8bd6 +GLConstant.TEXTURE_HEIGHT_QCOM = 0x8bd3 +GLConstant.TEXTURE_IMAGE_VALID_QCOM = 0x8bd8 +GLConstant.TEXTURE_IMMUTABLE_FORMAT_EXT = 0x912f +GLConstant.TEXTURE_INTERNAL_FORMAT_QCOM = 0x8bd5 +GLConstant.TEXTURE_MAG_FILTER = 0x2800 +GLConstant.TEXTURE_MAX_ANISOTROPY_EXT = 0x84fe +GLConstant.TEXTURE_MAX_LEVEL_APPLE = 0x813d +GLConstant.TEXTURE_MIN_FILTER = 0x2801 +GLConstant.TEXTURE_NUM_LEVELS_QCOM = 0x8bd9 +GLConstant.TEXTURE_OBJECT_VALID_QCOM = 0x8bdb +GLConstant.TEXTURE_SAMPLES_IMG = 0x9136 +GLConstant.TEXTURE_TARGET_QCOM = 0x8bda +GLConstant.TEXTURE_TYPE_QCOM = 0x8bd7 +GLConstant.TEXTURE_USAGE_ANGLE = 0x93a2 +GLConstant.TEXTURE_WIDTH_QCOM = 0x8bd2 +GLConstant.TEXTURE_WRAP_R_OES = 0x8072 +GLConstant.TEXTURE_WRAP_S = 0x2802 +GLConstant.TEXTURE_WRAP_T = 0x2803 +GLConstant.TIMEOUT_EXPIRED_APPLE = 0x911b +GLConstant.TIMEOUT_IGNORED_APPLE = 0xffffffffffffffff +GLConstant.TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE = 0x93a0 +GLConstant.TRIANGLES = 0x4 +GLConstant.TRIANGLE_FAN = 0x6 +GLConstant.TRIANGLE_STRIP = 0x5 +GLConstant.TRUE = 0x1 +GLConstant.UNKNOWN_CONTEXT_RESET_EXT = 0x8255 +GLConstant.UNPACK_ALIGNMENT = 0xcf5 +GLConstant.UNPACK_ROW_LENGTH = 0xcf2 +GLConstant.UNPACK_SKIP_PIXELS = 0xcf4 +GLConstant.UNPACK_SKIP_ROWS = 0xcf3 +GLConstant.UNSIGNALED_APPLE = 0x9118 +GLConstant.UNSIGNED_BYTE = 0x1401 +GLConstant.UNSIGNED_INT = 0x1405 +GLConstant.UNSIGNED_INT64_AMD = 0x8bc2 +GLConstant.UNSIGNED_INT_10_10_10_2_OES = 0x8df6 +GLConstant.UNSIGNED_INT_24_8_OES = 0x84fa +GLConstant.UNSIGNED_INT_2_10_10_10_REV_EXT = 0x8368 +GLConstant.UNSIGNED_NORMALIZED_EXT = 0x8c17 +GLConstant.UNSIGNED_SHORT = 0x1403 +GLConstant.UNSIGNED_SHORT_1_5_5_5_REV_EXT = 0x8366 +GLConstant.UNSIGNED_SHORT_4_4_4_4 = 0x8033 +GLConstant.UNSIGNED_SHORT_4_4_4_4_REV_EXT = 0x8365 +GLConstant.UNSIGNED_SHORT_4_4_4_4_REV_IMG = 0x8365 +GLConstant.UNSIGNED_SHORT_5_5_5_1 = 0x8034 +GLConstant.UNSIGNED_SHORT_5_6_5 = 0x8363 +GLConstant.UNSIGNED_SHORT_8_8_APPLE = 0x85ba +GLConstant.UNSIGNED_SHORT_8_8_REV_APPLE = 0x85bb +GLConstant.VALIDATE_STATUS = 0x8b83 +GLConstant.VENDOR = 0x1f00 +GLConstant.VERSION = 0x1f02 +GLConstant.VERTEX_ARRAY_BINDING_OES = 0x85b5 +GLConstant.VERTEX_ARRAY_OBJECT_EXT = 0x9154 +GLConstant.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889f +GLConstant.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88fe +GLConstant.VERTEX_ATTRIB_ARRAY_DIVISOR_NV = 0x88fe +GLConstant.VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622 +GLConstant.VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886a +GLConstant.VERTEX_ATTRIB_ARRAY_POINTER = 0x8645 +GLConstant.VERTEX_ATTRIB_ARRAY_SIZE = 0x8623 +GLConstant.VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624 +GLConstant.VERTEX_ATTRIB_ARRAY_TYPE = 0x8625 +GLConstant.VERTEX_SHADER = 0x8b31 +GLConstant.VERTEX_SHADER_BIT_EXT = 0x1 +GLConstant.VIEWPORT = 0xba2 +GLConstant.VIV_shader_binary = 0x1 +GLConstant.WAIT_FAILED_APPLE = 0x911d +GLConstant.WRITEONLY_RENDERING_QCOM = 0x8823 +GLConstant.WRITE_ONLY_OES = 0x88b9 +GLConstant.Z400_BINARY_AMD = 0x8740 +GLConstant.ZERO = 0x0 + +local modename = "GLConstant" +local GLConstantProxy = {} +local GLConstantMt = { + __index = GLConstant, + __newindex = function (t ,k ,v) + print("attemp to update a read-only table") + end +} +setmetatable(GLConstantProxy,GLConstantMt) +_G[modename] = GLConstantProxy +package.loaded[modename] = GLConstantProxy + + From 0c4f99080b628a4c3c8d9634f55a6bda78a97c02 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 20 Jun 2013 10:19:46 +0800 Subject: [PATCH 3/5] issue #2277: modify platform config except win32 --- .../TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua | 7 +++---- samples/Lua/TestLua/proj.nacl/Makefile | 3 ++- .../lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id | 2 +- scripting/lua/proj.android/Android.mk | 1 + scripting/lua/proj.emscripten/Makefile | 3 ++- scripting/lua/proj.linux/Makefile | 1 + scripting/lua/proj.marmalade/lua.mkf | 2 ++ 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua b/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua index 2145081c62..4465502339 100644 --- a/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua +++ b/samples/Lua/TestLua/Resources/luaScript/OpenGLTest/OpenGLTest.lua @@ -621,8 +621,7 @@ local function OpenGLTestMainLayer() i = i + 1 end - glNode:_texImage2D(GLConstant.TEXTURE_2D, 0, GLConstant.RGBA, 32, 32, 0, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, 4096,pixels) - print(glNode:getError()) + glNode:_texImage2D(GLConstant.TEXTURE_2D, 0, GLConstant.RGBA, 32, 32, 0, GLConstant.RGBA, GLConstant.UNSIGNED_BYTE, table.getn(pixels),pixels) glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MAG_FILTER, GLConstant.NEAREST) glNode:texParameteri(GLConstant.TEXTURE_2D, GLConstant.TEXTURE_MIN_FILTER, GLConstant.NEAREST) glNode:_bindTexture(GLConstant.TEXTURE_2D, 0) @@ -631,12 +630,12 @@ local function OpenGLTestMainLayer() squareVertexPositionBuffer.buffer_id = glNode:_createBuffer() glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexPositionBuffer.buffer_id) local vertices = { 128, 128, 0, 128, 128, 0, 0, 0 } - glNode:bufferData(GLConstant.ARRAY_BUFFER,8,vertices,GLConstant.STATIC_DRAW) + glNode:bufferData(GLConstant.ARRAY_BUFFER,table.getn(vertices),vertices,GLConstant.STATIC_DRAW) squareVertexTextureBuffer.buffer_id = glNode:_createBuffer() glNode:_bindBuffer(GLConstant.ARRAY_BUFFER, squareVertexTextureBuffer.buffer_id) local texcoords = { 1, 1, 0, 1, 1, 0, 0, 0 } - glNode:bufferData(GLConstant.ARRAY_BUFFER,8,texcoords,GLConstant.STATIC_DRAW) + glNode:bufferData(GLConstant.ARRAY_BUFFER,table.getn(texcoords),texcoords,GLConstant.STATIC_DRAW) glNode:_bindBuffer(GLConstant.ARRAY_BUFFER,0) end diff --git a/samples/Lua/TestLua/proj.nacl/Makefile b/samples/Lua/TestLua/proj.nacl/Makefile index ecf772b478..c4a697dc22 100644 --- a/samples/Lua/TestLua/proj.nacl/Makefile +++ b/samples/Lua/TestLua/proj.nacl/Makefile @@ -21,7 +21,8 @@ SOURCES = main.cpp \ $(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaCocos2d.cpp \ $(COCOS_ROOT)/scripting/lua/cocos2dx_support/tolua_fix.c \ $(COCOS_ROOT)/scripting/lua/cocos2dx_support/CCBProxy.cpp \ - $(COCOS_ROOT)/scripting/lua/cocos2dx_support/Lua_extensions_CCB.cpp + $(COCOS_ROOT)/scripting/lua/cocos2dx_support/Lua_extensions_CCB.cpp \ + $(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaOpengl.cpp include $(COCOS2DX_PATH)/../extensions/proj.nacl/Makefile SOURCES += $(addprefix $(COCOS_ROOT)/extensions/, $(EXTENSIONS_SOURCES)) diff --git a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id index 0779bd3239..b0e2f2a372 100644 --- a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id @@ -1 +1 @@ -1778c5b2673e902d72ddcfcae4f9825375d4a333 \ No newline at end of file +7ce354620b884318469f93dfcd10ce3fa804f75b \ No newline at end of file diff --git a/scripting/lua/proj.android/Android.mk b/scripting/lua/proj.android/Android.mk index 407b3fce91..4f4a8100e2 100644 --- a/scripting/lua/proj.android/Android.mk +++ b/scripting/lua/proj.android/Android.mk @@ -14,6 +14,7 @@ LOCAL_SRC_FILES := ../cocos2dx_support/CCLuaBridge.cpp \ ../cocos2dx_support/CCBProxy.cpp \ ../cocos2dx_support/Lua_extensions_CCB.cpp \ ../cocos2dx_support/Lua_web_socket.cpp \ + ../cocos2dx_support/LuaOpengl.cpp \ ../tolua/tolua_event.c \ ../tolua/tolua_is.c \ ../tolua/tolua_map.c \ diff --git a/scripting/lua/proj.emscripten/Makefile b/scripting/lua/proj.emscripten/Makefile index c74d0edd0e..bee3dfb9df 100644 --- a/scripting/lua/proj.emscripten/Makefile +++ b/scripting/lua/proj.emscripten/Makefile @@ -46,7 +46,8 @@ SOURCES = ../lua/lapi.o \ ../cocos2dx_support/Cocos2dxLuaLoader.cpp \ ../cocos2dx_support/LuaCocos2d.cpp \ ../cocos2dx_support/CCBProxy.cpp \ - ../cocos2dx_support/Lua_extensions_CCB.cpp + ../cocos2dx_support/Lua_extensions_CCB.cpp \ + ../cocos2dx_support/LuaOpengl.cpp include ../../../cocos2dx/proj.emscripten/cocos2dx.mk diff --git a/scripting/lua/proj.linux/Makefile b/scripting/lua/proj.linux/Makefile index b4ea45a114..ee0455cd51 100644 --- a/scripting/lua/proj.linux/Makefile +++ b/scripting/lua/proj.linux/Makefile @@ -47,6 +47,7 @@ SOURCES = ../lua/lapi.o \ ../cocos2dx_support/LuaCocos2d.cpp \ ../cocos2dx_support/CCBProxy.cpp \ ../cocos2dx_support/Lua_extensions_CCB.cpp \ + ../cocos2dx_support/LuaOpengl.cpp include ../../../cocos2dx/proj.linux/cocos2dx.mk diff --git a/scripting/lua/proj.marmalade/lua.mkf b/scripting/lua/proj.marmalade/lua.mkf index 5fb796b826..d5b939b5e2 100644 --- a/scripting/lua/proj.marmalade/lua.mkf +++ b/scripting/lua/proj.marmalade/lua.mkf @@ -38,4 +38,6 @@ files "Lua_extensions_CCB.h" "tolua_fix.c" "tolua_fix.h" + "LuaOpengl.cpp" + "LuaOpengl.h" } From fb075d7a7d76d941fd3d36ff7f05066fdc6e44ab Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 20 Jun 2013 11:28:16 +0800 Subject: [PATCH 5/5] issue #2277: Delete some conflict file and resolve some error --- .../project.pbxproj.BACKUP.12496.pbxproj.REMOVED.git-id | 1 - .../project.pbxproj.BASE.12496.pbxproj.REMOVED.git-id | 1 - .../project.pbxproj.LOCAL.12496.pbxproj.REMOVED.git-id | 1 - .../project.pbxproj.REMOTE.12496.pbxproj.REMOVED.git-id | 1 - .../TestLua.xcodeproj/project.pbxproj.orig.REMOVED.git-id | 1 - scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id | 2 +- 6 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BACKUP.12496.pbxproj.REMOVED.git-id delete mode 100644 samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BASE.12496.pbxproj.REMOVED.git-id delete mode 100644 samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.LOCAL.12496.pbxproj.REMOVED.git-id delete mode 100644 samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOTE.12496.pbxproj.REMOVED.git-id delete mode 100644 samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.orig.REMOVED.git-id diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BACKUP.12496.pbxproj.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BACKUP.12496.pbxproj.REMOVED.git-id deleted file mode 100644 index 16db202112..0000000000 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BACKUP.12496.pbxproj.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -8babc634e7ffc5da7db34b8f50631a1041b295d0 \ No newline at end of file diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BASE.12496.pbxproj.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BASE.12496.pbxproj.REMOVED.git-id deleted file mode 100644 index 363b49cf1a..0000000000 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.BASE.12496.pbxproj.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -393bddc01d5ea9a3d98e1d0c03c902424d05346e \ No newline at end of file diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.LOCAL.12496.pbxproj.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.LOCAL.12496.pbxproj.REMOVED.git-id deleted file mode 100644 index e30bde7975..0000000000 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.LOCAL.12496.pbxproj.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -da31505b1daa8313b3e96c8e7d6113631d12f5f5 \ No newline at end of file diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOTE.12496.pbxproj.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOTE.12496.pbxproj.REMOVED.git-id deleted file mode 100644 index d8b9a6b562..0000000000 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.REMOTE.12496.pbxproj.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -d4b02b732f0f52882d63f056beaa34921bbb5856 \ No newline at end of file diff --git a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.orig.REMOVED.git-id b/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.orig.REMOVED.git-id deleted file mode 100644 index 861077555b..0000000000 --- a/samples/Lua/TestLua/proj.ios/TestLua.xcodeproj/project.pbxproj.orig.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -065e7159e1cb93cc78cec22a648e4f82465fd848 \ No newline at end of file diff --git a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id index b0e2f2a372..04d0dd7b94 100644 --- a/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaOpengl.cpp.REMOVED.git-id @@ -1 +1 @@ -7ce354620b884318469f93dfcd10ce3fa804f75b \ No newline at end of file +293d0a7f69ff01902cb00e57a44c60610209396c \ No newline at end of file