PDA

View Full Version : refreshing screen?



coda
10-07-2003, 05:28 AM
I have an SDI window with a dialog. When user input dimensions and close dialog, my image will show on the SDI screen but because my dialog was in front of the screen, it leave a white blank on the image when dialog is closed. I am told to refresh the screen but not sure how to do that? anyone can help? following is my draw rect code :

void Draw::OnOK()
{

CPaintDC dc(this);

glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3ub(0,40,230); //red, green, blue
glVertex2f(100.0f, 100.0f); glColor3ub(0,40,230);
glVertex2f(100.0f, 300.0f);
glColor3ub(0,40,230);
glVertex2f(450.0f, 300.0f);
glColor3ub(0,40,230);
glVertex2f(450.0f, 100.0f);
glEnd();

glFlush();

CDialog::OnOK();
}

nexusone
10-07-2003, 06:40 AM
I am not a windows programmer, but does not windows have a signal that tells the window graphics has been corrupted or to redraw after a window has been above it.

but anyway maybe should be something like this:

get dialog from user.
draw new screen with user data.



Originally posted by coda:
I have an SDI window with a dialog. When user input dimensions and close dialog, my image will show on the SDI screen but because my dialog was in front of the screen, it leave a white blank on the image when dialog is closed. I am told to refresh the screen but not sure how to do that? anyone can help? following is my draw rect code :

void Draw::OnOK()
{

CPaintDC dc(this);

glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3ub(0,40,230); //red, green, blue
glVertex2f(100.0f, 100.0f); glColor3ub(0,40,230);
glVertex2f(100.0f, 300.0f);
glColor3ub(0,40,230);
glVertex2f(450.0f, 300.0f);
glColor3ub(0,40,230);
glVertex2f(450.0f, 100.0f);
glEnd();

glFlush();

CDialog::OnOK();
}