Can we draw a cylinder in ortho mode?


Hi, can we draw a Cylinder in ortho mode?

My cylinder I am trying to draw is like this.

        Cylinder xCyl  = new Cylinder();
        xCyl.setRenderQueueMode(Renderer.QUEUE_ORTHO);
        xCyl.setLocalTranslation(new Vector3f(70, 70, 0));
        xCyl.setRadius(100);
        xCyl.setHeight(200);
        rootNode.attachChild(xCyl);

It does not show up...

Hmm, it seems that its Z coordinate is too small… Maybe it is not showing up because it is being culled… Try changing the positions/size to something that you know will be visible.

         

What is the reason for this cylinder not show up but quad to show up?



            Cylinder xCyl  = new Cylinder();

            xCyl.setSolidColor(ColorRGBA.white);

            xCyl.setCullMode(SceneElement.CULL_NEVER);

            xCyl.setRenderQueueMode(Renderer.QUEUE_ORTHO);

            xCyl.setLocalTranslation(new Vector3f(100, 100, 0));

            xCyl.setRadius(0.5f);

            xCyl.setHeight(0.5f);

            xCyl.updateGeometricState(0, true);

            xCyl.updateRenderState();

            rootNode.attachChild(xCyl);

           

            Quad t = new Quad("quad", 100, 100); 

t.setRenderQueueMode(Renderer.QUEUE_ORTHO);

t.setLocalTranslation(new Vector3f(200, 200, 0));

rootNode.attachChild(t);

           

By the way,



the radius and height, I have tested with many values such as 10, 50, 500…

if you draw a closed cylinder, and move it further into the screen, you can see its there.


        Cylinder xCyl  = new Cylinder("cyl", 10, 10, 200, 200, true, false);
        xCyl.setRenderQueueMode(Renderer.QUEUE_ORTHO);
        xCyl.setLocalTranslation(new Vector3f(100, 100, -100));
        rootNode.attachChild(xCyl);


Why do you have to move it away from the camera?

By the way, when you rotate this closed cylinder 90, the body of the cylinder does not show.

Its body is empty !!!


No, I guess I had to adust Z direction because of the rotation, like this.

            Cylinder xCyl  = new Cylinder("cyl", 10, 10, 200, 200, true);
            xCyl.setRenderQueueMode(Renderer.QUEUE_ORTHO);
            xCyl.setLocalTranslation(new Vector3f(400, 400, -199));
            Matrix3f rot = new Matrix3f();
            rot.fromAngleAxis((float) -Math.PI / 2, Vector3f.UNIT_Y);
            xCyl.setLocalRotation(rot);
            rootNode.attachChild(xCyl);

What is the dimension like in z-direction?



What I want to do is rotate an object in-place so that it is stuck to a certain corner of the screen.



As the object rotates in-place, it seems as though I have to adjust the z-direction, too.



Does anyone know what the exact dimensions of the Z coordinate in Ortho system (or reason for having to adjust z-coordinate)?


Another problem with ortho mode:

If I rotate a cylinder so that its top faces toward the camera, it loses its color and turns into black.

Did someone ever have these kind of problems in ortho mode?

Is ortho good for only texts?

In the ortho render queue (2D ortho) you can see only the vertices that have a z coordinate of 0. If you need 3D ortho, you need to change your camera setting to parallel projection.


My camera was already in parallel projection.

ok, and you did not use the ortho queue? (setRenderQueue(Renderer.ORHTO))


I used spatial.setRenderQueMode(Renderer.QUEUE_ORTHO) as you can see above.

As far as setRenderQue(Renderer.ORTHO) ?? You mean this, right?

I see. Don't do that! :slight_smile:



The render queue ortho (setRenderQueMode(Renderer.QUEUE_ORTHO)) is for 2D ortho (like HUD, Quads etc.).


I see.

Ortho is intended for displaying flat objects.

Thanks