Updated LowLevelGL example

This commit is contained in:
codeanticode
2012-08-21 20:05:44 +00:00
parent 85cb330036
commit 9ff4fa8a4d
2 changed files with 13 additions and 5 deletions
@@ -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();
}