mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Updated LowLevelGL example
This commit is contained in:
@@ -25,10 +25,10 @@ void setup() {
|
||||
flatShader = getShader(PShader.FLAT);
|
||||
|
||||
vertices = new float[12];
|
||||
vertData = PGL.allocateDirectFloatBuffer(12);
|
||||
vertData = allocateDirectFloatBuffer(12);
|
||||
|
||||
colors = new float[12];
|
||||
colorData = PGL.allocateDirectFloatBuffer(12);
|
||||
colorData = allocateDirectFloatBuffer(12);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
@@ -100,3 +100,7 @@ void updateGeometry() {
|
||||
colorData.put(colors);
|
||||
colorData.position(0);
|
||||
}
|
||||
|
||||
FloatBuffer allocateDirectFloatBuffer(int n) {
|
||||
return ByteBuffer.allocateDirect(n * Float.SIZE/8).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user