Results 1 to 4 of 4

Thread: Regarding Depth Buffer

  1. #1
    Senior Member Regular Contributor
    Join Date
    Mar 2010
    Posts
    213

    Regarding Depth Buffer

    Hello,

    im using glDrawPixels() to draw some pixel data that i read from a file. After that, im trying to draw other objects. But, im the objects are not visible when i enable depth buffering.
    Code :
    glDrawPixels(640, 480, GL_RGB, GL_UNSIGNED_BYTE, image_data);
     
    glColor3f(1.0, 0.0, 0.0);
    glutWireCube(200);

    Here, the Cube appears when i disable depth buffer. But i cannot see the cube when depth buffering is enabled.

    i even tried using Textures, but the cube does not appear.

    Can anyone please tell me what the problem could be?
    Thanks.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2010
    Location
    France
    Posts
    458

    Re: Regarding Depth Buffer

    I think you should use glRasterPos to select the depth value before using glDrawPixels.

    I don't know what default values it is when you don't specify glRasterPos before.

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

    Re: Regarding Depth Buffer

    try a glClear(GL_DEPTH_BUFFER); after glDrawPixels.

  4. #4
    Senior Member Regular Contributor
    Join Date
    Mar 2010
    Posts
    213

    Re: Regarding Depth Buffer

    Thanks _arts_, Zbuffer.


    Both the methods worked.

Similar Threads

  1. OpenGL: Draw a depth texture to depth buffer
    By Balrog in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-25-2012, 04:53 AM
  2. Depth buffer reading and depth buffer test
    By BurningLegion in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-15-2007, 04:09 AM
  3. Does Depth Buffer Allow Writing Into When Disabling Depth Test
    By wilburn in forum OpenGL: Basic Coding
    Replies: 16
    Last Post: 12-23-2006, 01:23 AM
  4. depth buffer -> depth texture -> depth buffer
    By Codemonkey in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 12-23-2005, 06:27 AM
  5. why depth buffer save to image file can not display depth information
    By victorswan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-27-2001, 09:19 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