how can i split the screen in two, using awt.canvas ?, i mean instead to print the screen in the whole area i would like to print that same twice like vr games.
Like most things in programming, there are about a hundred different ways to do this, and which way is right for you depends more on you than anything. So the best thing you can do is researching and trying things out.
Two approaches occur to me:
Approach one: just draw stuff twice.
Approach two: draw to a buffer, and then draw that buffer twice.
There are probably other ways to do this, and Google should really be your first stop for questions like this. Also note that VR games aren’t just drawing the same thing twice; they’re drawing the same scene from slightly different angles.
thanks for your answer, i googled but i could not fin anything useful thats what im asking here, some times i would appreciate to pleople respond only what posters are asking, sometimes, if somebody is asking its because does not have any single idea of what to do, and u say google it, yes thats true but if u dont know a cat you wont realize it just passed one before you a moment ago.
but thanks man i appreciate your answer, however, do you have an idea of how draw buffer twice?
PD: when i googled, there is how to create VR but for android, not for Java SE
Download LWJGL3, make sure you get the OpenVR or OVR bindings.
- Get the left eye view matrix from the headset
- Render the scene using the left eye view matrix
- Pass the texture buffer to the headsets left eye
- Get the right eye view matrix from the headset
- Render the scene using the right eye view matrix
- Pass the texture buffer to the headsets right eye
- If its OpenVR, update the HMD matrix pose, if OVR, find the equivalent function.
You need to break your problem down into smaller steps and then approach those steps one at a time. Something like “vr Java” is way too broad, so you aren’t going to find anything very useful with that.
You’ve already narrowed it down to a step of drawing the same scene twice (with the caveat that that’s not how VR works). And you’ve been given a couple of approaches for how to tackle that. Have you tried googling that? Something like “java swing buffer” will return a bunch of results, and you can use those results to refine your approach. Then if you get stuck, you can come back here with a specific question and a small example program that shows us exactly what you’re trying to do. Good luck.