Porting RoomTiny to Jogl

classic Classic list List threaded Threaded
40 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Porting RoomTiny to Jogl

elect
Hi,

I am trying to port the roomTiny example from the Oculus SDK to Jogl

I already ported most of the program, but I am stuck on an annoying bug since a couple of days and I am going crazy

After a couple of days, I tried to make a new simplified copy in order to find the bug, but I experience exactly the same..

I ask if someone out there would like to help me

I can render properly only the floor or the ceiling, not both

https://github.com/elect86/JavaOculusRoomTiny/tree/master/src/roomTinySimplified

Only floor



Only ceiling



Both



The program is pretty simple, there is (at the moment) only one glsl program for litTextures

You add Model and in the rendering loop you update lights (in an ubo) and loop the models themselves rendering them

In the same model rendering, I initialize everything about, vbo, ibo and texture

The vbo data are 100% exact, I scanned each vertex attribute one by one..

Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

gouessej
Administrator
This post was updated on .
Hi

I'm looking at your source code right now. I see nothing obviously wrong. I'm going to give it a try.

Edit.: The data are correct but the rendering is wrong. When I change the order in which the models are added, the second one is always badly renderer.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
gouessej wrote
Hi

I'm looking at your source code right now. I see nothing obviously wrong. I'm going to give it a try.

Edit.: The data are correct but the rendering is wrong. When I change the order in which the models are added, the second one is always badly renderer.
Hi gouessej,

thanks

I spent something like 10 hours looking for the bug, I really cant understand..

I also tried to modify the code in order to see which part of the floor process corrupt the ceiling and it was funny, because as soon as I generate the vbo for the floor and nothing mode (really only the glGenBuffer call, no ibo init, no texture render, no render, nothing else) regarding the floor, the ceiling is broken..
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

gouessej
Administrator
I haven't found the culprit, sorry. This is typically the kind of source code I write once and I forget when I implement the JOGL renderer of an engine. The frustum and the data are correct, there is probably something wrong in the way shaders are used, maybe the uniforms.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
OMG I found it!!

the fu''ng error was

gl3.glDrawElements(GL3.GL_TRIANGLES, indices.size(), GL3.GL_UNSIGNED_INT, ibo[0]);

instead

gl3.glDrawElements(GL3.GL_TRIANGLES, indices.size(), GL3.GL_UNSIGNED_INT, 0);

I wrote in the last field, offset, the value of the ibo index.. shame on me

Now the "only" problem is the lighting on the solid geometry..

Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

gouessej
Administrator
I'm silly, I should have found it. Great job.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
gouessej wrote
I'm silly, I should have found it. Great job.
I really appreciated you give a try.
I found that after 2 full days looking the same code..

So, I think to be in a pretty good position to say "I made it"




What is left is fixing lighting on non-texture object (but I dont care at the moment) and flip it...

It is strange, because dumping the content of the off-screen framebuffer texture I get it right, but when I distort on the monitor it I get it flipped

If I rotate the oculus up and down in the world space it rotates properly, left/right instead is flipped

So where am I supposed to modify the code?
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
Another question.. is it possible to capture the mouse pointer?

I mean, image using the mouse to rotate your shoulders moving the mouse, I would like to make it an infinite movement. The problem right now is that as soon as it reaches the end of the screen, you cant turn anymore since the mouse cant move any longer..
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

gouessej
Administrator
Yes there are several ways of capturing the mouse pointer, I advise you to look at how this is implemented in JogAmp's Ardor3D Continuation. It's tricky to implement with AWT, it's a lot easier to implement with NEWT, with GLWindow.warpPointer().
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
In reply to this post by elect
Forgot to say, in the meanwhile I fixed the upside down and other glitches and now it is working like a charm

Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

gouessej
Administrator
Good job :)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

Sven Gothel
Administrator
In reply to this post by elect
On 08/15/2014 04:10 PM, elect [via jogamp] wrote:
> Forgot to say, in the meanwhile I fixed the upside down and other glitches and
> now it is working like a charm
>

KUDOS

Any idea how we might deploy it for demo ?

We could use applet/webstart,
maybe also adding a selection upfront to choose the stereo device?

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
Sven Gothel wrote
KUDOS

Any idea how we might deploy it for demo ?
No

I saw the user that made the java port (jherico) is using maven, and I have exactly zero knowledge about it ^^

https://github.com/jherico/jocular-examples

