PDA

View Full Version : transform trouble



11-01-2003, 10:33 AM
I have a function that draws an object

void shape(void)
{
//set colour red
glColor3f(1.0f, 0.0f, 0.0f);
glRecti(111.25, 395, 141.25, 455);


//set colour black
glColor3f(0.0f, 0.0f, 0.0f);

glRecti(141.25,395, 156.25,410);
glRecti(141.25,440, 156.25,455);
glRecti(96.25,395, 111.25,410);
glRecti(96.25,440, 111.25,455);
glEnd();

glBegin(GL_LINES);

glVertex2i(123.25, 400);
glVertex2i(123.25, 415);
glVertex2i(126.25, 400);
glVertex2i(126.25, 415);
glVertex2i(129.25, 400);
glVertex2i(129.25, 415);

glEnd();
}

I am wanting to transform this and have no idea how to do it. I have read through other posts and tried to follow advise through but am still stuggling can anybody help please

Thanks
Sax

cg-hci_novice
11-01-2003, 12:54 PM
Are you permitted to use glTranslatef for this project?

11-01-2003, 04:05 PM
Yes I can use glTranslatef

nexusone
11-02-2003, 04:30 AM
If you want to transform a object without effecting others, then use glPushMatrix and glPopMatrix.

// Draw object
glPushMatrix() // Save Matrix
glTranslate
glRotate
DrawObject_data_here
glPopMatrix() // Restore Matrix to state before Save Matrix