【发布时间】:2014-01-15 09:29:20
【问题描述】:
由于 QGLWidget 不能用于 OpenGL / ES,所以我在 Qt 中留下了 QWidget 用于小部件渲染 opengl。 Reference
如果我有以下 renderView 函数要在当前窗口中呈现,我正在寻找将由 qt 重复调用的“那个”函数,以便 QWidget 刷新屏幕,以便我可以通过重载它来调用该函数中的 renderView。
知道如何做到这一点或常见的解决方法吗?
原始问题:我不想根据屏幕刷新率在 1 毫秒甚至 16.66 毫秒的计时器内调用 renderView。
class MyWindow
{
void renderView()
{
if(DeviceContext && RenderingContext)
{
wglMakeCurrent(m_hdc, m_hrc); //Set current context
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// glViewPort.... and render using shaders
SwapBuffers(m_hdc); // Double buffering thats why
}
}
};
class MyWidget : public QWidget, public MyWindow
{
// What is the function called repeatedly to refresh the screen
// so that i would ask that function to call renderView
};
提前致谢!
【问题讨论】:
标签: c++ qt opengl-es render qwidget