Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda