Has any function could set the ViewPort into the special region?
I try to use the ‘cam.setViewPort’ to cut the screen into two triangles (drawed as below), but I can only cut the viewport into two squares (just like what we can see in “Dynasty Warriors”, 2 players).
Render to texture as a workaround? (works now, test case available, lose about 50% of fps, but hey…)
Btw … what’s with the timing of two view ports or two cameras? I mean, at 10 fps - is one image 10% in the past compared to the other image? (just curious, because this whole timings question will become interesting for me soon)
Sorry, did not want to derail this thread, but did not want to lose that thought either.
The thought is as follows:
a) render two viewports or two textures
b) have a situation where fps are low (e.g. 10)
c) 1st render is 0.1 seconds prior to the 2nd render
d) result: time gap: one image is 0.1 sec old, other image 0.2 sec old.
d) if both should be at same point in time - how to fix it?
(idea 1: stop time, render both, continue)
(idea 2: prevent low frame rates at all cost)
I just did not need so much fine control until now and assumed that you can’t render into two textures in parallel at exactly the same time. Maybe I will open a new topic when my “frozen game logic” feature is about to be needed. Thanks for now, but I think I officially derailed this thread - sorry. :chimpanzee_nogood:
One idea is to use “render to texture”.
Here is an example: jme3test.post.TestRenderToTexture.java
You render to texture Texture1 with your Cam1.
You render to texture Texture2 with your Cam2.
You then make a “custom mesh” for triangle Triangle1 for Cam1.
You then make a “custom mesh” for triangle Triangle2 for Cam2.
Triangle1 uses Texture1, and Triangle2 uses Texture2.
You then attach the Triangle1 and Triangle2 to the “guiNode”.
It is a little bit slow - you will lose some “frames per second” because you render 2 images and will not use the full image (only one half is used - triangle instead of rectangle). But it can be done.
Maybe someone can make an example. Maybe I can make an example during this week.
Your mesh is only 1 pixel big and it has no texture coordinates.
Probably better just to use Quad since it will setup all of the mesh-related stuff properly.
(Edit: I see now that you are making a triangle… still, the rest of the stuff I said is true. You can look at Quad.java to see how to set things up for a single triangle… though from your original screen shot you actually want a trapezoid so a Quad may be a better place to start.)