48 #include <QtOpenGL/QGLFramebufferObject> 49 #include <QtOpenGL/QGLContext> 51 #include <QtOpenGL/private/qglengineshadermanager_p.h> 57 #if !defined(QT_OPENGL_ES_2) 75 const GLfloat tx1 = src.
left();
76 const GLfloat tx2 = src.
right();
77 const GLfloat ty1 = src.
top();
78 const GLfloat ty2 = src.
bottom();
80 GLfloat texCoordArray[4*2] = {
81 tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1
84 GLfloat vertexArray[4*2];
85 vertexArray[0] = rect.
left(); vertexArray[1] = rect.
top();
86 vertexArray[2] = rect.
right(); vertexArray[3] = rect.
top();
87 vertexArray[4] = rect.
right(); vertexArray[5] = rect.
bottom();
88 vertexArray[6] = rect.
left(); vertexArray[7] = rect.
bottom();
93 glBindTexture(target, tex_id);
101 glBindTexture(target, 0);
109 glViewport(0, 0, viewport.
width(), viewport.
height());
114 blitProgram->setUniformValue(
"imageTexture", 0 );
123 if (targetRect.
right() == (viewport.
width() - 1))
156 window()->platformWindow()->glContext()->makeCurrent();
157 glClearColor(0,0,0,0xff);
170 QRect rect(0,0,size().width(),size().height());
178 QWindowSurface::resize(size);
179 window()->platformWindow()->glContext()->makeCurrent();
QSize size() const
Returns the size of the texture attached to this framebuffer object.
GLuint texture() const
Returns the texture id for the texture attached as the default rendering target in this framebuffer o...
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
#define QT_END_NAMESPACE
This macro expands to.
~QWaylandGLWindowSurface()
QPointer< QWidget > widget
void setLeft(qreal pos)
Sets the left edge of the rectangle to the given x coordinate.
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object.
The QPointF class defines a point in the plane using floating point precision.
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
Flushes the given region from the specified widget onto the screen.
void beginPaint(const QRegion &)
This function is called before painting onto the surface begins, with the region in which the paintin...
int left() const
Returns the x-coordinate of the rectangle's left edge.
void setTop(qreal pos)
Sets the top edge of the rectangle to the given y coordinate.
QGLShaderProgram * blitProgram()
#define glVertexAttribPointer
void setBottom(qreal pos)
Sets the bottom edge of the rectangle to the given y coordinate.
virtual QPoint offset(const QWidget *widget) const
Returns the offset of widget in the coordinates of this window surface.
static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect)
#define glEnableVertexAttribArray
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
static QGLEngineSharedShaders * shadersForContext(const QGLContext *context)
void setRight(qreal pos)
Sets the right edge of the rectangle to the given x coordinate.
static const QGLContext * currentContext()
Returns the current context, i.e.
QWaylandGLWindowSurface(QWidget *window)
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
Q_GUI_EXPORT EGLDisplay display()
void resize(const QSize &size)
QGLFramebufferObject * mPaintDevice
virtual void swapBuffers()=0
Reimplement in subclass to native swap buffers calls.
The QGLContext class encapsulates an OpenGL rendering context.
#define GL_COLOR_BUFFER_BIT
The QRegion class specifies a clip region for a painter.
The QWindowSurface class provides the drawing area for top-level windows.
int top() const
Returns the y-coordinate of the rectangle's top edge.
static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br)
int right() const
Returns the x-coordinate of the rectangle's right edge.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
#define glDisableVertexAttribArray
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height.
static const GLuint QT_TEXTURE_COORDS_ATTR
The QRect class defines a rectangle in the plane using integer precision.
bool release()
Switches rendering back to the default, windowing system provided framebuffer.
QSizeF size() const
Returns the size of the rectangle.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
The QSize class defines the size of a two-dimensional object using integer point precision.
bool isBound() const
Returns true if the framebuffer object is currently bound to a context, otherwise false is returned...
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
static const GLuint QT_VERTEX_COORDS_ATTR
bool bind()
Binds this shader program to the active QGLContext and makes it the current shader program...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
QPaintDevice * paintDevice()
Implement this function to return the appropriate paint device.