[英]o3d textures and transparency
I'm working at galery on o3d(plagin version) and I need make photos transparent. 我在o3d(原始版本)的galery工作,需要使照片透明。 Photos are on hud.
照片在平视显示器上。 Here is some code:
这是一些代码:
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();
But it doesn't work. 但这是行不通的。 When setting paramOne.value = BLENDFUNC_ZERO photo displays (non-transparent)
设置paramOne.value = BLENDFUNC_ZERO时,照片显示(不透明)
paramOne.value = BLENDFUNC_ONE photo isn't displayed (full transparent) paramOne.value =未显示BLENDFUNC_ONE照片(完全透明)
So how to achive intermediate result? 那么如何获得中间结果呢?
Given that the O3D plug-in is deprecated in favor of the WebGL-based O3D , is it an option for you to migrate to the latter ? 鉴于不赞成使用O3D插件,而建议使用基于WebGL的O3D ,是否可以选择迁移到后者 ?
If so, you can inquire in the discussion group about the transparency issue (if it still exists under O3D-WebGL). 如果是这样,您可以在讨论组中查询有关透明性的问题(如果在O3D-WebGL下仍然存在)。 The developers are very responsive.
开发人员反应迅速。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.