Sven Gothel wrote
We could use applet/webstart,
maybe also adding a selection upfront to choose the stereo device?

~Sven
Sure, why not, unfortunately I cannot help you much on these topics..

The selection of the oculus appears to be internal to the sdk..


signature.asc (828 bytes) <http://forum.jogamp.org/attachment/4032798/0/signature.asc>

Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

Sven Gothel
Administrator
On 08/18/2014 09:26 AM, elect [via jogamp] wrote:

>
>     Sven Gothel wrote
>     We could use applet/webstart,
>     maybe also adding a selection upfront to choose the stereo device?
>
>     ~Sven
>
> Sure, why not, unfortunately I cannot help you much on these topics..
>
> The selection of the oculus appears to be internal to the sdk..
I just checked .. I see,
you are not using our StereoClientRenderer w/ OculusVR support
but some other OVR binding, well.

If you would move to our stereo renderer, see StereoDemo01 (unit test demo),
and maybe our Siggraph 2014 slides,
generic stereo rendering and using OculusVR is possible.

Would be great if you could do that.

BTW, I could the heads up from one Processing developer,
that he could integrated our StereoClientRenderer successfully.

Cheers, Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
Sven Gothel wrote
On 08/18/2014 09:26 AM, elect [via jogamp] wrote:
>
>     Sven Gothel wrote
>     We could use applet/webstart,
>     maybe also adding a selection upfront to choose the stereo device?
>
>     ~Sven
>
> Sure, why not, unfortunately I cannot help you much on these topics..
>
> The selection of the oculus appears to be internal to the sdk..

I just checked .. I see,
you are not using our StereoClientRenderer w/ OculusVR support
but some other OVR binding, well.

If you would move to our stereo renderer, see StereoDemo01 (unit test demo),
and maybe our Siggraph 2014 slides,
generic stereo rendering and using OculusVR is possible.

Would be great if you could do that.

BTW, I could the heads up from one Processing developer,
that he could integrated our StereoClientRenderer successfully.

Cheers, Sven
Yeah, I could when I will have some spare time, anyway the thing is the oculus example has a lot of processing inside, included a timewarp correction, motion prediction, gamma correction, etc..

Moreover, I get the distorted meshes directly from the sdk based on the oculus type (dk1 or dk2)
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

Sven Gothel
Administrator
On 08/19/2014 10:51 AM, elect [via jogamp] wrote:
> Yeah, I could when I will have some spare time, anyway the thing is the oculus
> example has a lot of processing inside, included a timewarp correction, motion
> prediction, gamma correction, etc..
Should be no problem .. hmm.
But if anything in our OVR is missing, pls tell me - so I can add.

>
> Moreover, I get the distorted meshes directly from the sdk based on the oculus
> type (dk1 or dk2)

Our binding operates similar, i.e. using OVR client rendering,
a.k.a using the VBO distortion mesh!

We do not support OVR rendering passing a GL context to the OVR SDK,
since this simply will not work w/ any GL context (EGL, GLX, ..).
And dealing w/ GL is surely 'our' task.

Ofc, I need to update the OVR SDK to the latest version,
clearly my TODO soon :)

Still waiting for the DK2 .. hmm.

~Sven



signature.asc (828 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

BrickFarmer
In reply to this post by elect
I'm trying to get this running from the command line under OSX.  i.e. ant build.  My ant skills are a bit rusty but I've added JOGL:

<path path="@{classpath};jogl-lib/jogl-all.jar"/>

but now I'm seeing a dependency I cant work out:

    [javac] /Users/peter/Downloads/JavaOculusRoomTiny-master/src/oculusRoomTiny/rendering/GlViewer.java:16: error: package jglm does not exist
    [javac] import jglm.Jglm;

Do you know what jar file I need for this one please?

Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
BrickFarmer wrote
I'm trying to get this running from the command line under OSX.  i.e. ant build.  My ant skills are a bit rusty but I've added JOGL:

<path path="@{classpath};jogl-lib/jogl-all.jar"/>

but now I'm seeing a dependency I cant work out:

    [javac] /Users/peter/Downloads/JavaOculusRoomTiny-master/src/oculusRoomTiny/rendering/GlViewer.java:16: error: package jglm does not exist
    [javac] import jglm.Jglm;

Do you know what jar file I need for this one please?
You should checkout two projects here

https://github.com/elect86

Jglm and unofficialJavaSdk

or if you lazy and want it immediately ^^ you can get all the jars here

https://mega.co.nz/#!KAE00bAS!HUV6nUjBKSzqGQF8y8KQKLMhHsWlszUrOOQn1XLWDRo
Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

BrickFarmer
elect wrote
You should checkout two projects here

https://github.com/elect86

Jglm and unofficialJavaSdk

or if you lazy and want it immediately ^^ you can get all the jars here

https://mega.co.nz/#!KAE00bAS!HUV6nUjBKSzqGQF8y8KQKLMhHsWlszUrOOQn1XLWDRo
Thanks! You have been busy :) I took the trouble to build them, but found some more dependencies.  I couldn't extract the .7z (unsupported method of compression using Zipeg under OSX) but I was able to see the file names :)  I've tracked down and built all the dependencies. The code builds, and now I'm trying to run the code, but I get an error on the native linking:

