disable depth

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

disable depth

stuntman
Hi all!

I just got started with java and opengl. I wanted to create a simple rotating cube, which wasn't too hard using     glut.glutWireCube(0.15f);
However, I would like to disable the depth perception, such that the edges in the back are equally long as the ones in the front of the cube.
There is probably an easy trick to it but I can't figure it out. I hope somebody can help me out!

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

gouessej
Administrator
gl.glDisable(GL2.GL_DEPTH_TEST);

Please read the red book a bit before jumping into OpenGL. Bye
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

Demoscene Passivist
Administrator
I think with "depth perception" u mean the "perspective projection" and not the depth test I guess ...

So to setup ur matrices correct for "non perspective rendering" u do stg like this:

        inGL.glMatrixMode(GL_PROJECTION);
        inGL.glLoadIdentity();
        inGL.glOrtho(0, XRESf, YRESf, 0, -1, 1);
        inGL.glMatrixMode(GL_MODELVIEW);
        inGL.glLoadIdentity();

The applied projection is called "orthographic" and completely eliminates any perspective effect ... guess thats was u are longing for
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

stuntman
@gouessej I already found that using Google but that is not what I was looking for.

@Demoscene
Thanks, I think that is what I meant. However, I guess that I'm doing something wrong, since I don't see any difference. I guess that I placed the code at the wrong spot, maybe you can have a look at it? http://pastebin.com/539Ltbki
I guess that it might have to do something with the gluPerspective in the reshape function, but I'm not sure.
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

stuntman
Hi all!

I solved this problem, I've gotten a much better understanding of how it works now :-)
So the next step I wanted to take was to show it on the web. For this I used guide as described on the wiki ( http://jogamp.org/wiki/index.php/Using_JOGL_in_a_Java_applet ) I compiled all my classes, created a jar file, uploaded it to the webserver. Then I modified the OneTriangleApplet.html, so basically replaced all onetriangle words to match my own, then I did the same for OneTriangleApplet.jnlp.
Now when I go to the website it runs fine for me on my macbook. However, at other pc's there seem to be some problems. Two examples, at my desktop pc which runs ubuntu, it says applet loaded but the console shows the error:
stuntman wrote
nativePrefix =   nativeSuffix = .dll
java.security.AccessControlException: access denied (java.util.PropertyPermission java.io.tmpdir read)
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
        at java.lang.System.getProperty(Unknown Source)
        at org.jdesktop.applet.util.JNLPAppletLauncher.initTmpRoot(JNLPAppletLauncher.java:1000)
        at org.jdesktop.applet.util.JNLPAppletLauncher.<clinit>(JNLPAppletLauncher.java:2110)
        at ...
Another problem that somebody else has is a bit odd, it does load the applet and shows text that is created using
gl.glRasterPos3f(x, y, z);
glut.glutBitmapString(GLUT.BITMAP_HELVETICA_12, s);
but it does not show the cube itself.

I appreciate any help!
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

Wade Walker
Administrator
Are you sure you set up the files for the non-Mac platforms correctly in your JNLP? You said it fails on Ubuntu and says this:

stuntman wrote
nativePrefix =   nativeSuffix = .dll
but on Ubuntu I'd expect to see prefix of "lib" and suffix of ".so" -- it looks like it's trying to load the Windows libraries for some reason.
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

stuntman
This post was updated on .
Wade Walker wrote
Are you sure you set up the files for the non-Mac platforms correctly in your JNLP? You said it fails on Ubuntu and says this:

stuntman wrote
nativePrefix =   nativeSuffix = .dll
but on Ubuntu I'd expect to see prefix of "lib" and suffix of ".so" -- it looks like it's trying to load the Windows libraries for some reason.
My bad, I wasn't behind the ubuntu pc so I googled the error and copied it, but forgot that apparently was produced on a windows pc. Here is the full error from my ubuntu pc:

java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
JNLPAppletLauncher: static initializer
java.security.AccessControlException: access denied (java.util.PropertyPermission java.io.tmpdir read)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
        at java.security.AccessController.checkPermission(AccessController.java:553)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
        at net.sourceforge.jnlp.runtime.JNLPSecurityManager.checkPermission(JNLPSecurityManager.java:284)
        at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
        at java.lang.System.getProperty(System.java:669)
        at org.jdesktop.applet.util.JNLPAppletLauncher.initTmpRoot(JNLPAppletLauncher.java:1056)
        at org.jdesktop.applet.util.JNLPAppletLauncher.<clinit>(JNLPAppletLauncher.java:2190)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at java.lang.Class.newInstance0(Class.java:372)
        at java.lang.Class.newInstance(Class.java:325)
        at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:713)
        at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:672)
        at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:884)
