Package org.newdawn.slick.opengl

Examples of org.newdawn.slick.opengl.Texture


    public static final void fill(final Shape shape, final ShapeFill fill) {
        if (!validFill(shape)) {
        return;
      }
       
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();

        final float center[] = shape.getCenter();
        fill(shape, new PointCallback() {
      public float[] preRenderPoint(Shape shape, float x, float y) {
              fill.colorAt(shape, x, y).bind();
              Vector2f offset = fill.getOffsetAt(shape, x, y);
             
              return new float[] {offset.x + x,offset.y + y};
      }
      });
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here


    public static final void texture(final Shape shape, final Image image, final float scaleX, final float scaleY, final ShapeFill fill) {
      if (!validFill(shape)) {
        return;
      }
       
        Texture t = TextureImpl.getLastBind();
        image.getTexture().bind();
       
        final float center[] = shape.getCenter();
        fill(shape, new PointCallback() {
      public float[] preRenderPoint(Shape shape, float x, float y) {
              fill.colorAt(shape, x - center[0], y - center[1]).bind();
              Vector2f offset = fill.getOffsetAt(shape, x, y);
             
              x += offset.x;
              y += offset.y;
             
        float tx = x * scaleX;
        float ty = y * scaleY;
       
        tx = image.getTextureOffsetX() + (image.getTextureWidth() * tx);
        ty = image.getTextureOffsetY() + (image.getTextureHeight() * ty);
       
              GL.glTexCoord2f(tx, ty);

              return new float[] {offset.x + x,offset.y + y};
      }
      });
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

     * @param shape The shape to texture.
     * @param image The image to tile across the shape
     * @param gen The texture coordinate generator to create coordiantes for the shape
     */
    public static final void texture(final Shape shape, Image image, final TexCoordGenerator gen) {
        Texture t = TextureImpl.getLastBind();

        image.getTexture().bind();

        final float center[] = shape.getCenter();
        fill(shape, new PointCallback() {
      public float[] preRenderPoint(Shape shape, float x, float y) {
        Vector2f tex = gen.getCoordFor(x, y);
              GL.glTexCoord2f(tex.x, tex.y);

              return new float[] {x,y};
      }
      });
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

   * @throws IOException
   *             Indicates a failure to access the resource
   */
  public static Texture getTexture(String resourceName,
      BufferedImage resourceImage) throws IOException {
    Texture tex = getTexture(resourceName, resourceImage,
        SGL.GL_TEXTURE_2D, // target
        SGL.GL_RGBA8, // dest pixel format
        SGL.GL_LINEAR, // min filter (unused)
        SGL.GL_LINEAR);

View Full Code Here

   * @throws IOException
   *             Indicates a failure to access the resource
   */
  public static Texture getTexture(String resourceName,
      BufferedImage resourceImage, int filter) throws IOException {
    Texture tex = getTexture(resourceName, resourceImage,
        SGL.GL_TEXTURE_2D, // target
        SGL.GL_RGBA8, // dest pixel format
        filter, // min filter (unused)
        filter);

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.