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?