diff --git a/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua b/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua index d5d7460632..d5f5f95e6e 100644 --- a/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua +++ b/tests/lua-tests/src/EffectsAdvancedTest/EffectsAdvancedTest.lua @@ -235,7 +235,7 @@ local function Issue631() --bf.src = GL_SRC_ALPHA --bf.dst = GL_ONE_MINUS_SRC_ALPHA - fog:setBlendFunc(cc.blendFunc(gl.SRC_ALPHA , gl.ONE_MINUS_SRC_ALPHA)) + fog:setBlendFunc(cc.blendFunc(ccb.BlendFactor.SRC_ALPHA , ccb.BlendFactor.ONE_MINUS_SRC_ALPHA)) layer2:addChild(fog, 1) ret:addChild(layer2BaseGrid, 1) layer2BaseGrid:addChild(layer2) diff --git a/tests/lua-tests/src/LayerTest/LayerTest.lua b/tests/lua-tests/src/LayerTest/LayerTest.lua index adcaeb9b20..746ab2e325 100644 --- a/tests/lua-tests/src/LayerTest/LayerTest.lua +++ b/tests/lua-tests/src/LayerTest/LayerTest.lua @@ -407,11 +407,11 @@ local function LayerTestBlend() local dst = 0 if blend then - src = gl.SRC_ALPHA - dst = gl.ONE_MINUS_SRC_ALPHA + src = ccb.BlendFactor.SRC_ALPHA + dst = ccb.BlendFactor.ONE_MINUS_SRC_ALPHA else - src = gl.ONE_MINUS_DST_COLOR - dst = gl.ZERO + src = ccb.BlendFactor.ONE_MINUS_DST_COLOR + dst = ccb.BlendFactor.ZERO end layer:setBlendFunc(cc.blendFunc(src, dst)) @@ -626,7 +626,7 @@ local function LayerExtendedBlendOpacityTest() layer3:setEndColor(cc.c3b(255, 0, 255)) layer3:setStartOpacity(255) layer3:setEndOpacity(255) - layer3:setBlendFunc(cc.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)) + layer3:setBlendFunc(cc.blendFunc(ccb.BlendFactor.SRC_ALPHA, ccb.BlendFactor.ONE_MINUS_SRC_ALPHA)) ret:addChild(layer3) return ret end diff --git a/tests/lua-tests/src/NodeTest/NodeTest.lua b/tests/lua-tests/src/NodeTest/NodeTest.lua index ea2e0d2cc0..483c05514c 100644 --- a/tests/lua-tests/src/NodeTest/NodeTest.lua +++ b/tests/lua-tests/src/NodeTest/NodeTest.lua @@ -603,7 +603,7 @@ local function NodeOpaqueTest() for i = 0, 49 do local background = cc.Sprite:create("Images/background1.png") - background:setBlendFunc(cc.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)) + background:setBlendFunc(cc.blendFunc(ccb.BlendFactor.ONE, ccb.BlendFactor.ONE_MINUS_SRC_ALPHA)) background:setAnchorPoint(cc.p(0, 0)) layer:addChild(background) end @@ -621,7 +621,7 @@ local function NodeNonOpaqueTest() for i = 0, 49 do background = cc.Sprite:create("Images/background1.jpg") - background:setBlendFunc(cc.blendFunc(gl.ONE, gl.ZERO)) + background:setBlendFunc(cc.blendFunc(ccb.BlendFactor.ONE, ccb.BlendFactor.ZERO)) background:setAnchorPoint(cc.p(0, 0)) layer:addChild(background) end diff --git a/tests/lua-tests/src/ParticleTest/ParticleTest.lua b/tests/lua-tests/src/ParticleTest/ParticleTest.lua index 869de767ce..883a7b2a65 100644 --- a/tests/lua-tests/src/ParticleTest/ParticleTest.lua +++ b/tests/lua-tests/src/ParticleTest/ParticleTest.lua @@ -1542,7 +1542,7 @@ local function PremultipliedAlphaTest() emitter = cc.ParticleSystemQuad:create("Particles/BoilingFoam.plist") emitter:retain() - emitter:setBlendFunc(cc.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)) + emitter:setBlendFunc(cc.blendFunc(ccb.BlendFactor.ONE, ccb.BlendFactor.ONE_MINUS_SRC_ALPHA)) --assert(emitter:getOpacityModifyRGB(), "Particle texture does not have premultiplied alpha, test is useless") diff --git a/tests/lua-tests/src/Scene3DTest/Scene3DTest.lua b/tests/lua-tests/src/Scene3DTest/Scene3DTest.lua index f2d040c4ef..030b42e59f 100644 --- a/tests/lua-tests/src/Scene3DTest/Scene3DTest.lua +++ b/tests/lua-tests/src/Scene3DTest/Scene3DTest.lua @@ -342,7 +342,7 @@ function Scene3DTest:create3DWorld() "Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg") --set texture parameters - local tRepeatParams = { magFilter = ccb.SamplerFilter.LINEAR , minFilter = ccb.SamplerFilter.LINEAR , wrapS = ccb.SamplerAddressMode.MIRRORED_REPEAT , wrapT = ccb.SamplerAddressMode.MIRRORED_REPEAT } + local tRepeatParams = { magFilter = ccb.SamplerFilter.LINEAR , minFilter = ccb.SamplerFilter.LINEAR , sAddressMode = ccb.SamplerAddressMode.MIRRORED_REPEAT , tAddressMode = ccb.SamplerAddressMode.MIRRORED_REPEAT } self._textureCube:setTexParameters(tRepeatParams) --pass the texture sampler to our custom shader diff --git a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua index b2b135a460..3263b22839 100644 --- a/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua +++ b/tests/lua-tests/src/Sprite3DTest/Sprite3DTest.lua @@ -1192,28 +1192,6 @@ function Sprite3DCubeMapTest:addNewSpriteWithCoords(pos) self:addChild(camera) self:setCameraMask(2) - local targetPlatform = cc.Application:getInstance():getTargetPlatform() - if targetPlatform == cc.PLATFORM_OS_ANDROID or targetPlatform == cc.PLATFORM_OS_WINRT or targetPlatform == cc.PLATFORM_OS_WP8 then - self._backToForegroundListener = cc.EventListenerCustom:create("event_renderer_recreated", function (eventCustom) - - local state = self._teapot:getGLProgramState() - local glProgram = state:getGLProgram() - glProgramreset() - glProgram:initWithFilenames("Sprite3DTest/cube_map.vert", "Sprite3DTest/cube_map.frag") - glProgram:link() - glProgram:updateUniforms() - - self._textureCube:reloadTexture() - - local tRepeatParams = { magFilter=gl.NEAREST , minFilter=gl.NEAREST , wrapS=gl.MIRRORED_REPEAT , wrapT=gl.MIRRORED_REPEAT } - self._textureCube:setTexParameters(tRepeatParams) - state:setUniformTexture("u_cubeTex", self._textureCube) - - self._skyBox:reload() - self._skyBox:setTexture(self._textureCube) - end) - cc.Director:getInstance():getEventDispatcher():addEventListenerWithFixedPriority(self._backToForegroundListener, -1) - end end ---------------------------------------- diff --git a/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua b/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua index b3ac3530e7..4636ae6551 100644 --- a/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua +++ b/tests/lua-tests/src/Texture2dTest/Texture2dTest.lua @@ -92,7 +92,7 @@ local function TextureMipMap() local texture0 = cc.Director:getInstance():getTextureCache():addImage( "Images/grossini_dance_atlas.png") texture0:generateMipmap() - texture0:setTexParameters(gl.LINEAR_MIPMAP_LINEAR, gl.LINEAR, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE) + texture0:setTexParameters(ccb.SamplerFilter.LINEAR_MIPMAP_LINEAR, ccb.SamplerFilter.LINEAR, ccb.SamplerAddressMode.CLAMP_TO_EDGE, ccb.SamplerAddressMode.CLAMP_TO_EDGE) local texture1 = cc.Director:getInstance():getTextureCache():addImage( "Images/grossini_dance_atlas_nomipmap.png") @@ -131,12 +131,12 @@ local function TexturePVRMipMap() local s = cc.Director:getInstance():getWinSize() local imgMipMap = cc.Sprite:create("Images/logo-mipmap.pvr") - if imgMipMap ~= nil then + if imgMipMap ~= nil and imgMipMap:getTexture() ~= nil then imgMipMap:setPosition(cc.p( s.width/2.0-100, s.height/2.0)) ret:addChild(imgMipMap) -- support mipmap filtering - imgMipMap:getTexture():setTexParameters(gl.LINEAR_MIPMAP_LINEAR, gl.LINEAR, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE) + imgMipMap:getTexture():setTexParameters(ccb.SamplerFilter.LINEAR_MIPMAP_LINEAR, ccb.SamplerFilter.LINEAR, ccb.SamplerAddressMode.CLAMP_TO_EDGE, ccb.SamplerAddressMode.CLAMP_TO_EDGE) end local img = cc.Sprite:create("Images/logo-nomipmap.pvr") @@ -173,7 +173,7 @@ local function TexturePVRMipMap2() ret:addChild(imgMipMap) -- support mipmap filtering - imgMipMap:getTexture():setTexParameters(gl.LINEAR_MIPMAP_LINEAR, gl.LINEAR, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE) + imgMipMap:getTexture():setTexParameters(ccb.SamplerFilter.LINEAR_MIPMAP_LINEAR, ccb.SamplerFilter.LINEAR, ccb.SamplerAddressMode.CLAMP_TO_EDGE, ccb.SamplerAddressMode.CLAMP_TO_EDGE) local img = cc.Sprite:create("Images/test_image.png") img:setPosition(cc.p( s.width/2.0+100, s.height/2.0)) @@ -779,9 +779,9 @@ local function TextureAlias() local s = cc.Director:getInstance():getWinSize() -- - -- Sprite 1: gl.LINEAR + -- Sprite 1: ccb.SamplerFilter.LINEAR -- - -- Default filter is gl.LINEAR + -- Default filter is ccb.SamplerFilter.LINEAR local sprite = cc.Sprite:create("Images/grossinis_sister1.png") sprite:setPosition(cc.p( s.width/3.0, s.height/2.0)) @@ -927,21 +927,21 @@ local function TextureBlend() local cloud = cc.Sprite:create("Images/test_blend.png") ret:addChild(cloud, i+1, 100+i) cloud:setPosition(cc.p(50+25*i, 80)) - cloud:setBlendFunc(cc.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)) + cloud:setBlendFunc(cc.blendFunc(ccb.BlendFactor.ONE, ccb.BlendFactor.ONE_MINUS_SRC_ALPHA)) -- CENTER sprites have also alpha pre-multiplied -- they use by default GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA cloud = cc.Sprite:create("Images/test_blend.png") ret:addChild(cloud, i+1, 200+i) cloud:setPosition(cc.p(50+25*i, 160)) - cloud:setBlendFunc(cc.blendFunc(gl.ONE_MINUS_DST_COLOR , gl.ZERO)) + cloud:setBlendFunc(cc.blendFunc(ccb.BlendFactor.ONE_MINUS_DST_COLOR , ccb.BlendFactor.ZERO)) -- UPPER sprites are using custom blending function -- You can set any blend function to your sprites cloud = cc.Sprite:create("Images/test_blend.png") ret:addChild(cloud, i+1, 200+i) cloud:setPosition(cc.p(50+25*i, 320-80)) - cloud:setBlendFunc(cc.blendFunc(gl.SRC_ALPHA, gl.ONE)) -- additive blending + cloud:setBlendFunc(cc.blendFunc(ccb.BlendFactor.SRC_ALPHA, ccb.BlendFactor.ONE)) -- additive blending end return ret end @@ -1033,7 +1033,7 @@ local function TextureGlClamp() local sprite = cc.Sprite:create("Images/pattern1.png", cc.rect(0,0,512,256)) ret:addChild(sprite, -1, kTagSprite1) sprite:setPosition(cc.p(size.width/2,size.height/2)) - sprite:getTexture():setTexParameters(gl.LINEAR, gl.LINEAR, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE) + sprite:getTexture():setTexParameters(ccb.SamplerFilter.LINEAR, ccb.SamplerFilter.LINEAR, ccb.SamplerAddressMode.CLAMP_TO_EDGE, ccb.SamplerAddressMode.CLAMP_TO_EDGE) local rotate = cc.RotateBy:create(4, 360) sprite:runAction(rotate) @@ -1058,7 +1058,7 @@ end -- -------------------------------------------------------------------- local function TextureGlRepeat() - local ret = createTestLayer("Texture gl.REPEAT") + local ret = createTestLayer("Texture ccb.SamplerFilter.REPEAT") local size = cc.Director:getInstance():getWinSize() @@ -1067,7 +1067,7 @@ local function TextureGlRepeat() local sprite = cc.Sprite:create("Images/pattern1.png", cc.rect(0, 0, 4096, 4096)) ret:addChild(sprite, -1, kTagSprite1) sprite:setPosition(cc.p(size.width/2,size.height/2)) - sprite:getTexture():setTexParameters(gl.LINEAR, gl.LINEAR, gl.REPEAT, gl.REPEAT) + sprite:getTexture():setTexParameters(ccb.SamplerFilter.LINEAR, ccb.SamplerFilter.LINEAR, ccb.SamplerAddressMode.REPEAT, ccb.SamplerAddressMode.REPEAT) local rotate = cc.RotateBy:create(4, 360) sprite:runAction(rotate) @@ -1198,11 +1198,11 @@ local function TextureDrawAtPoint() m_pTex1:retain() m_pTex2F:retain() - local glNode = gl.glNodeCreate() - glNode:setContentSize(cc.size(256, 256)) - glNode:setAnchorPoint(cc.p(0, 0)) - glNode:registerScriptDrawHandler(draw) - ret:addChild(glNode) + --local glNode = gl.glNodeCreate() + --glNode:setContentSize(cc.size(256, 256)) + --glNode:setAnchorPoint(cc.p(0, 0)) + --glNode:registerScriptDrawHandler(draw) + --ret:addChild(glNode) local function onNodeEvent(event) if event == "exit" then @@ -1244,11 +1244,11 @@ local function TextureDrawInRect() m_pTex1:retain() m_pTex2F:retain() - local glNode = gl.glNodeCreate() - glNode:setContentSize(cc.size(256, 256)) - glNode:setAnchorPoint(cc.p(0, 0)) - glNode:registerScriptDrawHandler(draw) - ret:addChild(glNode) + --local glNode = gl.glNodeCreate() + --glNode:setContentSize(cc.size(256, 256)) + --glNode:setAnchorPoint(cc.p(0, 0)) + --glNode:registerScriptDrawHandler(draw) + --ret:addChild(glNode) local function onNodeEvent(event) if event == "exit" then