Results 1 to 2 of 2

Thread: More on this DepthFunc thingy

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    burbank, ca
    Posts
    5

    More on this DepthFunc thingy

    I changed the near to .00001...etc.
    I also moved the rotation to the XZ axis.

    However, when I put gl_less it always puts the last object drawn behind the other objects even if it's closer. Using Gl_greater I don't see anything at all..same with gl_equal.

    I'm putting the related code in here, maybe someone can spot what's wrong.
    It's in VB

    This is called first, everytime anything changes...

    Public Sub Reshape(p As Object, cc As Single)
    Dim W As GLfloat
    Dim h As GLfloat
    W = p.ScaleWidth
    h = p.ScaleHeight
    glViewport 0, 0, W, h
    glMatrixMode GL_PROJECTION
    glLoad
    gluPerspective 45, W / h, 5,0.00000000001
    glMatrixMode GL_MODELVIEW
    glLoadIdentity

    End Sub
    glEnable (GL_CULL_FACE)
    glFrontFace (GL_CCW)
    psphere = gluNewQuadric()
    gluQuadricDrawStyle psphere, GLU_FILL
    gluQuadricNormals psphere, qnSmooth
    gluQuadricTexture psphere, GLU_TRUE
    glTexEnvi GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, tepModulate
    glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR
    glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR
    glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT
    glTexParameteri GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT

    glCullFace faceFront
    glFrontFace ffCW
    glDepthFunc GL_LESS
    glClearDepth 1
    glEnable GL_DEPTH_TEST
    glShadeModel smSmooth
    glEnable GL_NORMALIZE

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Posts
    569

    Re: More on this DepthFunc thingy

    Just a detail about the depth test: It doesn't matter on what direction your are looking for the z-buffer to work, simply because the transformations "changes" the view to point toward the z-axis before the z-buffer test is done.

    In algebra term(well not totally )There is a transformation of the view coordinates system to a coordinates system where the z-axis is in and out of the screen. A good graphic books should explain those things. I suggest Real-Time rendering by Thomas Haines and Eric Muller. Go get it at amazon.com! Very worth it.

    Anyway, for your problem, I believe you don't see anything because your are culling the frontfaces. Get rid of all the culling code or cull the back faces just to see.

    And keep the depth func to GL_LESS. Also, turn off texturing just for testing purposes.

Similar Threads

  1. whte thingy
    By ironHead in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 06-25-2004, 02:54 AM
  2. depthfunc
    By Jan in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 04-22-2003, 10:50 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