Results 1 to 8 of 8

Thread: Depth Buffering - HELP !!

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    UK
    Posts
    26

    Depth Buffering - HELP !!

    I have a viewport with glOrtho set up and there are some objects that I am drawing that I want behind others. The problem is that I had to turn depth buffering off so that I could get the text working in the viewport.

    Is there a way that I can have one object drawn ontop of another without using depth buffering?

    or

    Is there a way that I can text on the viewport without turing the depth buffering off?

    Thanks

    Simon

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Depth Buffering - HELP !!

    Yes to both questions. But instead of compromising, use the best from both techniques.

    That is: Render the objects with depth buffer on, and text with depth buffer off.

    Code :
    glEnable(GL_DEPTH_TEST);
    drawObjectsHere();
    glDisable(GL_DEPTH_TEST);
    drawTextHere();

  3. #3
    Senior Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: Depth Buffering - HELP !!

    You can draw your objects that requires depth using the depth buffer turned on, and then (when everything else is drawn) draw the text with the depth buffer turned off:

    Code :
    glEnable( GL_DEPTH_TEST );
    DrawMyObjects();
    glDisable( GL_DEPTH_TEST );
    DrawText();

  4. #4
    Senior Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: Depth Buffering - HELP !!

    ...hrm! Bob, you beat me to the 'Submit Reply' button

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    UK
    Posts
    26

    Re: Depth Buffering - HELP !!

    Thanks Guys

    Seams to have sorted it out.

    I have a problem with some text that goes cyan after a while, it starts off white and then after a while turns cyan for no reason.

    Umm

    simon

  6. #6
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    204

    Re: Depth Buffering - HELP !!

    stockton,

    try setting the color state right before you draw the text. it sounds like a state set during other rendering is still set when you render the text...

  7. #7
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    204

    Re: Depth Buffering - HELP !!

    I was under the impression Furrage meant the windows message timer created with SetTimer.

    The QueryPerformanceCounter sounds a lot better, but what’s with this: (from MSDN) 'The QueryPerformanceCounter function retrieves the current value of the high-resolution performance counter, if one exists.', if one exists? How often can this happen?

    John.

  8. #8
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    204

    Re: Depth Buffering - HELP !!

    sorry, I miss posted. that was meant for another thread...

    John.

Similar Threads

  1. Depth buffering problem
    By theDancer in forum Vulkan
    Replies: 0
    Last Post: 07-22-2017, 09:15 AM
  2. FBO and Depth Buffering
    By Zulfiqar Malik in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 07-02-2005, 07:08 AM
  3. Depth buffering & transparency plz. help!
    By W. C. Picker in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-18-2003, 03:58 AM
  4. Depth Buffering Question!
    By Roach in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-06-2003, 02:01 PM
  5. Depth Buffering
    By SpaceCadet in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 04-26-2000, 08:05 PM

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