Package sprites

Examples of sprites.Texture


  }
 
  @Override
  public void renderSprite(Sprite sprite, int x, int y) {
   
    Texture t = sprite.getTexture();
   
    int xpos = x;
    int ypos = y;
    int width = sprite.getWidth();
    int height = sprite.getHeight();
    float xit = (float) sprite.getTextureX();
    float yit = (float) sprite.getTextureY();
    float wit = (float) sprite.getWidthInTexture();
    float hit = (float) sprite.getHeightInTexture();
   
    this.setSpriteUBO(xpos, ypos, width, height, xit, yit, wit, hit, 0);
   
    this.gl.glBindVertexArray(this.spriteVAO);
    this.gl.glBindTexture(GL_TEXTURE_2D, t.getID());
    this.gl.glUseProgram(this.defaultProgram.getID());
   
    this.gl.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);
   
    this.gl.glUseProgram(0);
View Full Code Here


    this.gl.glBindVertexArray(0);
  }
 
  @Override
  public void renderSpriteRotated(Sprite sprite, int x, int y, float phi){
    Texture t = sprite.getTexture();
   
    int xpos = x;
    int ypos = y;
    int width = sprite.getWidth();
    int height = sprite.getHeight();
    float xit = (float) sprite.getTextureX();
    float yit = (float) sprite.getTextureY();
    float wit = (float) sprite.getWidthInTexture();
    float hit = (float) sprite.getHeightInTexture();
   
    this.setSpriteUBO(xpos, ypos, width, height, xit, yit, wit, hit, phi);
   
    this.gl.glBindVertexArray(this.spriteVAO);
    this.gl.glBindTexture(GL_TEXTURE_2D, t.getID());
    this.gl.glUseProgram(this.defaultProgram.getID());
   
    this.gl.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);
   
    this.gl.glUseProgram(0);
View Full Code Here

   
    // Poor filtering. Needed !
    this.gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    this.gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   
    Texture texture = new Texture(renderedTexture, width, height, width, height);
   
    // The depth buffer
    int depthrenderbuffer;
    this.gl.glGenRenderbuffers(1, ID_BUFFER);
    depthrenderbuffer = ID_BUFFER.get(0);
View Full Code Here

 
  public Texture loadTexture(String resourcePath, GL4 gl) {
    if(this.textureMap.containsKey(resourcePath)){
      return this.textureMap.get(resourcePath);
    }
    Texture tex;
    try {
      tex = createTexture(resourcePath, gl);
      return tex;
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

    gl.glTexImage2D(target, 0, dstPixelFormat,
        get2Fold(bufferedImage.getWidth()),
        get2Fold(bufferedImage.getHeight()), 0, srcPixelFormat,
        GL4.GL_UNSIGNED_BYTE, textureBuffer);
   
    return new Texture(textureID, texWidth, texHeight, originalW, originalH);
  }
View Full Code Here

TOP

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