1 #include "waylandsurfacetexturematerial.h"
2 #include <QtGui/QOpenGLContext>
4 static const char wayland_surface_texture_material_vertex[] =
5 "uniform highp mat4 qt_Matrix; \n"
6 "attribute highp vec4 qt_VertexPosition; \n"
7 "attribute highp vec2 qt_VertexTexCoord; \n"
8 "varying highp vec2 qt_TexCoord; \n"
10 " qt_TexCoord = qt_VertexTexCoord; \n"
11 " gl_Position = qt_Matrix * qt_VertexPosition; \n"
15 static const char wayland_surface_texture_opaque_material_fragment[] =
16 "varying highp vec2 qt_TexCoord; \n"
17 "uniform sampler2D qt_Texture; \n"
18 "uniform lowp float qt_Opacity; \n"
20 " gl_FragColor = vec4(texture2D(qt_Texture, qt_TexCoord).rgb, 1.0) * qt_Opacity; \n"
23 static const char wayland_surface_texture_material_fragment[] =
24 "varying highp vec2 qt_TexCoord; \n"
25 "uniform sampler2D qt_Texture; \n"
26 "uniform lowp float qt_Opacity; \n"
28 " gl_FragColor = texture2D(qt_Texture, qt_TexCoord) * qt_Opacity; \n"
31 QList<QByteArray> WaylandSurfaceTextureMaterial::attributes() const
33 QList<QByteArray> attributeList;
34 attributeList << "qt_VertexPosition";
35 attributeList << "qt_VertexTexCoord";
39 void WaylandSurfaceTextureMaterial::updateState(const WaylandSurfaceTextureState *newState, const WaylandSurfaceTextureState *oldState)
42 newState->texture()->bind();
45 const char *WaylandSurfaceTextureMaterial::vertexShader() const
47 return wayland_surface_texture_material_vertex;
50 const char *WaylandSurfaceTextureMaterial::fragmentShader() const
52 return wayland_surface_texture_material_fragment;
55 QList<QByteArray> WaylandSurfaceTextureOpaqueMaterial::attributes() const
57 QList<QByteArray> attributeList;
58 attributeList << "qt_VertexPosition";
59 attributeList << "qt_VertexTexCoord";
63 void WaylandSurfaceTextureOpaqueMaterial::updateState(const WaylandSurfaceTextureState *newState, const WaylandSurfaceTextureState *oldState)
66 newState->texture()->bind();
69 const char *WaylandSurfaceTextureOpaqueMaterial::vertexShader() const
71 return wayland_surface_texture_material_vertex;
74 const char *WaylandSurfaceTextureOpaqueMaterial::fragmentShader() const
76 return wayland_surface_texture_opaque_material_fragment;