Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
Webgl vertex position Built in VertexShader

I only use the matrix to draw a square! Only the matrix is updated in each rendering. How to remove Vertex Position from my codes

lock like this https://webgl2fundamentals.org/webgl/lessons/webgl-drawing-without-data.html

#version 300 es
in vec4 a_position;
in vec2 a_texcoord;
uniform mat4 u_matrix;
out vec2 v_texcoord;
void main() 
    ngl_Position = u_matrix * a_position;
    v_texcoord = a_texcoord;
}

and remove this

gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
0, 0, 0,
0, 1, 0,
1, 0, 0,
0, 1, 0,
1, 1, 0,
1, 0, 0]), gl.STATIC_DRAW);

Sorry for using Google Translator

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here is your square vertex shader. You don't need to use a matrix.

#version 300 es

void main() {
  float xs[6] = float[](0.0, 0.0, 1.0, 0.0, 1.0, 1.0);
  float ys[6] = float[](0.0, 1.0, 0.0, 1.0, 1.0, 0.0);
  float x = xs[gl_VertexID];
  float y = ys[gl_VertexID];
  gl_Position = vec4(x, y, 0, 1);
}

And to render you just do this. You don't need to do any bufferData or any uniforms.

gl.drawArrays(gl.TRIANGLES, 0, 6);
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda