I have a very very strange problem: I’ve created a 3D visor, that is, a program that displays shapes according to an XML file. The problem is that, as soon as I’ve started introducing spheres (and ellipsoids rendered as scaled gluSpheres), some spurious shapes appear/disappear from my scene according to the current camera orientation.
I’ve taken a couple of pictures just to be clearer:
I’ve rendered shapes using display lists, the one regarding ellipsoids/spheres is the following:
/** Quadric object **/ GLUquadricObj *Sphere; /** Obtain a new quadric **/ Sphere = gluNewQuadric(); gluQuadricNormals(Sphere, GLU_SMOOTH); gluQuadricTexture(Sphere, GL_TRUE); /** Start filling display list **/ glNewList(dObj.listID, GL_COMPILE); /** Set polygon's filling **/ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /** Set ellipsoid's color **/ glColor4d(eo.ellipsoid_color_R_, eo.ellipsoid_color_G_, eo.ellipsoid_color_B_, eo.ellipsoid_color_A_); /** Save current modelview matrix **/ glPushMatrix(); /** Translate to reach ellipsoid's center **/ glTranslated(eo.ellipsoid_center_X_, eo.ellipsoid_center_Y_, eo.ellipsoid_center_Z_); /** Rotate around the Y axis **/ glRotated(eo.ellipsoid_orientation_Rho_, 0.0, 1.0, 0.0); /** Rotate around the X axis **/ glRotated(eo.ellipsoid_orientation_Theta_, 1.0, 0.0, 0.0); /** Alter scale factors so as to obtain an ellipsoid from a sphere **/ glScaled(eo.ellipsoid_scaleFactor_X_, eo.ellipsoid_scaleFactor_Y_, eo.ellipsoid_scaleFactor_Z_); /** Draw the sphere **/ gluSphere(Sphere, 1.0, eo.ellipsoid_nSegments_U_, eo.ellipsoid_nSegments_V_); /** Restore previous modelview matrix **/ glPopMatrix(); glEndList();
Does anyone have any clue why this happens?
Thanks in advance to anyone willing to help me.