@@ -0,0 +1,2014 @@
+package com.badlogic.gdx.ingenuity.utils.helper;%0A%0Aimport com.badlogic.gdx.graphics.GL20;%0Aimport com.badlogic.gdx.graphics.Mesh;%0Aimport com.badlogic.gdx.graphics.VertexAttribute;%0Aimport com.badlogic.gdx.graphics.VertexAttributes.Usage;%0Aimport com.badlogic.gdx.graphics.glutils.ShaderProgram;%0A%0Apublic class MeshHelper %7B%0A%09private Mesh mesh;%0A%09private ShaderProgram meshShader;%0A%0A%09public MeshHelper() %7B%0A%09%09createShader();%0A%09%7D%0A%0A%09// opengl uses -1 to 1 for coords and also is inverted%0A%09// obj.createMesh(new float%5B%5D%7B-0.5f, -0.5f, 0.5f, -0.5f, 0f, 0.5f%7D);%0A%09public void createMesh(float%5B%5D vertices) %7B%0A%09%09mesh = new Mesh(true, vertices.length, 0, new VertexAttribute(Usage.Position, 2, %22a_position%22));%0A%09%09mesh.setVertices(vertices);%0A%09%7D%0A%0A%09public void drawMesh() %7B%0A%09%09// this should be called in render()%0A%09%09if (mesh == null)%0A%09%09%09throw new IllegalStateException(%22drawMesh called before a mesh has been created.%22);%0A%0A%09%09meshShader.begin();%0A%09%09mesh.render(meshShader, GL20.GL_TRIANGLES);%0A%09%09meshShader.end();%0A%09%7D%0A%0A%09private void createShader() %7B%0A%09%09// this shader tells opengl where to put things%0A%09%09String vertexShader = %22attribute vec4 a_position;    %5Cn%22 + //%0A%09%09%09%09%22void main()                   %5Cn%22 + //%0A%09%09%09%09%22%7B                             %5Cn%22 + //%0A%09%09%09%09%22   gl_Position = a_position;  %5Cn%22 + //%0A%09%09%09%09%22%7D                             %5Cn%22;//%0A%0A%09%09// this one tells it what goes in between the points (i.e%0A%09%09// colour/texture)%0A%09%09String fragmentShader = %22#ifdef GL_ES                %5Cn%22 + //%0A%09%09%09%09%22precision mediump float;    %5Cn%22 + //%0A%09%09%09%09%22#endif                      %5Cn%22 + //%0A%09%09%09%09%22void main()                 %5Cn%22 + //%0A%09%09%09%09%22%7B                           %5Cn%22 + //%0A%09%09%09%09%22  gl_FragColor = vec4(1.0,0.0,0.0,1.0);    %5Cn%22 + //%0A%09%09%09%09%22%7D%22;//%0A%0A%09%09// make an actual shader from our strings%0A%09%09meshShader = new ShaderProgram(vertexShader, fragmentShader);%0A%0A%09%09// check there's no shader compile errors%0A%09%09if (meshShader.isCompiled() == false)%0A%09%09%09throw new IllegalStateException(meshShader.getLog());%0A%09%7D%0A%09public void dispose() %7B%0A%09%09mesh.dispose();%0A%09%09meshShader.dispose();%0A%09%7D%0A%0A%7D

add helper/MeshHelper.java