Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: ? Clipping Planes and Depth Buffers with gluPerspective() ?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Intern Contributor
    Join Date
    Jul 2008

    ? Clipping Planes and Depth Buffers with gluPerspective() ?

    I'm trying to draw a space scene where I can be very close to one object and yet see another object far away. I've been developing my application in JOGL (Java OpenGL bindings) and upto now I was using version 1.1.1, which is fairly old. That version seemed to allow me to have a very, very large ratio of near/far clipping planes and everything was working well. I was likely breaking the rule that requires the ratio to be reasonably small, but now I'm paying the price and with my update to JOGL 2.0+ I am having problems.

    Basically, the picture below is what I am trying to achieve visually. I want to be able to have a camera located on a vehicle that approaches the International Space Station, and I want to be able to see parts of the vehicle from that camera view, while also seeing the station when it is far away.

    So, currently I am unable to move too far away from the space station before it disappears, basically it falls outside of my clipping region. I tried to expand the clipping region to the same values I used under version 1.1.1 and it was broken - it wouldn't render either when it got too far away, although under the old version is used to be fine.

    My question is NOT about JOGL versions - that's not important. I obviously need to keep those clipping plane ratio small, my question is what other options I have. I realize I could do a dual pass rendering where I render the far away scene to a texture and then project that texture, but my current setup would require too much code change to accomodate that so I was looking for another solution.

    Specifically I read the following posts that mention a possible solution

    I believe visually this means I am doing the following with my opengl gluPerspective() left image is the old style where you have close near and distant far clipping planes, while the right image shows (what I imagine is being discussed above), that you have two (2) calls to gluPerspective() in the same pass with one call with one set of near/far clipping planes and the other call with a second set of clipping planes.

    Effectively, I tried this kind of code:

    Code :
        gluPerspective(fov, ar, nearBACK, farBACK);
        gluPerspective(fov, ar, nearFWD, farFWD);

    But this doesn't seem to be working for me. It seems like the second gluPerspective() is what the DRAWBACKGROUND() is using, because if I change the farFWD clipping distance to something closer than the BACKGROUND, then the BACKGROUND disappears.

    Am I doing this correctly?

    btw, why can't I upload any images...keeping getting "not a valid image error" /rant
    Last edited by Z-Knight; 03-23-2016 at 06:58 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts