I use an quad to render an maze in background (same from the other post), currently its working but I fell this is a bit out of square. Since this quad will be only used to take the picture of the render and used in another quad I was looking for a more precise way to do it.
Also I did notice this quad shows diferent from pc to android, it seens the only way to fix it is to calculate right the fustrum.
I found this formula in the Unit wiki :
I guess I just need to replace camera.fieldOfView to this camera.getViewProjectionMatrix().m11 …
I will try it out.
So you only want the maze in the background when doing a screen shot? Why not just layer the maze behind the screen shot image separately then? Either paint it to the framebuffer as a separate viewport or just layer them at runtime or something.
Either way, full screen quad almost always means ‘background viewport’ to me.
But if it were a viewport then you could just render it in the guiNode and make it exactly the screen size. You’d never have this problem (and indeed you will never have rounding errors or anything else should the view ever change slightly).
Displaying a full screen quad in 3D is the hardest way to achieve what it sounds like you want to end up with.
You are right, I test it, if I use the guiNode it fills the entire screen…
But… I am planning for example, to put some special effects using accelerometer, like if the user “topple” the mobile down a bit, I rotate the backgroud maze into this direction for bether visualization… I dont think its possible to rotate something on guiNode is it ?
So I think my only solution is to make the quad to fill the entire screen and add it to rootnode…
Its kind of working, but for square quads ( width=heigh ) it shows right but keeping the quad ratios ( square with empty space at left and right). And for square quads ( width>height ) it shows the square at the middle with empty spaces all arround. Maybe your function was done for voxel, I think it needs some ajusts right ?
Obs: I can use the same approach, actually its even better to change the camera position using an determined quad size, since I can use more intuitive sizes for it.
Its hard to explain the effect I am planning.
I am planning to atach small 3d objects to the same node of this maze 2d Board, like pickabes, monsters, etc, they will show very small in the screen, but still, when the player pushes the board for some direction it supouse to rotate the board and all other objects attached to it, its easy to do if its in rootnode, but I am not sure if it will work on guinode…
sizex=1024; sizey=1024; // x=y need to be equal for this to work;
Main.ref_cam.setFrustumPerspective(70f, 1, 1, 10000f);
Utils.cameraLookToSquare(Main.ref_cam, new BoundingBox(new Vector3f(-sizey/2,-sizex/2,0),new Vector3f(sizey/2,sizex/2,0)));
Quad quadmesh = new Quad(sizex, sizey);
I am not sure if this is the best way, but its working well.