En esta página

GridMesh QML Type

Define una malla con vértices dispuestos en una cuadrícula. Más...

Import Statement: import QtQuick

Propiedades

Descripción detallada

GridMesh define una malla rectangular formada por vértices dispuestos en una rejilla con espaciado uniforme. Se utiliza para generar un geometry. La resolución de la rejilla se especifica mediante la propiedad resolution.

Documentación de la propiedad

resolution : size

Esta propiedad define la resolución de la cuadrícula. La anchura y la altura de la resolución especifican el número de celdas o espacios entre vértices, en horizontal y en vertical, respectivamente. El valor mínimo y predeterminado es 1x1, lo que corresponde a cuatro vértices en total, uno en cada esquina. Para transformaciones de vértices no lineales, es probable que te interese establecer una resolución mayor.

ResultadoCódigo QMLgridmesh.vert

El logotipo de Qt aparece distorsionado por la transformación de GridMesh

import QtQuick 2.0

ShaderEffect {
    width: 200
    height: 200
    mesh: GridMesh {
        resolution: Qt.size(20, 20)
    }
    property variant source: Image {
        source: "qt-logo.png"
        sourceSize { width: 200; height: 200 }
    }
    vertexShader: "gridmesh.vert"
}
#version 440
layout(location = 0) in vec4 qt_Vertex;
layout(location = 1) in vec2 qt_MultiTexCoord0;
layout(location = 0) out vec2 qt_TexCoord0;
layout(std140, binding = 0) uniform buf {
    mat4 qt_Matrix;
    float qt_Opacity;
    float width;
};
void main() {
    vec4 pos = qt_Vertex;
    float d = 0.5 * smoothstep(0.0, 1.0, qt_MultiTexCoord0.y);
    pos.x = width * mix(d, 1.0 - d, qt_MultiTexCoord0.x);
    gl_Position = qt_Matrix * pos;
    qt_TexCoord0 = qt_MultiTexCoord0;
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.