Beispiel #1
0
 public Gui() {
   width = 800;
   height = 600;
   camera = new Camera();
   camera.setOrthographic(0, width, height, 0, -1, 1);
   universe = new Universe();
   universe.setCamera(camera);
   File vertexShader = Algorithms.getAsset("Vertex.txt");
   File fragmentShader = Algorithms.getAsset("Fragment.txt");
   shader = new ShaderProgram(vertexShader, null, fragmentShader);
   shader.loadUniforms("projection", "view", "model", "diffuse");
   shader.bind();
   shader.setUniform1I(3, 0);
   shader.unbind();
   universe.setShader(shader, 0, 1, 2);
   universe.getFlags().setTexture2D(true);
   universe.getFlags().setBlending(true);
   {
     // Generate model base.
     PrimitiveFlags flags = new PrimitiveFlags(true, true);
     VertexBuildData build = PrimitiveGenerator.generateSquare(1, 1, flags);
     VAO vao = PrimitiveGenerator.convertToVAO(build, flags);
     model = new Model(vao);
   }
 }
Beispiel #2
0
 public void dispose() {
   for (Menu menu : activeMenus) {
     menu.dispose();
   }
   activeMenus.clear();
   universe.dispose();
   shader.dispose();
   model.dispose();
 }