Results 1 to 4 of 4

Thread: [SOLVED] Objects drawn in odd order

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    20

    [SOLVED] Objects drawn in odd order

    Hi guys,

    So I'm doing a lot of complicated things in my code, but what I have is a very simple problem that should be very basic, but I can't figure out how to fix it for the life of me.

    Basically what I have is a VBO that draws a bunch of cubes. This works fine. Then I rotate the scene to look at these cubes from different view points. This is where trouble starts. In certain views everything looks fine, but in other views back cubes get drawn over the front ones. Any clue how to fix this? Is it glDepthFunc? I tried it, but no help, if anything I get stranger results.

    Thanks.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Objects drawn in odd order

    Do you enable depth test ?
    glEnable(GL_DEPTH_TEST);

    Do you request a depth buffer, with 24 bits precision ? And is your near clip plane far enough, and you far clip plane near enough ? Otherwise you will have too much imprecision in depth test.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    20

    Re: Objects drawn in odd order

    well did enable the depth test, but I'm not sure how to set the near and far clip plane. Off to google I guess

    Thanks.

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    20

    Re: Objects drawn in odd order

    Got it fixed. My near plane was set too close. Basically having it close to 0 is not good. Changed it using gluPerspective() and now everything works like a charm.

    Thanks ZbuffeR

Similar Threads

  1. Replies: 6
    Last Post: 02-12-2013, 03:37 PM
  2. Small objects are partially not drawn
    By AstroBistro in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-11-2010, 02:38 PM
  3. Objects aren't always drawn
    By Shelling in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-16-2008, 11:18 AM
  4. using camera, but objects are being drawn above my view
    By Andrew Davey in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-27-2004, 11:47 AM
  5. How to erase part of the drawn objects?
    By earth_walker in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 07-27-2003, 04:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean