Hi Kelvin,
>>It seems that I found a bug in the immediate mode appearance setting. When I
>>set appearance that has RenderingAttributes.setVisible(false) to disable
>>certain geometries and then set different appearance that does not have
>>RenderingAttributes object, the following geometries are still not visible
>>until I set appearance with RenderingAttibutes.setVisible(true). This bug
>>obviously has easy workaround, so I guess it's a low priority one.
>>
>Do you mean using graphicsContext3d.setAppearance(app1)
>where app1 rendering attributes visible = false
>then switch to use another app2 with visible = true
>and then switch back to app1 ? Please give us a
>sample code to reproduce it.
No. I have a number of shapes that I am drawing in immediate mode. So let's say the first one has the appearance (app1) that has rendering attributes visible = false. I set the appearance using graphicsContext3d.setAppearance(app1). Then, for the next shape, I have the appearance (app2) that does not have any rendering attributes, so it should be visible by default. I call graphicsContext3d.setAppearance(app2), but the geometry that is drawn subsequently is not visible. However, if I create rendering attributes with visible = true and set it to app2, then the geometry is visible. Here is the example of my workaround code:
GraphicsContext3D context = ...;
Appearance appearance = ...;
Geometry geometry = ...;
if (appearance != null && appearance.getRenderingAttributes() == null) {
RenderingAttributes rndAttr = new RenderingAttributes();
rndAttr.setVisible(true);
appearance.setRenderingAttributes(rndAttr);
}
context.setAppearance(appearance);
context.draw(geometry);
I've been also seeing similar problem in the retained mode. The sequence is the same while it applies to the same shape using shape3D.setAppearance(app). Again when setting appearance with no rendering attributes after appearance was set with rendering attributes visible = false, shape will be not visible. Maybe it's a feature then? :-)
I've also found similar problem with coloring attributes not resetting to default in immediate mode and thus affecting texture blending. However these problems are hardware dependent, but easily reproducible on most NVidia cards (TNT2, GeForce2MX). On these cards immediate mode renderer also has problems sending texture coordinates that were set with geometry. This can be worked around by using TexCoordGeneration object in appearance. I report that in this fast fashion because I believe these can be linked together, just in case you will be looking at these bugs soon.
I will work on the example application that will demonstrate all these bugs an send it to you as soon as I can.
- Yuri
