Мне интересно, есть ли лучшее решение, чем это: у меня есть код рендеринга и код выбора цвета, я уже поделился всем, что можно было разделить между этими двумя кодами (VBO и т. д.), и мой код выглядит так:
void paintGL()
{
label1:
if(picking_running)
{
... code to draw the colors for the picking
}
else
{
... normal code to draw the scene the user should see
}
if(picking_running)
{
... do the colorpick and identify the clicked element...
picking_running = FALSE;
goto label1; // this prevent the paintGL function to end and get swapBuffers called, I don't want the "flickering" to be visible to the user between the color picking mode and the normal mode
}
} // end of the paintGL, here swapBuffers is called automatically
Код работает, мерцания не видно пользователю, но идея с goto в моем коде, откровенно говоря, кажется мне плохим решением.
У вас есть другая идея получше?