How to draw a mesh with GLGraphics
in
Contributed Library Questions
•
2 years ago
I want to draw a simple rectangle mesh with GLGraphics where I can change the vertices in the shader
later on :
- ArrayList<PVector> vertices = new ArrayList<PVector>();
- int size = audio.getPeakSize();
- for (int i = 0; i <= size; i++) {
- float x = 1.0f / size * i;
- for (int j = 0; j <= size; j++) {
- float y = 1.0f / size * j;
- vertices.add(new PVector(x, y));
- }
- }
- model = new GLModel(this, vertices.size(), QUAD_STRIP, GLModel.STATIC);
- model.updateVertices(vertices);
But this doesn't draw a real mesh. In my understanding I have to add the indicies so that OPENGL knows howto build the strip. Does anyone knows how to get this work?
1