2010-08-27 150 views
0

我在o3d(plagin版本)的galery上工作,我需要讓照片透明。照片在hud上。這裏是一些代碼:o3d紋理和透明度

g_canvasInfoPict = o3djs.canvas.create(g_pack, g_hudRoot, g_hudViewInfo); 

alphaParam = g_canvasInfoPict.transparentState_.getStateParam("o3d.AlphaReference"); 
alphaParam.value = 0.5; 

alphaParam = g_canvasInfoPict.transparentState_.getStateParam("o3d.BlendAlphaEquation"); 
alphaParam.value = g_o3d.State.BLEND_SUBTRACT; 

alphaParam = g_canvasInfoPict.transparentState_.getStateParam("o3d.SourceBlendFunction"); 
alphaParam.value = g_o3d.State.BLENDFUNC_ONE; 

paramOne = g_canvasInfoPict.transparentState_.getStateParam("o3d.DestinationBlendFunction"); 
paramOne.value = g_o3d.State.BLENDFUNC_DESTINATION_ALPHA;//or BLENDFUNC_SOURCE_ALPHA or BLENDFUNC_SOURCE_ALPHA_SATUTRATE or BLENDFUNC_ONE or BLENDFUNC_ZERO 

g_fullPictCanvas = g_canvasInfoPict.createXYQuad(paddingX, paddingY, -14, g_fullPictTexture.width, g_fullPictTexture.height, true); 

g_fullPictCanvas.canvas.drawBitmap(g_fullPictTexture, 0, g_fullPictTexture.height); 
g_fullPictCanvas.updateTexture(); 

但它不起作用。當設置paramOne.value = BLENDFUNC_ZERO照片顯示(非透明的)

paramOne.value = BLENDFUNC_ONE照片沒有顯示(全透明)

因此,如何才達到中間結果?

回答