W810 compositing mode alpha bug

 FW: http://developer.sonyericsson.com/thread.jspa?threadID=39278&tstart=0

boinged

Posts: 96
Registered: 4/1/04
 W810 compositing mode alpha bug
Posted: Apr 18, 2007 4:43 AM
 
 Click to reply to this thread Reply

I've just experienced a very strange issue on this device where ALPHA and MODULATE compositing mode blendings are reverting to REPLACE when another compositing mode is used with the REPLACE mode.

Here's a test summary.

I have a simple quad mesh with a 24-alpha texture applied to it. The texture is loaded as an Image to get around the Loader bug.
midpImg = Image.createImage("/tex.png");
image2d = new Image2D(Image2D.RGBA, midpImg);
texture = new Texture2D(image2d);
texture.setBlending(Texture2D.FUNC_REPLACE);
compositingMode.setBlending(CompositingMode.ALPHA);


Another similar mesh has a non-transparent texture, loaded exactly the same way, the only difference being:
compositingMode2.setBlending(CompositingMode.REPLACE);


1) When I draw just the alpha mesh, it looks as expected - with the background showing through the transparent parts of the texture.

2) When I draw the solid mesh before the alpha mesh, the transparent parts become black which is the transparent colour value. The background colour is different - so it's not the background I'm seeing.

3) When I now stop drawing the solid mesh, the alpha mesh is still drawn non-transparent.

Even creating the transparent mesh on the fly during each render frame results in the same issue.

As a further test I changed the first mesh to use CompositingMode.MODULATE, to try and pin down the issue. The same problem occurs - 1) it's ok, 2) it reverts to REPLACE, 3) it gets permanently stuck in REPLACE mode.

These tests were done with a background colour clear only. Each compositing mode additionally has:
compositingMode.setDepthTestEnable(false);
compositingMode.setDepthWriteEnable(false);


Setting all compositing modes to use ALPHA blending works but slows the framerate down to an unacceptable level.

Has anyone seen anything like this or thinks they can explain what is going wrong?
Are there any workarounds besides my one?

SonyEricsson: I've not tried any other Java Platform 5 devices but is it a known issue of these?

bjourne

Posts: 8
Registered: 3/6/07
 Re: W810 compositing mode alpha bug
Posted: Jun 15, 2007 6:25 AM   in response to: boinged
 
 Click to reply to this thread Reply

I'm not able to reproduce your problem. Does it make any difference what textures you are using or how you load them? Could you post a full code example, that demonstrates the bug?

boinged

Posts: 96
Registered: 4/1/04
 Re: W810 compositing mode alpha bug
Posted: Jun 15, 2007 1:39 PM   in response to: bjourne
 
 Click to reply to this thread Reply

I'll see if I can put some test code together. This kind of test app is starting to look useful with the amount of weird bugs I get :) I suspect there are underlying bugs in the device's software renderer that only become apparent when you have certain combinations of textures/appearances/compositing modes/polygon modes etc.

The textures are indexed but I also have an RGBA image for a different texture and this has the same problem. They're not being loaded with Loader.load().

It's very strange: W710, K800 are fine. K610, W810 are broken.

boinged

Posts: 96
Registered: 4/1/04
 Re: W810 compositing mode alpha bug
Posted: Jun 19, 2007 12:28 PM   in response to: boinged
 
 Click to reply to this thread Reply

I've managed to solve this but there seems to be a bug with this firmware (R1AA049) as I don't need the workaround for a different K610 device I tried.

In my sample code I paint a quad with an opaque texture, then one with a transparent texture.

If depth writing is turned off for the opaque quad then the 2nd quad doesn't appear transparent unless FUNC_MODULATE is used for the blending mode

This is irrespective of whether a depth buffer is even used!

Can anyone explain why this would happen? Maybe then I can find a better workaround because I'd rather not use modulate unless I have to.

	private static final void initTest1()
{
try
{
CompositingMode solidCompositing = new CompositingMode();
solidCompositing.setBlending(CompositingMode.REPLACE);
solidCompositing.setColorWriteEnable(true);
solidCompositing.setAlphaWriteEnable(false);
solidCompositing.setDepthTestEnable(false);
// solidCompositing.setDepthWriteEnable(false);

CompositingMode transparentCompositing = new CompositingMode();
transparentCompositing.setBlending(CompositingMode.ALPHA);
transparentCompositing.setColorWriteEnable(true);
transparentCompositing.setAlphaWriteEnable(false);
transparentCompositing.setDepthTestEnable(false);
// transparentCompositing.setDepthWriteEnable(false);

Texture2D solidTexture = null, transparentTexture = null;
Appearance solidAppearance = new Appearance(), transparentAppearance = new Appearance();

solidTexture = loadTexture("solid", Texture2D.FUNC_REPLACE);
solidAppearance.setTexture(0, solidTexture);
solidAppearance.setCompositingMode(solidCompositing);
solidMesh = createQuad(solidAppearance, 100, 100);

transparentTexture = loadTexture("transparent", Texture2D.FUNC_REPLACE);
transparentAppearance.setTexture(0, transparentTexture);
transparentAppearance.setCompositingMode(transparentCompositing);
transparentMesh = createQuad(transparentAppearance, 50, 50);
}
catch(Exception e)
{
e.printStackTrace();
}

bg.setDepthClearEnable(false);
bg.setColorClearEnable(false);
}

private static final Texture2D loadTexture(String filename, int mode)
{
Texture2D tex = null;

try
{
tex = new Texture2D(new Image2D(Image2D.RGBA, Image.createImage("/"+filename+".png")));
tex.setBlending(mode);
}
catch(Exception e)
{
e.printStackTrace();
}

return tex;
}
public void paint(Graphics g)
{
g.setColor(0xff0000);
g.fillRect(0, 0, getWidth(), getHeight());

try
{
g3d.bindTarget(g);
g3d.clear(bg);
g3d.render(solidMesh, null);
g3d.render(transparentMesh, null);
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
g3d.releaseTarget();
}
}


资源下载链接为: https://pan.quark.cn/s/3d8e22c21839 随着 Web UI 框架(如 EasyUI、JqueryUI、Ext、DWZ 等)的不断发展与成熟,系统界面的统一化设计逐渐成为可能,同时代码生成器也能够生成符合统一规范的界面。在这种背景下,“代码生成 + 手工合并”的半智能开发模式正逐渐成为新的开发趋势。通过代码生成器,单表数据模型以及一对多数据模型的增删改查功能可以被直接生成并投入使用,这能够有效节省大约 80% 的开发工作量,从而显著提升开发效率。 JEECG(J2EE Code Generation)是一款基于代码生成器的智能开发平台。它引领了一种全新的开发模式,即从在线编码(Online Coding)到代码生成器生成代码,再到手工合并(Merge)的智能开发流程。该平台能够帮助开发者解决 Java 项目中大约 90% 的重复性工作,让开发者可以将更多的精力集中在业务逻辑的实现上。它不仅能够快速提高开发效率,帮助公司节省大量的人力成本,同时也保持了开发的灵活性。 JEECG 的核心宗旨是:对于简单的功能,可以通过在线编码配置来实现;对于复杂的功能,则利用代码生成器生成代码后,再进行手工合并;对于复杂的流程业务,采用表单自定义的方式进行处理,而业务流程则通过工作流来实现,并且可以扩展出任务接口,供开发者编写具体的业务逻辑。通过这种方式,JEECG 实现了流程任务节点和任务接口的灵活配置,既保证了开发的高效性,又兼顾了项目的灵活性和可扩展性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值