I found a solution:
This function can calculate the rotated corner points of the cube:
public Point GetRotatedRecPoint(int degree, int cubeSize, Point centerPoint) {
degree = 360 - degree;
float length = (float) Math.sqrt(((cubeSize/2)*(cubeSize/2)) + ((cubeSize/2)*(cubeSize/2)));
float x = Math.cos(Math.toRadians(degree));
float y = Math.sin(Math.toRadians(degree))
return new Point(x*length + centerPoint.x, y*length + centerPoint.y);
}
like this:
// The degrees of each Corner of the Cube
int topLeftDegree = r+45;
int topRightDegree = r+135;
int botRightDegree = r+225;
int botLeftDegree = r+315;
Point topLeftPoint = new Point(GetRotatedRecPoint(topLeftDegree, cubeSize, centerPoint));
Point topRightPoint = new Point(GetRotatedRecPoint(topRightDegree, cubeSize, centerPoint));
Point botRightPoint = new Point(GetRotatedRecPoint(botRightDegree, cubeSize, centerPoint));
Point botLeftPoint = new Point(GetRotatedRecPoint(botLeftDegree, cubeSize, centerPoint));
after that, i scale it:
topLeftPoint.x = topLeftPoint.x * widthScale;
topLeftPoint.y = topLeftPoint.y * heightScale;
topRightPoint.x = topRightPoint.x * widthScale;
.....
add it to the verticeBuffer and then draw it. This works without using glTranslatef() or glRotatef(). I am sure its not the best solution but it works fine for me ^^