The rendering function is being called infinitely.

Is there a function that will render in opengl and disable this behavior?

The rendering function is still being called after the dialog is rendered.

So the screen is very buzzing.

what should i do??

Hard to give you an answer with so little information.

Which library do you use to create the window? GLUT? GLFW?
How does your Render function look like?
Were do you call your render function?

I Created Modeless Dialog in MFC(Using OpenGL)


void MapView_3D::GLRenderScene(void)
{
    cv::Mat colorValue = GetColorValue(); //getcolorvalue mat ์ƒ‰์ƒ๊ฐ’

    int width = colorValue.cols;
    int height = colorValue.rows;

    //get color
    unsigned char* image_p = colorValue.data;

    glMatrixMode(GL_MODELVIEW); //GL_PROJECTION
    glLoadIdentity();           

    gluLookAt(
        camera[0][0], camera[0][1], camera[0][2],   
        camera[1][0], camera[1][1], camera[1][2],       
        camera[2][0], camera[2][1], camera[2][2]     
    );

    glRotatef(xrot, yrot, zrot, 0.0f); 
    glTranslatef(0, 0, 0); 
    //glMatrixMode(GL_PROJECTION);  // To operate on the Projection matrix

    glPointSize(5.0);
    glLineWidth(10.0);
    glBegin(GL_QUADS);

    //2dmap draw
    int k = 0;
    GLfloat z = -1;

    srand((unsigned)time(NULL));

    glPushMatrix();

    for (int i = 0; i < height; i++)
    {
        for (int j = 0; j < width; j++)
        {
            glColor3ub(image_p[k + 2], image_p[k + 1], image_p[k]); // r,g,b
            glVertex3f(x, y, z);
            k++;
            z = rand() % 3 + (-1);
        }
    }
    
    glEnd();

    xrot = 5.0f;
    yrot = 5.0f;
    zrot = -5.0f;

    glFlush();
    glFinish();
    SwapBuffers(m_hDC);
}

This is rendering code

Donโ€™ see a particular problem (delf calling of the function) here at first glance. Were do you call it? You can just use a debug build, set a breakpoint and traverse the call stack to see which function is calling the render function repeatedly. Usually this some kind of main loop function.