OpenGL: Update QOpenGLFunctions docs to remove widget code
Change-Id: I4246a49444c09d899f2bd7cd2e9353ee0a6859bf Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
parent
9e9ea7c0e6
commit
6a66f29ead
@ -64,19 +64,37 @@ QT_BEGIN_NAMESPACE
|
|||||||
direct inheritance:
|
direct inheritance:
|
||||||
|
|
||||||
\code
|
\code
|
||||||
class MyGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
class MyGLWindow : public QWindow, protected QOpenGLFunctions
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MyGLWidget(QWidget *parent = 0) : QOpenGLWidget(parent) {}
|
MyGLWindow(QScreen *screen = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializeGL();
|
void initializeGL();
|
||||||
void paintGL();
|
void paintGL();
|
||||||
|
|
||||||
|
QOpenGLContext *m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
void MyGLWidget::initializeGL()
|
MyGLWindow(QScreen *screen)
|
||||||
|
: QWindow(screen), QOpenGLWidget(parent)
|
||||||
{
|
{
|
||||||
|
setSurfaceType(OpenGLSurface);
|
||||||
|
create();
|
||||||
|
|
||||||
|
// Create an OpenGL context
|
||||||
|
m_context = new QOpenGLContext;
|
||||||
|
m_context->create();
|
||||||
|
|
||||||
|
// Setup scene and render it
|
||||||
|
initializeGL();
|
||||||
|
paintGL()
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyGLWindow::initializeGL()
|
||||||
|
{
|
||||||
|
m_context->makeCurrent(this);
|
||||||
initializeGLFunctions();
|
initializeGLFunctions();
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
@ -86,11 +104,14 @@ QT_BEGIN_NAMESPACE
|
|||||||
in the following example:
|
in the following example:
|
||||||
|
|
||||||
\code
|
\code
|
||||||
void MyGLWidget::paintGL()
|
void MyGLWindow::paintGL()
|
||||||
{
|
{
|
||||||
|
m_context->makeCurrent(this);
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||||
...
|
...
|
||||||
|
m_context->swapBuffers(this);
|
||||||
|
m_context->doneCurrent();
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user