side-by-side 3D model Viewer and Comparator

Started by 3DLover, November 30, 2015, 07:23:42 PM

Previous topic - Next topic

3DLover

Hey friends,

I am a new user of JPCT. I had a topic some month later:
http://www.jpct.net/forum2/index.php/topic,4379.msg30466.html#msg30466

in that topic, I was going to develop a "side-by-side 3D model viewer". (please see the attached image); two models should be placed side-by-side and I want those similar models rotate simultaneously around their axis As I drag the mouse to left or right.

Now I need to know how to start. I have developed a simple 3d model viewer thanks to JPCT and helps of Dear EgonOlsen.

But I do not have enough knowledge to continue the project. for example based on the recommendation of EgonOlsen I tried to understand blitting (topic mentioned above), but I couldn"t understand what does that function really do and what's the relation to side by side viewing the models!!:(

Please help me.
thanks.

EgonOlsen

Blitting itself is really easy. It simply means that you paint a 2d image onto the screen. In jPCT, this would be a texture (or a part of it). The method described in the thread is a little more complicated than that. You don't render the image onto the screen but into a texture. To do that, you assign a render target (=texture) to your framebuffer and render the scene: http://www.jpct.net/doc/com/threed/jpct/FrameBuffer.html#setRenderTarget(com.threed.jpct.Texture). After rendering into the texture, you remove the render target again http://www.jpct.net/doc/com/threed/jpct/FrameBuffer.html#removeRenderTarget(), set a a second texture as render target for your second scene and repeat the process. In the end, you have two scenes of two different models rendered into two different textures. All that's left now, is to blit these textures onto the actual screen (without any render target set).

...but before I go into even more detail: Is this for desktop Java or for Android?

3DLover

I exactly want it for Android, but i assumed that maybe it's easier for me as a "new user of  JPCT" to firstly do the whole process on Desktop and then going to Android

I hope there would be a slight amount of required changes when converting the "desktop code" to "Android code"

EgonOlsen

No, it's basically the same thing. The reason why I was asking is that the Android version supports NPOT-textures while the desktop version doesn't, and they might be useful for this. Anyway, you can start with the desktop version.

Try to get a grip on normal rendering, then on render targets and than on the rest...this might help as well: http://www.jpct.net/forum2/index.php?topic=3716.0

3DLover

Thanks for introducing NPOT-Textures. I am glad to have that option in Android. it is useful for my work.

Ok, about my main question, thanks to "Hello World" program Now I am able to load my own .obj and its texture. I can rotate my Model too. I use these codes for that purpose:

world.renderScene(buffer);
world.draw(buffer);
buffer.update();

Now I want to go to next step: RenderTarget
but I have a question before coding; when you say "In the end, you have two scenes of two different models rendered into two different textures", what Should I do in order to join those two scenes so they create a side-by-side look?
I assume that the key action for joining two scenes is inside the blit function parameters, right?

EgonOlsen

Not quite. You render one scene in one texture, the other in the other and than do two blitting operations to display them both.