java -cp dist/OculusRoomTiny.jar:lib/jogl-all.jar:lib/Jglm.jar:lib/javaUnofficialOpenglSDK.jar:lib/jovr-0.4.1.2-SNAPSHOT.jar:lib/jna-3.0.9.jar:lib/gluegen-rt.jar:gluegen-rt-natives-macosx-universal.jar:jogl-all-natives-macosx-universal.jar -Djava.library.path=lib roomTinySimplified.core.OculusRoomTiny
setupOculus()
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'OVR_C': dlopen(libOVR_C.dylib, 1): image not found

I have libovr.a in lib directory, what else am I missing please?

I also tried the 'non-simple' demo but get the following...


java -cp dist/OculusRoomTiny.jar:lib/jogl-all.jar:lib/Jglm.jar:lib/javaUnofficialOpenglSDK.jar:lib/jovr-0.4.1.2-SNAPSHOT.jar:lib/jna-3.0.9.jar:lib/gluegen-rt.jar:gluegen-rt-natives-macosx-universal.jar:jogl-all-natives-macosx-universal.jar -Djava.library.path=lib oculusRoomTiny.core.OculusRoomTiny
init
Exception in thread "main-AWTAnimator" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: javax.media.opengl.GLException: Caught GLException: Not a GL3 implementation on thread main-AWTAnimator
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:84)


Reply | Threaded
Open this post in threaded view
|

Re: Porting RoomTiny to Jogl

elect
BrickFarmer wrote
elect wrote
You should checkout two projects here

https://github.com/elect86

Jglm and unofficialJavaSdk

or if you lazy and want it immediately ^^ you can get all the jars here

https://mega.co.nz/#!KAE00bAS!HUV6nUjBKSzqGQF8y8KQKLMhHsWlszUrOOQn1XLWDRo
Thanks! You have been busy :) I took the trouble to build them, but found some more dependencies.  I couldn't extract the .7z (unsupported method of compression using Zipeg under OSX) but I was able to see the file names :)  I've tracked down and built all the dependencies. The code builds, and now I'm trying to run the code, but I get an error on the native linking:

java -cp dist/OculusRoomTiny.jar:lib/jogl-all.jar:lib/Jglm.jar:lib/javaUnofficialOpenglSDK.jar:lib/jovr-0.4.1.2-SNAPSHOT.jar:lib/jna-3.0.9.jar:lib/gluegen-rt.jar:gluegen-rt-natives-macosx-universal.jar:jogl-all-natives-macosx-universal.jar -Djava.library.path=lib roomTinySimplified.core.OculusRoomTiny
setupOculus()
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'OVR_C': dlopen(libOVR_C.dylib, 1): image not found

I have libovr.a in lib directory, what else am I missing please?

I also tried the 'non-simple' demo but get the following...


java -cp dist/OculusRoomTiny.jar:lib/jogl-all.jar:lib/Jglm.jar:lib/javaUnofficialOpenglSDK.jar:lib/jovr-0.4.1.2-SNAPSHOT.jar:lib/jna-3.0.9.jar:lib/gluegen-rt.jar:gluegen-rt-natives-macosx-universal.jar:jogl-all-natives-macosx-universal.jar -Djava.library.path=lib oculusRoomTiny.core.OculusRoomTiny
init
Exception in thread "main-AWTAnimator" com.jogamp.opengl.util.AnimatorBase$UncaughtAnimatorException: javax.media.opengl.GLException: Caught GLException: Not a GL3 implementation on thread main-AWTAnimator
        at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:84)

Ah, are you on mac os? Shit I guess that error sounds like sdk related... which dk you have? Have you been successfully running a demo?
12