I have a problem with the rotation of 2d Objects.
My program is working with 3d objects for example with a cube. I can rotate with x y or z the cube around the x,y or z axes. But if I rotate a 2d object a traingle its rotate but it moves too. how can i fix that and why it works with 3d objects but not with 2d objects??

This is a part of my code

void move(void)
    glTranslatef(0.0, 0.0, -(nah + diag / 2));
    glRotatef(angle[X], 1.0, 0.0, 0.0);
    glRotatef(angle[Y], 0.0, 1.0, 0.0);
    glRotatef(angle[Z], 0.0, 0.0, 1.0);

void drawObj(CGFobject *obj)

    if (!strncmp(obj->Name, "Triangle", strlen("Triangle"))) {
#ifdef  MORE_OBJ
??????? Here I want to set the triangle back to the center or sth like that

Without seeing more code, my guess is that the 3D cube’s points (vertices) are all centered around (0,0,0).
You must either use an offset in your rotation calculations, or center the points of the single triangle you want to rotate, around (0,0,0) also.