Package java.nio

Examples of java.nio.IntBuffer.capacity()


  //        function below.
  public int create2dTexture(int color) {
    int id = genTexID();
   
    IntBuffer ibuf = bbuf.asIntBuffer();
    for (int i = 0; i < ibuf.capacity(); i++) ibuf.put(i, color);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, id);
    int targetFormat = GL11.GL_RGBA;
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
View Full Code Here


    return id;
  }
 
  public synchronized void update2dTexture_ConstanctColor(int color, int id) {
    IntBuffer ibuf = bbuf.asIntBuffer();
    for (int i = 0; i < ibuf.capacity(); i++) ibuf.put(i, color);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, id);
    int targetFormat = GL11.GL_RGBA;
    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, targetFormat, TEXTURE_RESX, TEXTURE_RESY, 0, GL11.GL_RGBA,
        GL11.GL_UNSIGNED_BYTE, bbuf.asIntBuffer());
View Full Code Here

    }
    public void testIntBufferArgument() {
        IntBuffer buf  = IntBuffer.allocate(1024);
        final int MAGIC = 0xABEDCF23;
        lib.fillInt32Buffer(buf, 1024, MAGIC);
        for (int i=0;i < buf.capacity();i++) {
            assertEquals("Bad value at index " + i, MAGIC, buf.get(i));
        }
    }
    public void testLongBufferArgument() {
        LongBuffer buf  = LongBuffer.allocate(1024);
View Full Code Here

    public void testDirectIntBufferArgument() {
        ByteBuffer buf  = ByteBuffer.allocateDirect(1024*4).order(ByteOrder.nativeOrder());
        IntBuffer intBuf = buf.asIntBuffer();
        final int MAGIC = 0xABEDCF23;
        lib.fillInt32Buffer(intBuf, 1024, MAGIC);
        for (int i=0;i < intBuf.capacity();i++) {
            assertEquals("Bad value at index " + i, MAGIC, intBuf.get(i));
        }
    }
   
    public void testDirectLongBufferArgument() {
View Full Code Here

        throw new GdxRuntimeException ("yHotspot coordinate of " + yHotspot  + " is not within image height bounds: [0, " + pixmap.getHeight() + ").");
      }

      // Convert from RGBA8888 to ARGB8888 and flip vertically
      IntBuffer pixelBuffer = pixmap.getPixels().asIntBuffer();
      int[] pixelsRGBA = new int[pixelBuffer.capacity()];
      pixelBuffer.get(pixelsRGBA);
      int[] pixelsARGBflipped = new int[pixelBuffer.capacity()];
      int pixel;
      if (pixelBuffer.order() == ByteOrder.BIG_ENDIAN) {
        for (int y = 0; y < pixmap.getHeight(); ++y) {
View Full Code Here

      // Convert from RGBA8888 to ARGB8888 and flip vertically
      IntBuffer pixelBuffer = pixmap.getPixels().asIntBuffer();
      int[] pixelsRGBA = new int[pixelBuffer.capacity()];
      pixelBuffer.get(pixelsRGBA);
      int[] pixelsARGBflipped = new int[pixelBuffer.capacity()];
      int pixel;
      if (pixelBuffer.order() == ByteOrder.BIG_ENDIAN) {
        for (int y = 0; y < pixmap.getHeight(); ++y) {
          for (int x = 0; x < pixmap.getWidth(); ++x) {
            pixel = pixelsRGBA[x + (y * pixmap.getWidth())];
 
View Full Code Here

        array.setAll(IntArray.unsafeValueOf());
        assertArrayEquals(new int[]{}, array.toArray());
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        IntBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get());
        }
    }
View Full Code Here

        }
        assertArrayEquals(new int[]{}, array.toArray());
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        IntBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get());
        }
    }
View Full Code Here

        array.clear();
        assertArrayEquals(new int[]{}, array.toArray());
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        IntBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get());
        }
    }
View Full Code Here

            glData.rewind();

            // create and write GL buffer
            gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
                gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, id[0]);
                gl.glBufferData(GL2.GL_ARRAY_BUFFER, glData.capacity()*4, glData, GL2.GL_STATIC_DRAW);
                gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
            gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
            gl.glFinish();
           

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.