void PatratTexturat(PATRAT patrat, int numar)
        {
            switch(numar)
            {
            case 1:
                if(numar==1)
                    glBindTexture(GL_TEXTURE_2D, id_textura[2]);
                else
                    glBindTexture(GL_TEXTURE_2D,id_textura[3]);
                break;
            case 2:
                if(numar==2)
                    glBindTexture(GL_TEXTURE_2D, id_textura[4]);
                else
                    glBindTexture(GL_TEXTURE_2D, id_textura[5]);
                break;
            case 3:
                if(numar==3)
                    glBindTexture(GL_TEXTURE_2D, id_textura[6]);
                else
                    glBindTexture(GL_TEXTURE_2D, id_textura[7]);
            case 4:
                if(numar==4)
                {
                        glBindTexture(GL_TEXTURE_2D, id_textura[8]);
                }
                else
                {
                glBindTexture(GL_TEXTURE_2D, id_textura[9]);
                }
                break;
            case 5:
                glBindTexture(GL_TEXTURE_2D,id_textura[10]);
                break;
            case 6:
                glBindTexture(GL_TEXTURE_2D,id_textura[11]);
                break;
            case 7:
                glBindTexture(GL_TEXTURE_2D,id_textura[12]);
                break;
            case 8:
                glBindTexture(GL_TEXTURE_2D,id_textura[13]);
                break;
            case 9:
                glBindTexture(GL_TEXTURE_2D,id_textura[14]);
                break;

            default:
                glBindTexture(GL_TEXTURE_2D, NULL);
                break;
            }

            glBegin(GL_QUADS);

            glTexCoord2f(0.0,0.0);
            glVertex2f(patrat.stanga,patrat.jos);

            glTexCoord2f(1.0,0.0);
            glVertex2f(patrat.dreapta,patrat.jos);
            glTexCoord2f(1.0,1.0);
            glVertex2f(patrat.dreapta,patrat.sus);
            glTexCoord2f(0.0,1.0);
            glVertex2f(patrat.stanga,patrat.sus);
            glEnd();
        }

I have the code above and i get the error that case may only be used in a switch statement, and with break the same error. Am i missing some braces?

Why did you double test for numar over and over like that? (line 6)

Your code is quite the mess. I'd clean it up and try posting again.

The code is for a menu. and the menu has more options. If numar==1 then the first option means new game, and the program will show a certain image, thats why i used glBindTexture.

Sorry, it's a mess. Let's read just a few lines.

About line 3 you have your switch with numar. Then why are you using an if on line 6? Line 9 never would be executed.

It's a bum code passage. Fix it and post again with the blatent problems cleaned up.

I managed to get it working, Thanks anyways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.