PDA

View Full Version : how to put a float from user input into GL_POLYGON?



coda
10-19-2003, 12:39 AM
i have a dialog that has a variable m_length of float type. When i tried to draw a polygon using this variable, i encounter assetion error, where is the problem?

void Dialog::OnOK()
{

UpdateData(TRUE);

float length=m_length;

CPaintDC dc(this);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_POLYGON);
glColor3ub(0,40,230);
glVertex2f(100.0f, 100.0f);
glColor3ub(0,40,230);
glVertex2f(100.0f, length);
glColor3ub(0,40,230);
glVertex2f(400.0f, length);
glColor3ub(0,40,230);
glVertex2f(400.0f, 100.0f);
glEnd();

glFlush();
CDialog::OnOK();

}

coda
10-19-2003, 12:44 AM
sorry i made a careless mistake, it is okie now http://www.opengl.org/discussion_boards/ubb/smile.gif