public void update() { hasVertices = true; /*hasVertices = false; if (!mesh.getMesh().isEmpty()) { hasVertices = true; break; } if (!hasVertices) { return; }*/ renderer.begin(); material.preRender(); renderer.addMesh(mesh.getMesh()); material.postRender(); renderer.end(); }
public void initRenderer() { createWindow(); // Mouse.setGrabbed(true); getLogger().info("SpoutClient Information"); getLogger().info("Operating System: " + System.getProperty("os.name")); getLogger().info("Renderer Mode: " + this.getRenderMode().toString()); getLogger().info("OpenGL Information"); getLogger().info("Vendor: " + GL11.glGetString(GL11.GL_VENDOR)); getLogger().info("OpenGL Version: " + GL11.glGetString(GL11.GL_VERSION)); getLogger().info("GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); getLogger().info("Max Textures: " + GL11.glGetString(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)); String extensions = "Extensions Supported: "; if (getArguments().renderMode == RenderMode.GL30) { for (int i = 0; i < GL11.glGetInteger(GL30.GL_NUM_EXTENSIONS); i++) { extensions += GL30.glGetStringi(GL11.GL_EXTENSIONS, i) + " "; } } else { extensions += GL11.glGetString(GL11.GL_EXTENSIONS); } getLogger().info(extensions); soundManager.init(); Spout.getFilesystem().postStartup(); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClearColor((135.f / 255.0f), 206.f / 255.f, 250.f / 255.f, 0); // worldRenderer = new WorldRenderer(this); // worldRenderer.setup(); renderer = new PrimitiveBatch(); mat = (RenderMaterial) this.getFilesystem() .getResource("material://Spout/resources/resources/materials/BasicMaterial.smt"); renderer.begin(); renderer.addCube(new Vector3(-0.5, -0.5, -0.5), Vector3.ONE, Color.RED, sides); renderer.end(); gui = new SpriteBatch(); }
public void render(float dt) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (Mouse.isButtonDown(0)) { if (!Mouse.isGrabbed()) Mouse.setGrabbed(true); } else Mouse.setGrabbed(false); // worldRenderer.render(); try { // System.out.println("view "+activeCamera.getView().toString()); Transform loc = new Transform(new Point(null, 0f, 0f, 0f), Quaternion.IDENTITY, Vector3.ONE); mat.getShader().setUniform("View", activeCamera.getView()); mat.getShader().setUniform("Projection", activeCamera.getProjection()); mat.getShader().setUniform("Model", loc.toMatrix()); renderer.draw(mat); gui.begin(); gui.draw(mat, .25f, .25f, .25f, .25f); gui.render(); } catch (Exception e) { } }
public void finalize() { ((BatchVertexRenderer) renderer.getRenderer()).finalize(); }
public void render(RenderMaterial material) { if (hasVertices) { renderer.draw(material); } }