Package org.newdawn.slick.opengl

Examples of org.newdawn.slick.opengl.Texture


    GlyphVector vector = font.layoutGlyphVector(GlyphPage.renderContext, chars, 0, chars.length, Font.LAYOUT_LEFT_TO_RIGHT);

    int maxWidth = 0, totalHeight = 0, lines = 0;
    int extraX = 0, extraY = ascent;
    boolean startNewLine = false;
    Texture lastBind = null;
    for (int glyphIndex = 0, n = vector.getNumGlyphs(); glyphIndex < n; glyphIndex++) {
      int charIndex = vector.getGlyphCharIndex(glyphIndex);
      /*if (charIndex < startIndex) continue;*/
      if (charIndex > colored_text.text().length()) break;
           
            if(colored_text.colorSwitches().containsKey(charIndex)) {
                Color c = colored_text.colorSwitches().get(charIndex).toSlickColor();
                GL11.glColor3f(c.r, c.g, c.b);
            }
           
      int codePoint = colored_text.text().codePointAt(charIndex);

      Rectangle bounds = getGlyphBounds(vector, glyphIndex, codePoint);
      Glyph glyph = getGlyph(vector.getGlyphCode(glyphIndex), codePoint, bounds, vector, glyphIndex);

      if (startNewLine && codePoint != '\n') {
        extraX = -bounds.x;
        startNewLine = false;
      }

      MyImage image = glyph.getImage();
      if (image == null && missingGlyph != null && glyph.isMissing()) image = missingGlyph.getImage();
      if (image != null) {
        // Draw glyph, only binding a new glyph page texture when necessary.
        Texture texture = image.getTexture();
        if (lastBind != null && lastBind != texture) {
          GL.glEnd();
          lastBind = null;
        }
        if (lastBind == null) {
          texture.bind();
          GL.glBegin(SGL.GL_QUADS);
          lastBind = texture;
        }

        image.drawEmbedded(bounds.x + extraX, bounds.y + extraY, image.getWidth(), image.getHeight(), font.getSize());
View Full Code Here


      Logger.info("Done loading images");
      Logger.info("Started texture loading...");
     
      for(String s : imagesToTexture.keySet()) {
        try {
          Texture texture = BufferedImageUtil.getTexture("PNG", imagesToTexture.get(s));
          textures.put(s, texture);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
View Full Code Here

    if(done) {
      Logger.info("Started texture loading...");
     
      for(String s : imagesToTexture.keySet()) {
        try {
          Texture texture = BufferedImageUtil.getTexture("PNG", imagesToTexture.get(s));
          textures.put(s, texture);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
View Full Code Here

        Logger.error("Error while loading image: " + filename);
        e.printStackTrace();
      }
    }
   
    Texture texture = null;
   
    try {
      texture = BufferedImageUtil.getTexture("PNG", image);
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

      }
    }
   
    image = image.getSubimage(x, y, w, h);
   
    Texture texture = null;
   
    try {
      texture = BufferedImageUtil.getTexture("PNG", image);
      textures.put(savename, texture);
    } catch (IOException e) {
View Full Code Here

        Logger.error("Error while loading image: " + filename);
        e.printStackTrace();
      }
    }
   
    Texture texture = null;
   
    try {
      texture = BufferedImageUtil.getTexture("PNG", image);
      textures.put(savename, texture);
    } catch (IOException e) {
View Full Code Here

          g.fillRect(posX, posY, partSize, partSize);
        }
      }
    }
   
    Texture texture = null;
    Image slickImage = null;
    try {
      texture = BufferedImageUtil.getTexture("", bufImg);
      slickImage = new Image(texture.getImageWidth(), texture.getImageHeight() );
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    slickImage.setTexture(texture) ;
View Full Code Here

   * @return Model
   * @throws FileNotFoundException
   * @throws IOException
   */
  public static Model loadOBJ(File file)throws FileNotFoundException, IOException{
    Texture texture = null;
    Map<String, Texture> textures = new HashMap<String, Texture>();
    BufferedReader reader = new BufferedReader(new FileReader(file));
    Model model = new Model();
    String line;
   
View Full Code Here

   * Loads Texture
   * @param tex String name of texture in AssetStore
   * @return Texture
   */
  public static Texture loadTexture(String tex){
    Texture texture = null;
    String format = tex.substring(tex.lastIndexOf('.') + 1);
    try {
      texture = TextureLoader.getTexture(format, ResourceLoader.getResourceAsStream(tex));
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

   * @return Model
   * @throws IOException
   */
  private static Texture loadMaterial(String ref) throws IOException{
    BufferedReader reader = new BufferedReader(new FileReader("res/model/" + mtlFile));
    Texture texture = null;
    String line = "";
    String tex = null;
   
    while((line != null)){
      line = reader.readLine();
View Full Code Here

TOP

Related Classes of org.newdawn.slick.opengl.Texture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.