Package org.newdawn.slick.opengl

Examples of org.newdawn.slick.opengl.Texture


      //GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
      //getTexture().bind();
      GL11.glColor3d(1, 1, 1);
      //GL11.glColor3d(.25, .25, .25);
     
      Texture tex;
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      for(int i = 0; i < hearts.length; i++){
        if(hearts[i] == 1){
          tex = full;
        } else if (hearts[i] == .5){
          tex = half;
        } else {
          tex = empty;
        }
        tex.bind();
        GL11.glBegin(GL11.GL_QUADS);
          GL11.glNormal3d(0, 0, 1);
          GL11.glTexCoord2d(0.0, 0.0);
          GL11.glVertex3d(x + heartWidth*i, y, zIndex);
          GL11.glTexCoord2d(1.0, 0.0);
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,
        GL11.GL_TEXTURE_2D, // target
        GL11.GL_RGBA, // dest pixel format
        GL11.GL_LINEAR, // min filter (unused)
        GL11.GL_LINEAR);

View Full Code Here

     * The colour has to be set independently of this method.
     *
     * @param shape The shape to draw.
     */
    public static final void draw(Shape shape) {
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();
       
        float points[] = shape.getPoints();
       
        LSR.start();
        for(int i=0;i<points.length;i+=2) {
          LSR.vertex(points[i], points[i + 1]);
        }
       
        if (shape.closed()) {
          LSR.vertex(points[0], points[1]);
        }
       
        LSR.end();
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

     * @param fill The fill to apply
     */
    public static final void draw(Shape shape, ShapeFill fill) {
        float points[] = shape.getPoints();
       
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();

        float center[] = shape.getCenter();
        GL.glBegin(SGL.GL_LINE_STRIP);
        for(int i=0;i<points.length;i+=2) {
            fill.colorAt(shape, points[i]-center[0], points[i + 1]-center[1]).bind();
            Vector2f offset = fill.getOffsetAt(shape, points[i], points[i + 1]);
            GL.glVertex2f(points[i] + offset.x, points[i + 1] + offset.y);
        }
       
        if (shape.closed()) {
          fill.colorAt(shape, points[0]-center[0], points[1]-center[1]).bind();
          Vector2f offset = fill.getOffsetAt(shape, points[0], points[1]);
          GL.glVertex2f(points[0] + offset.x, points[1] + offset.y);
        }
        GL.glEnd();
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

    public static final void fill(Shape shape) {
      if (!validFill(shape)) {
        return;
      }
     
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();
       
      fill(shape, new PointCallback() {
        /**
         * @see org.newdawn.slick.geom.ShapeRenderer.PointCallback#preRenderPoint(float, float)
         */
      public float[] preRenderPoint(float x, float y) {
        // do nothing, we're just filling the shape this time
        return null;
      }
      });
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

    public static final void texture(Shape shape, Image image, final float scaleX, final float scaleY) {
      if (!validFill(shape)) {
        return;
      }
     
      Texture t = TextureImpl.getLastBind();
        image.getTexture().bind();
       
        fill(shape, new PointCallback() {
        /**
         * @see org.newdawn.slick.geom.ShapeRenderer.PointCallback#preRenderPoint(float, float)
         */
      public float[] preRenderPoint(float x, float y) {
              GL.glTexCoord2f(x * scaleX, y * scaleY);
              return null;
      }
      });
     
        float points[] = shape.getPoints();
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

        return;
      }
     
        float points[] = shape.getPoints();
       
        Texture t = TextureImpl.getLastBind();
        image.getTexture().bind();
       
        final float minX = shape.getX();
        final float minY = shape.getY();
        final float maxX = shape.getMaxX() - minX;
        final float maxY = shape.getMaxY() - minY;

        fill(shape, new PointCallback() {
        /**
         * @see org.newdawn.slick.geom.ShapeRenderer.PointCallback#preRenderPoint(float, float)
         */
      public float[] preRenderPoint(float x, float y) {
              GL.glTexCoord2f(((x - minX) / maxX) * scaleX, ((y - minY) / maxY) * scaleY);
              GL.glTexCoord2f(x * scaleX, y * scaleY);
              return null;
      }
      });
       
        if (t == null) {
          TextureImpl.bindNone();
        } else {
          t.bind();
        }
    }
View Full Code Here

    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() {
        /**
         * @see org.newdawn.slick.geom.ShapeRenderer.PointCallback#preRenderPoint(float, float)
         */
      public float[] preRenderPoint(float x, float y) {
              fill.colorAt(shape, x - center[0], y - center[1]).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, 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() {
        /**
         * @see org.newdawn.slick.geom.ShapeRenderer.PointCallback#preRenderPoint(float, float)
         */
      public float[] preRenderPoint(float x, float y) {
              fill.colorAt(shape, x - center[0], y - center[1]).bind();
              Vector2f offset = fill.getOffsetAt(shape, x, y);
              GL.glTexCoord2f(x * scaleX, y * scaleY);

              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() {
        /**
         * @see org.newdawn.slick.geom.ShapeRenderer.PointCallback#preRenderPoint(float, float)
         */
      public float[] preRenderPoint(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

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.