I got a hole in my sphere!

See the link for what I’m getting:


This is driving me round the bend! Below is the piece of code that produces the above, it’s in VB .net but that should not detract from the problem.

Draw the scene:

    gl.ClearColor(1, 1, 1, 0)

    Dim quadric As IntPtr
    quadric = glu.NewQuadric
    gl.Color3f(1, 0, 0)
    glu.Sphere(quadric, 1.2, 10, 10)

The Resize event:

    gl.Viewport(0, 0, Me.Width, Me.Width)

I know it’s a sillly example but demenstrates the problem. Any thing larger than 1.0 for the radius of the sphere and the hole will start to appear. I my actual program I use gl.Ortho to do all my scaling zooming etc and I still get the problem. I am programming a 2D CAD system. I seems that gluPerspective is OK but I’m only doing 2D.

Any help would really be approciated


It looks like toy sphere is being truncated by either your near or far frustum plane. Either adjust your frustum or your camera position or both.


Smiley, thankyou so much, that fixed it! You got so quickly

I just added:

    gl.Ortho(-(Me.Width / 2), Me.Width / 2, -(Me.Width / 2), Me.Width / 2, 100, -100)

The last two arguments were originally 1 and -1, because I was doing 2D I never even realized that the figures made any difference.



I got it quickly because it’s happened to me about a million times before :smiley:

Cheers :slight_smile: