Hey, I am new with OpenGL and I am trying to make an app for Android. The app is for the ODG R7 glasses, and I want to render an object twice, in order to have the left view and the right view for stereoscopy rendering. My problem is that I don´t know how to implement the glViewport() in Android (using JAVA) twice in the same GLSurfaceView. I’ve seen tutorials and posts solving this problem, but it is for OpenGL in C++ or C, which is totally different. In those forums and tutorials I can see that glViewport() is called more than once, and that they can have different views in the same GLSurfaceView. What I find problematic, is that in Android, glViewport() must be called in the onSurfaceChanged() method once, and that’s it. If I called again glViewport() later in my code, then it delets the previous object, and I end up with just one object, instead of two.
I already tried using glScissor(), but that’s not what I want. I also tried to render the same object twice and then do a translation, but it doesn’t work the way I want, the object ends with a different perspective, and also it’s hard to know the exact value for translation. I need to use glViewport() because I can render the object in half the width of the screen and have the object centered in each half, which is very important for the stereoscopy rendering.
The other solution I already tried was to make two different GLSurfaceViews, and I can see both objects, in the left of the screen and in the right. The big problem is that they are not synchronized because they are different java objects, and that’s important also.
P.D. Sorry for my english, it is not my native lenguage. Thanks