Package mdesl.graphics

Examples of mdesl.graphics.Texture


  protected void create() throws LWJGLException {
    super.create();
   
    try {
      //load our texture with linear filter
      tex = new Texture(Util.getResource("res/slider.png"), Texture.LINEAR);
      tex2 = new Texture(Util.getResource("res/tiles.png"), Texture.LINEAR);
    } catch (IOException e) {
      throw new RuntimeException("couldn't decode texture");
    }
   
    //our simple demo won't support display resizing
View Full Code Here


  protected void create() throws LWJGLException {
    super.create();

    //this will be ignored in this lesson...
    try {
      tex = new Texture(Util.getResource("res/grass.png"), Texture.NEAREST);
    } catch (IOException e) {
      throw new RuntimeException("couldn't decode texture");
    }
   
    //load our shader program and sprite batch
View Full Code Here

  protected void create() throws LWJGLException {
    super.create();
   
    try {
      //load our texture with linear filter
      rock = new Texture(Util.getResource("res/rock.png"), Texture.LINEAR);
      rockNormals = new Texture(Util.getResource("res/rock_n.png"), Texture.LINEAR);
    } catch (IOException e) {
      throw new RuntimeException("couldn't decode texture");
    }

    //load our shader program and sprite batch
View Full Code Here

    curFilter = prefs.getBoolean("linear", true) ? Texture.LINEAR : Texture.NEAREST;
    grid = prefs.getBoolean("grid", true);
    checkBG = prefs.getBoolean("checkBG", true);
    polling = prefs.getBoolean("polling", true);
    try {
      Texture fontTex = new Texture(Util.getResource("res/ptsans_00.png"));
      font = new BitmapFont(Util.getResource("res/ptsans.fnt"), fontTex);
     
      String path = prefs.get("url", null);
      if (path!=null&&path.length()!=0) {
        try {
          File file = new File(URLDecoder.decode(path, "UTF-8"));
          if (file.exists()) {
            url = file.toURI().toURL();
            this.file = file;
            lastModified = file.lastModified();
          }
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      if (url!=null)
        reload();
     
      terrain = new TerrainMesh(Util.getResource("res/height.png"));
      terrain.create(1, 55f, 25f);
     
      batch = new SpriteBatch();
     
      //in Photoshop, we included a small white box at the bottom right of our font sheet
      //we will use this to draw lines and rectangles within the same batch as our text
      rect = new TextureRegion(fontTex, fontTex.getWidth()-2, fontTex.getHeight()-2, 1, 1);
     
      fpsWidth = font.getWidth("FPS: 0000");
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

      return;
    }       
    try {
      if (tex!=null)
        tex.dispose();
      tex = new Texture(url, curFilter, Texture.REPEAT);
      errStr = "";
    } catch (IOException e) {
      e.printStackTrace();
      errStr = "Error decoding texture: "+e.getMessage();
    }
View Full Code Here

      data.put(x).put(y).put(z).put( x/(float)w * texSize ).put( y/(float)h * texSize );
    }
    float rot=0;
   
    public void render() {
      Texture t = tex!=null ? tex : font.getTexturePages()[0].getTexture();
      program.use();
     
      float s = (float)Math.sin(getTime());
      view.setIdentity();
      view.translate(new Vector3f(-10f, 10f, -50f));
      view.rotate((float)Math.toRadians(rot+=0.10f), new Vector3f(0f, 1f, 0f));
//      view.rotate((float)Math.toRadians(90f), new Vector3f(1f, 0f, 0f));
      //view.scale(new Vector3f(s,s,s));
//      view.rotate((float)Math.toRadians(rot+=0.5f), new Vector3f(0f,0f,1f));
//      proj = MathUtil.toOrtho2D(proj, 0, 0, Display.getWidth(), Display.getHeight());
      Matrix4f.mul(Matrix4f.transpose(proj, transpositionPool), view, projView);
      program.setUniformMatrix("u_projView", false, projView);
     
      t.bind();
      data.bind();
      data.draw(GL_TRIANGLE_STRIP, 0, w*h);
      data.unbind();
    }
 
View Full Code Here

TOP

Related Classes of mdesl.graphics.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.