Ok well This is waht I am trying to do. I have an array of floats called size.
See, I am trying to put the shape in the array called sides. Then I load "Sides" and do a rotation or translation, but it doesnt work...
void Block::SetPosition(float x,float y, float z)
{
//glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(Sides);
glLoadIdentity();
glTranslatef(x,y,z);
}
void Block::Rotate(float angle, float x, float y, float z)
{
//glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(Sides);
glLoadIdentity();
glRotatef(angle,x,y,z);
}
void Block::Draw()
{
glMatrixMode(GL_MODELVIEW);
glEnable(GL_TEXTURE_2D);
//glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(Sides);
glPushMatrix();
glBindTexture(GL_TEXTURE_2D, SideTexture);
glColor4f(1.f, 1.f, 1.f, 1.f);
// Draw a cube
float size = 20.f;
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex3f(-size, -size, -size);
glTexCoord2f(0, 1); glVertex3f(-size, size, -size);
glTexCoord2f(1, 1); glVertex3f( size, size, -size);
glTexCoord2f(1, 0); glVertex3f( size, -size, -size);
glTexCoord2f(0, 0); glVertex3f(-size, -size, size);
glTexCoord2f(0, 1); glVertex3f(-size, size, size);
glTexCoord2f(1, 1); glVertex3f( size, size, size);
glTexCoord2f(1, 0); glVertex3f( size, -size, size);
glTexCoord2f(0, 0); glVertex3f(-size, -size, -size);
glTexCoord2f(0, 1); glVertex3f(-size, size, -size);
glTexCoord2f(1, 1); glVertex3f(-size, size, size);
glTexCoord2f(1, 0); glVertex3f(-size, -size, size);
glTexCoord2f(0, 0); glVertex3f(size, -size, -size);
glTexCoord2f(0, 1); glVertex3f(size, size, -size);
glTexCoord2f(1, 1); glVertex3f(size, size, size);
glTexCoord2f(1, 0); glVertex3f(size, -size, size);
glEnd();
glBindTexture(GL_TEXTURE_2D, BottomTexture);
glBegin(GL_QUADS);
glColor4f(1.f, 1.f, 1.f, 1.f);
glTexCoord2f(0, 1); glVertex3f(-size, -size, size);
glTexCoord2f(0, 0); glVertex3f(-size, -size, -size);
glTexCoord2f(1, 0); glVertex3f( size, -size, -size);
glTexCoord2f(1, 1); glVertex3f( size, -size, size);
glEnd();
glBindTexture(GL_TEXTURE_2D, TopTexture);
glColor4f(1.f, 1.f, 1.f, 1.f);
glBegin(GL_QUADS);
glTexCoord2f(0, 1); glVertex3f(-size, size, size);
glTexCoord2f(0, 0); glVertex3f(-size, size, -size);
glTexCoord2f(1, 0); glVertex3f( size, size, -size);
glTexCoord2f(1, 1); glVertex3f( size, size, size);
glEnd();
glPopMatrix();
}