Have jReality programming problems or questions? Post them here.
-
argo2185
- Posts: 16
- Joined: Thu 4. Mar 2010, 14:24
Post
by argo2185 » Thu 12. Aug 2010, 17:18
Hello,
i'm creating a closed clinder with this code:
Code: Select all
SceneGraphComponent stu = Primitives.closedCylinder(10, 5, 10, 10 , Math.PI*2);
SceneGraphComponent sgc = SceneGraphUtility.createFullSceneGraphComponent();
Appearance appearance = sgc.getAppearance();
DefaultGeometryShader dgs = ShaderUtility.createDefaultGeometryShader(appearance, false);
dgs.setShowPoints(false);
dgs.setShowLines(false);
dgs.setShowFaces(true);
DefaultPolygonShader dps = (DefaultPolygonShader) dgs.createPolygonShader("default");
dps.setDiffuseColor(Color.RED);
dps.setTransparency(0.5);
The problem is that the cylinder is not transparent. What i'm doing wrong?
Is it possible to set certain coordinates for the central point of the cylinder and then to translate the cylinder by changing the center position?
-
steffen
- Posts: 186
- Joined: Fri 16. Jun 2006, 13:30
- Location: TU Berlin
-
Contact:
Post
by steffen » Thu 12. Aug 2010, 18:37
You have to enable transparency in the RenderingHintsShader:
Code: Select all
RenderingHintsShader rhs = ShaderUtility.createDefaultRenderingHintsShader(appearance, false);
rhs.setTransparencyEnabled(true);
This is because OpenGL does not enable transparent rendering by default. And there is also no depth buffer sorting, so you probably also want to turn on back face culling:
Steffen.
-
argo2185
- Posts: 16
- Joined: Thu 4. Mar 2010, 14:24
Post
by argo2185 » Thu 12. Aug 2010, 22:43
i see. but the u3d exporter does not support transparency for cylinder?
is there an alternative way to create something like a cylinder but with transparency in PDF?
-
argo2185
- Posts: 16
- Joined: Thu 4. Mar 2010, 14:24
Post
by argo2185 » Fri 13. Aug 2010, 10:14
sry, my fault. with the RenderingHintsShader is everything working, also in pdf.