A red rectangle drawn on 2D texture disappears right after being drawn

后端 未结 1 513
花落未央
花落未央 2021-01-29 00:06

following my another question, I have provided the code that draws the rectangle as follows:

void COpenGLControl::DrawRectangleOnTopOfTexture()
{
wglMakeCurren         


        
相关标签:
1条回答
  • 2021-01-29 00:59

    I guess your issue is related to double buffering.

    Some devices do not delete the content of the back buffer when it is being swapped. My suggestion would be to clear the screen explicitly (glClear) before you start rendering into the new buffer. This should handle the issue related to multiple red rectangles.

    Secondly I am not sure if there are more than necessary buffer swaps happening in your code. Please check if there other explicit or implicit calls to Swap Buffer which might result in the wrong buffer being displayed. (The final buffer displayed might not be the buffer in which you drew the rectangle).

    0 讨论(0)
提交回复
热议问题