-
transform trouble
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
-
Junior Member
Regular Contributor
Re: transform trouble
Are you permitted to use glTranslatef for this project?
-
Re: transform trouble
Yes I can use glTranslatef
-
Senior Member
OpenGL Guru
Re: transform trouble
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules