Login  Register

Re: OrientedShape3D not working

Posted by unixnerd on Oct 19, 2023; 6:05pm
URL: https://forum.jogamp.org/OrientedShape3D-not-working-tp4042902p4043080.html

Still no luck with this. Any ideas? (anti-aliasing not enabled either, separate post)



		Text3D labelText = new Text3D(font3d, "test", new Point3f(0f,0f,0f));
		labelText.setAlignment(Text3D.ALIGN_CENTER);
		
		int mode = OrientedShape3D.ROTATE_ABOUT_POINT // trying flags out of desperation!
				| OrientedShape3D.ALLOW_MODE_WRITE | OrientedShape3D.ALLOW_MODE_READ
				| OrientedShape3D.ALLOW_MODE_WRITE | OrientedShape3D.ALLOW_MODE_READ
				| OrientedShape3D.ALLOW_POINT_WRITE	| OrientedShape3D.ALLOW_POINT_READ
				| OrientedShape3D.ALLOW_AXIS_WRITE	| OrientedShape3D.ALLOW_AXIS_READ;
			
		OrientedShape3D textLabelShape = new OrientedShape3D(labelText, appBlue, mode, new Point3f(0.0f,0.0f,0.0f));
						
		Transform3D labelTrans = new Transform3D();
		labelTrans.rotX(Math.PI);
		labelTrans.setScale(.05);		
		labelTrans.setTranslation(new Vector3f((float)e.x3d, (float)e.y3d, (float)e.z3d));
		
		TransformGroup textLabelTransform = new TransformGroup(labelTrans);
		textLabelTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
		textLabelTransform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
		textLabelTransform.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
		textLabelTransform.addChild(textLabelShape);
		
		BranchGroup newGroup = new BranchGroup();		
		newGroup.setCapability(BranchGroup.ALLOW_DETACH);
		newGroup.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
		newGroup.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE);
		newGroup.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND); 
		newGroup.addChild(textLabelTransform);
		newGroup.compile();

		tg.addChild(newGroup);