Paint and delete opengl C ++ object?

0

Good, I edit the doubt in opengl in c ++

These are the main functions where my question is located (I have deleted the camera configuration code, lights and color buffers to simplify). The "drawRoom" and "drawMesa" functions combine primitives to form a square room and a table.

I would like to show a table in the case where the user types "m". However, with these instructions, I do not paint the table. I do not know if it is due to a bad handling of the painting condition or because it should not go in the display section of the program

   void funDisplay() {

    // Borramos el buffer de color
    // Para configurar la matriz matriz P
    // Matriz de Proyección P (Cámara): Perspectiva (gluPerspective
    // Para configurar las matrices M y V
    // Matriz de Vista V (Cámara)

    // Dibujamos la escena(M)
     mesa = false; //Condicion de pintado
     drawRoom();  //Rectangulos contenedores de la escena
     glPushMatrix();
        glTranslatef(0.0,0.0,-5.0);
        if(mesa==true){
          drawMesa(); //Funcion que dibuja una mesa en pantalla
        } 
     glPopMatrix();

     // Intercambiamos los buffers
     glutSwapBuffers();
   }

 void teclasNormales(unsigned char key, int x, int y) {

   switch (key) {
    case 'm': //tecla m
        mesa = true;
        drawMesa();
        break;
 }

Thank you very much

    
asked by order666 23.05.2017 в 16:40
source

0 answers