Exemple #1
0
 private void prepareTexturedModel(TexturedModel model) {
   RawModel rawModel = model.getRawModel();
   GL30.glBindVertexArray(rawModel.getVaoID());
   GL20.glEnableVertexAttribArray(0);
   GL20.glEnableVertexAttribArray(1);
   GL20.glEnableVertexAttribArray(2);
   ModelTexture texture = model.getTexture();
   shader.loadNumberOfRows(texture.getNumberOfRows());
   if (texture.isHasTransparency()) {
     MasterRenderer.disableCulling();
   }
   shader.loadShineVariables(texture.getShineDamper(), texture.getReflectivity());
   GL13.glActiveTexture(GL13.GL_TEXTURE0);
   GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getID());
   shader.loadUseSpecularMap(texture.hasSpecularMap());
   if (texture.hasSpecularMap()) {
     GL13.glActiveTexture(GL13.GL_TEXTURE1);
     GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getSpecularMap());
   }
 }
 public void render(List<GuiTexture> guis) {
   shader.start();
   GL30.glBindVertexArray(quad.getVaoID());
   GL20.glEnableVertexAttribArray(0);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   GL11.glDisable(GL11.GL_DEPTH_TEST);
   for (GuiTexture gui : guis) {
     GL13.glActiveTexture(GL13.GL_TEXTURE0);
     GL11.glBindTexture(GL11.GL_TEXTURE_2D, gui.getTexture());
     Matrix4f matrix = Maths.createTransformationMatrix(gui.getPosition(), gui.getScale());
     shader.loadTransformation(matrix);
     GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, quad.getVertexCount());
   }
   GL11.glEnable(GL11.GL_DEPTH_TEST);
   GL11.glDisable(GL11.GL_BLEND);
   GL20.glDisableVertexAttribArray(0);
   GL30.glBindVertexArray(0);
   shader.stop();
 }