Advertisement
Guest User

renderSprite

a guest
Jul 7th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1.     @Override
  2.     public void renderSprite(Sprite sprite, int x, int y) {
  3.        
  4.         Texture t = sprite.getTexture();
  5.        
  6.         int xpos = x;
  7.         int ypos = y;
  8.         int width = sprite.getWidth();
  9.         int height = sprite.getHeight();
  10.         float xit = (float) sprite.getTextureX();
  11.         float yit = (float) sprite.getTextureY();
  12.         float wit = (float) sprite.getWidthInTexture();
  13.         float hit = (float) sprite.getHeightInTexture();
  14.        
  15.         this.setSpriteUBO(xpos, ypos, width, height, xit, yit, wit, hit);
  16.        
  17.         this.gl.glBindVertexArray(this.spriteVAO);
  18.         this.gl.glBindTexture(GL_TEXTURE_2D, t.getID());
  19.         this.gl.glUseProgram(this.defaultProgram.getID());
  20.        
  21.         this.gl.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, 0);
  22.        
  23.         this.gl.glUseProgram(0);
  24.         this.gl.glBindTexture(GL_TEXTURE_2D, 0);
  25.         this.gl.glBindVertexArray(0);
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement