Examples of Texture


Examples of org.newdawn.slick.opengl.Texture

    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

Examples of org.newdawn.slick.opengl.Texture

    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

Examples of org.newdawn.slick.opengl.Texture

        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

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() {
        /**
         * @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

Examples of org.newdawn.slick.opengl.Texture

    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

Examples of org.newdawn.slick.opengl.Texture

     * @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

Examples of org.newdawn.slick.opengl.Texture

    FBO = buffer.get();

    // for some reason FBOs won't work on textures unless you've absolutely just
    // created them.
    try {
      Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight());
     
      EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, FBO);
      EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT,
                               EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT,
                               GL11.GL_TEXTURE_2D, tex.getTextureID(), 0);
     
     
      completeCheck();
      unbind();
     
View Full Code Here

Examples of org.newdawn.slick.opengl.Texture

   *
   * @throws SlickException
   */
  private void init() throws SlickException {
    try {
      Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight());

      pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
      // Initialise state of the pbuffer context.
      pbuffer.makeCurrent();

      initGL();
      image.draw(0,0);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
      GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0,
                  tex.getTextureWidth(),
                  tex.getTextureHeight(), 0);
      image.setTexture(tex);
     
      Display.makeCurrent();
    } catch (Exception e) {
      Log.error(e);
View Full Code Here

Examples of org.newdawn.slick.opengl.Texture

   *
   * @throws SlickException
   */
  private void init() throws SlickException {
    try {
      Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight());
     
      final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
      pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

      // Initialise state of the pbuffer context.
      pbuffer.makeCurrent();

      initGL();
      GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
      pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
      image.draw(0,0);
      image.setTexture(tex);
     
      Display.makeCurrent();
View Full Code Here

Examples of org.newdawn.slick.opengl.Texture

       
       
        @Override
        protected void performGLOperations() throws SlickException{
          //Bind Texture
          Texture tex = img.getTexture(); //get Texture ref from Image
          tex.bind(); //binds the texture
         
          GL11.glMatrixMode(GL11.GL_PROJECTION);
          GL11.glLoadIdentity();
          GL11.glFrustum(-1.0, 1, -1.0, 1.0, 5, 100);
          GL11.glMatrixMode(GL11.GL_MODELVIEW);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.