vhn2000
02-20-2005, 07:38 PM
I got a program which will redraw the scence, so basically what I have on the screen will be erased and updated with the current screen. Is there a way where I only can erase part of the screen?
My application contains some moving figures, so the screen redraws everytiem the user clicks. But there are part of the screen which I need to stay the same and probably updated as the user clicks.
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslated(0,-30,0);
glBegin(GL_LINE_LOOP);
for (int i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*3,sin(degInRad)*3);
}
glEnd();
//glTranslated(0,30,0);
glColor3f(1,1,1);
glRotated(spin,0,0,1);
glTranslated(0,15,0);
glBegin(GL_LINE_LOOP);
for (int i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*3,sin(degInRad)*15);
}
glEnd();
glTranslated(0,13.5,0);
glRotated(alpha1,0,0,1);
glTranslated(0,10,0);
glBegin(GL_LINE_LOOP);
for (int i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*3,sin(degInRad)*10);
}
glEnd();
glPopMatrix();
glutSwapBuffers();
}
My application contains some moving figures, so the screen redraws everytiem the user clicks. But there are part of the screen which I need to stay the same and probably updated as the user clicks.
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslated(0,-30,0);
glBegin(GL_LINE_LOOP);
for (int i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*3,sin(degInRad)*3);
}
glEnd();
//glTranslated(0,30,0);
glColor3f(1,1,1);
glRotated(spin,0,0,1);
glTranslated(0,15,0);
glBegin(GL_LINE_LOOP);
for (int i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*3,sin(degInRad)*15);
}
glEnd();
glTranslated(0,13.5,0);
glRotated(alpha1,0,0,1);
glTranslated(0,10,0);
glBegin(GL_LINE_LOOP);
for (int i=0; i < 360; i++)
{
float degInRad = i*DEG2RAD;
glVertex2f(cos(degInRad)*3,sin(degInRad)*10);
}
glEnd();
glPopMatrix();
glutSwapBuffers();
}