Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!