I hope this helps.
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

Wade Walker
Administrator
This looks like the applet launcher is failing because the applet doesn't have permissions to read java.io.tmpdir. Is the temp directory locked down on your system, by any chance?
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

stuntman
Hi Wade,

Thanks for your response. Hm, I don't know how to check that. But then
it would be hard to know whether it will run on a users pc. What could
be a general solution to this problem? Does the applet work for you ?

 - Niels

On Mon, Mar 12, 2012 at 1:26 PM, Wade Walker [via jogamp]
<[hidden email]> wrote:

> This looks like the applet launcher is failing because the applet doesn't
> have permissions to read java.io.tmpdir. Is the temp directory locked down
> on your system, by any chance?
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.jogamp.org/disable-depth-tp3797369p3820414.html
> To unsubscribe from disable depth, click here.
> NAML
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

Wade Walker
Administrator
If you do something like this

package tmp;
public class TempDir {
  public static void main(String[] args) {
    String tmpDir = System.getProperty("java.io.tmpdir");
    System.out.println("java.io.tmpdir: [" + tmpDir + "]");
  }
}

it will print what directory java.io.tmpdir refers to on your system. Then you just use "ls" on it to check the permissions :)

If the temp directory exists and the permissions are OK, then you might check out example "all.policy" file I demonstrate on the page http://jogamp.org/wiki/index.php/Using_JOGL_in_a_Java_applet. This shows how to grant an applet extra permissions it might need to run. I'm not sure how to do this properly in a deployable applet, though -- my example currently just shows how to run the applet locally. Maybe if your applet isn't signed properly it doesn't get all the permissions?
Reply | Threaded
Open this post in threaded view
|

Re: disable depth

Sven Gothel
Administrator
In reply to this post by stuntman
On 03/10/2012 12:56 AM, stuntman [via jogamp] wrote:

>
>
>
> Wade Walker wrote
>>
>> Are you sure you set up the files for the non-Mac platforms correctly in
>> your JNLP? You said it fails on Ubuntu and says this:
>>
>>
>> stuntman wrote
>>>
>>> nativePrefix =   nativeSuffix = .dll
>>>
>>
>> but on Ubuntu I'd expect to see prefix of "lib" and suffix of ".so" -- it
>> looks like it's trying to load the Windows libraries for some reason.
>>
>
> My bad, I wasn't behind the ubuntu pc so I googled the error and copied it,
> but forgot that apparently was produced on a windows pc. Here is the full
> error from my ubuntu pc:
>
>
>
>> OpenJDK Runtime Environment (IcedTea6 1.11pre)
>> (6b23~pre11-0ubuntu1.11.10.2)
>> OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
>> JNLPAppletLauncher: static initializer
>> os.name = linux
>> nativePrefix = lib  nativeSuffix = .so
>> java.security.AccessControlException: access denied
>> (java.util.PropertyPermission java.io.tmpdir read)
>> at
>> java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
This simply looks like you have no permissions to
read the Java property 'java.io.tmpdir'.

Too bad the SecurityException is not really telling us the origin of the
'bad access'.

Are your JOGL JAR's signed ?

Try w/ our test applets and verify.

+++

Our code's privileged access 'decorations' should have been sufficient.

Nevertheless your report triggered me to perform a review and promote
some of the property access code to a new common subclass PropertyAccess.

Within this review result, I have also added 'secure' access to 'java.io.tmpdir',
besides other 'secure' access to properties.

http://jogamp.org/git/?p=gluegen.git;a=commit;h=bab77b637e7cdd327de5f66989fcbfc0298b9b88
http://jogamp.org/git/?p=gluegen.git;a=commit;h=f4ac27e177f6deb444280d3b375e7d343e38bd08
http://jogamp.org/git/?p=gluegen.git;a=commit;h=eedb4b530fb83fc59a26962bcf7847a1404092a0

http://jogamp.org/git/?p=jogl.git;a=commit;h=7d7e7c901d8fe54af1230cbf10e568f1a8433cbe

~Sven


signature.asc (910 bytes) Download Attachment