PDA

View Full Version : How can I get the value of x1,y1,z1 after glRotatef() in selection state?



qiang zhong
06-23-2005, 07:22 PM
my object like this:
class vBond
{
public:
GLfloat x1,y1,z1;
vBond(string strName,string T_ptl,string T_ptr);
~vBond();
void draw_me(int hit);
void Computelocation(GLfloat xx,GLfloat yy,GLfloat zz);
void ComputeMatrix(const Matrix4f_t *Matrix);
void ComputeRotateMatrix(const int xx);
};
void vBond::draw_me(int hit)
{
glPushMatrix();
glPushName(loca);
glBegin(GL_LINES);
glVertex3f(0.0,0.0,0.0);
glVertex3f(x1,y1,z1);
glEnd();
glPopName();
glPopMatrix();
glTranslatef(x1,y1,z1);
if(contral==true){glRotatef ((GLfloat) elbow, x1, y1, z1);}
}
I changes elbow by keyboard in selection state,I want to save the result of glTranslatef and glRotatef .
what shall I do? please help me!

qiang zhong
06-27-2005, 04:39 PM
I have solved this problem,the code just like below:
void vBond::draw_me(int hit)
{
:) if(hit==0){glColor3f(0.75f,0.75f,1.0f);}else{glCol or3f(1.0f,0.75f,0.75f);}
if(hit==4){glRotatef ((GLfloat) elbow, x1, y1, z1);}
if(hit==4){glMultMatrixf(Transform.M);}
glGetFloatv(GL_MODELVIEW_MATRIX, vBond::m);
glPushMatrix();
glPushName(loca);
glBegin(GL_LINES);
glVertex3f(0.0,0.0,0.0);
glVertex3f(x1,y1,z1);
glEnd();
glPopName();
glPopMatrix();

}

knackered
06-28-2005, 01:37 AM
Thank god for that.