salut,
pour des raisons trop longues à expliquer cette fois ci (si vous voulez des détails, zavez qu'a demander), je cherche à faire apparaitre tout les objets de ma scène un par un, et sans tout les autres, pour ensuite réaliser effectivement ma scène avec tout mes objets. Je réalise ce petit truc un peu lourd pour pouvoir récupérer toutes les coordonnées 3D de chaques objets de ma scène.
pour cela, j'ai fait cette fonction :
****************************************************
/* draw the objects */
for (count = 0 ; count < MAXOBJECT ; count ++)
{
object = Scene.objects[count] ;
if (object)
{
/* clear the window with current color */
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glLoadIdentity() ;
glPushMatrix() ;
/* movement of the object */
if(Stage)
MoveObject(object) ;
/* position of the object */
glTranslatef( object->pos[X] ,
object->pos[Y] ,
object->pos[Z] ) ;
/* orientation of the object */
Orientate( object->or[X] , object->or[Y] , object->or[Z] ) ;
/* graphic parameters */
glColor4fv (white) ;
glMaterialfv( GL_FRONT , GL_SPECULAR , object->ref ) ;
glMateriali( GL_FRONT , GL_SHININESS , object->shininess ) ;
DrawShape(*object) ;
glFlush() ;
glutSwapBuffers() ;
/* save the coordinates */
Save3DCoordinates(*object) ;
glPopMatrix () ;
}
}
/* clear the window with current color */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ;
glLoadIdentity() ;
**********************************************
mais voilà, ca marche pas tellement, lorsque je sauve mes coordonnées 3D, je ne trouve aucun objet, quel que soit l'étape (je "trouve" un objet en analysant l'image avec glReadPixels et GL_DEPTH_COMPONENT, si la profondeur est<1 alors un objet est sous le pixel).
mais voilà, ce code pas très beau ne marche pas... c comme s'il n'y avait aucun objet...
please help
Partager