Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Newbie confusion with 3d perspective  (Read 730 times)
0 Members and 2 Guests are viewing this topic.
Offline baldacim

JGO n00b
*

Posts: 10



« on: 2011-04-25 19:00:20 »

Hello everyone.
I'm making a few examples to start learning about JOGL.
But I'm having a little confusion with 3D view.
The image below shows my problem.




The rectangle pink and red are like as walls  in my example, and the larger blue rectangle would be like heaven. The Z coordinate of the walls is much smaller than the sky, but when I go walking till I get behind the sky, the walls are drawn on the sky. The most logical would be the sky hide the walls, since their position was to hide.

The order in which design objects make a difference? How do I know which to draw first? I thought I could draw in any order and glu.gluLookAt define  what would appear.

I'm using the camera with gluLookAt and gluPerspective.

Any help will be very welcome.
Thanks
Offline lhkbob

JGO Neuromancer
****

Posts: 1174
Medals: 35



« Reply #1 on: 2011-04-25 19:16:06 »

The order that you draw objects is important if you're not using the depth test (z-buffering). You have to turn it on, it doesn't come enabled.  Add the line
1  
gl.glEnable(GL.GL_DEPTH_TEST);

in your initialization and everything should draw in the correct order.

That being said, I couldn't understand what you expected to happen vs. what actually happened to say if there aren't other bugs in your code besides the depth test. Smiley

Offline baldacim

JGO n00b
*

Posts: 10



« Reply #2 on: 2011-04-25 19:31:46 »

Oh man you saved my life!

Thank you for quick response.

The ways to learn a totally new paradigm and alone sometimes are difficult = /

Thanks again.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.066 seconds with 20 queries.