how to incorporate user input numbers into vertex position?

my vertex position depends on user dimension input. suppose to draw a rect, user specify 200 by 100. i tried:

float a= m_dialog.m_length;
float b= m_dialog.m_breath;

glBegin(GL_POLYGON);
glColor3ub(0,40,230);
glVertex2f(0.0f, 0.0f);
glColor3ub(0,40,230);
glVertex2f(0.0f, b);
glColor3ub(0,40,230);
glVertex2f(a, 0.0f);
glColor3ub(0,40,230);
glVertex2f(a, b);

  glEnd();

but it din work, is there a way to get around this?

What do you mean by did not work?
It did not draw as expected or not draw at all?

Also could this also be related to your screen refresh problem after a dialog box.

Originally posted by coda:
[b]my vertex position depends on user dimension input. suppose to draw a rect, user specify 200 by 100. i tried:

float a= m_dialog.m_length;
float b= m_dialog.m_breath;

glBegin(GL_POLYGON);
glColor3ub(0,40,230);
glVertex2f(0.0f, 0.0f);
glColor3ub(0,40,230);
glVertex2f(0.0f, b);
glColor3ub(0,40,230);
glVertex2f(a, 0.0f);
glColor3ub(0,40,230);
glVertex2f(a, b);

  glEnd();

but it din work, is there a way to get around this?

[/b]

[This message has been edited by nexusone (edited 10-07-2003).]

It appears your polygon is overlapping on itself.

|\ /| <—Your polygon
| / |
| /\ |
|/ |

___ <—What I think you think
| | your polygon should look like
| |
| |
|___|

glBegin(GL_POLYGON);
glColor3ub(0,40,230);
glVertex2f(0.0f, 0.0f);
glColor3ub(0,40,230);
glVertex2f(0.0f, b);
glColor3ub(0,40,230);
glVertex2f(a, b); <----
glColor3ub(0,40,230);
glVertex2f(a, 0.0f); <----
glEnd();

it din work as in i get assertion error when tried to run, so that means opengl can take in (a,c,b) vertex coordinates which usually are predefined by programmer rite?