congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ETC1
Code IndexAdd Tabnine to your IDE (free)

How to use
ETC1
in
android.opengl

Best Java code snippets using android.opengl.ETC1 (Showing top 7 results out of 315)

origin: Rajawali/Rajawali

public void setBitmap(Bitmap bitmap) {
  mBitmap = bitmap;
  int imageSize = bitmap.getRowBytes() * bitmap.getHeight();
  ByteBuffer uncompressedBuffer = ByteBuffer.allocateDirect(imageSize);
  bitmap.copyPixelsToBuffer(uncompressedBuffer);
  uncompressedBuffer.position(0);
  ByteBuffer compressedBuffer = ByteBuffer.allocateDirect(
      ETC1.getEncodedDataSize(bitmap.getWidth(), bitmap.getHeight())).order(ByteOrder.nativeOrder());
  ETC1.encodeImage(uncompressedBuffer, bitmap.getWidth(), bitmap.getHeight(), 2, 2 * bitmap.getWidth(),
      compressedBuffer);
  mByteBuffers = new ByteBuffer[]{compressedBuffer};
  setWidth(bitmap.getWidth());
  setHeight(bitmap.getHeight());
}
origin: doggycoder/AndroidOpenGLDemo

private ETC1Util.ETC1Texture createTexture(InputStream input) throws IOException {
  int width = 0;
  int height = 0;
  byte[] ioBuffer = new byte[4096];
  {
    if (input.read(ioBuffer, 0, ETC1.ETC_PKM_HEADER_SIZE) != ETC1.ETC_PKM_HEADER_SIZE) {
      throw new IOException("Unable to read PKM file header.");
    }
    if(headerBuffer==null){
      headerBuffer = ByteBuffer.allocateDirect(ETC1.ETC_PKM_HEADER_SIZE)
        .order(ByteOrder.nativeOrder());
    }
    headerBuffer.put(ioBuffer, 0, ETC1.ETC_PKM_HEADER_SIZE).position(0);
    if (!ETC1.isValid(headerBuffer)) {
      throw new IOException("Not a PKM file.");
    }
    width = ETC1.getWidth(headerBuffer);
    height = ETC1.getHeight(headerBuffer);
  }
  int encodedSize = ETC1.getEncodedDataSize(width, height);
  ByteBuffer dataBuffer = ByteBuffer.allocateDirect(encodedSize).order(ByteOrder.nativeOrder());
  int len;
  while ((len =input.read(ioBuffer))!=-1){
    dataBuffer.put(ioBuffer,0,len);
  }
  dataBuffer.position(0);
  return new ETC1Util.ETC1Texture(width, height, dataBuffer);
}
origin: doggycoder/AndroidOpenGLDemo

@Override
protected void onSizeChanged(int width, int height) {
  emptyBuffer=ByteBuffer.allocateDirect(ETC1.getEncodedDataSize(width,height));
  this.width=width;
  this.height=height;
  GLES20.glEnable(GLES20.GL_BLEND);
  GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);
}
origin: doggycoder/AndroidOpenGLDemo

@Override
protected void onSizeChanged(int width, int height) {
  emptyBuffer=ByteBuffer.allocateDirect(ETC1.getEncodedDataSize(width,height));
  this.width=width;
  this.height=height;
  GLES20.glEnable(GLES20.GL_BLEND);
  GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);
  mBaseFilter.setSize(width, height);
}
origin: Rajawali/Rajawali

  private void setBitmap(Bitmap bitmap) {
    mBitmap = bitmap;
    int imageSize = bitmap.getRowBytes() * bitmap.getHeight();
    ByteBuffer uncompressedBuffer = ByteBuffer.allocateDirect(imageSize);
    bitmap.copyPixelsToBuffer(uncompressedBuffer);
    uncompressedBuffer.position(0);

    ByteBuffer compressedBuffer = ByteBuffer.allocateDirect(
      ETC1.getEncodedDataSize(bitmap.getWidth(), bitmap.getHeight())).order(ByteOrder.nativeOrder());
    ETC1.encodeImage(uncompressedBuffer, bitmap.getWidth(), bitmap.getHeight(), 2, 2 * bitmap.getWidth(),
      compressedBuffer);
    setCompressionFormat(ETC1.ETC1_RGB8_OES);

    mByteBuffers = new ByteBuffer[]{compressedBuffer};
    setWidth(bitmap.getWidth());
    setHeight(bitmap.getHeight());
  }
}
origin: pondurii/vrVideo

public void setBitmap(Bitmap bitmap) {
  mBitmap = bitmap;
  int imageSize = bitmap.getRowBytes() * bitmap.getHeight();
  ByteBuffer uncompressedBuffer = ByteBuffer.allocateDirect(imageSize);
  bitmap.copyPixelsToBuffer(uncompressedBuffer);
  uncompressedBuffer.position(0);
  ByteBuffer compressedBuffer = ByteBuffer.allocateDirect(
      ETC1.getEncodedDataSize(bitmap.getWidth(), bitmap.getHeight())).order(ByteOrder.nativeOrder());
  ETC1.encodeImage(uncompressedBuffer, bitmap.getWidth(), bitmap.getHeight(), 2, 2 * bitmap.getWidth(),
      compressedBuffer);
  mByteBuffers = new ByteBuffer[]{compressedBuffer};
  setWidth(bitmap.getWidth());
  setHeight(bitmap.getHeight());
}
origin: pondurii/vrVideo

  private void setBitmap(Bitmap bitmap) {
    mBitmap = bitmap;
    int imageSize = bitmap.getRowBytes() * bitmap.getHeight();
    ByteBuffer uncompressedBuffer = ByteBuffer.allocateDirect(imageSize);
    bitmap.copyPixelsToBuffer(uncompressedBuffer);
    uncompressedBuffer.position(0);

    ByteBuffer compressedBuffer = ByteBuffer.allocateDirect(
      ETC1.getEncodedDataSize(bitmap.getWidth(), bitmap.getHeight())).order(ByteOrder.nativeOrder());
    ETC1.encodeImage(uncompressedBuffer, bitmap.getWidth(), bitmap.getHeight(), 2, 2 * bitmap.getWidth(),
      compressedBuffer);
    setCompressionFormat(ETC1.ETC1_RGB8_OES);

    mByteBuffers = new ByteBuffer[]{compressedBuffer};
    setWidth(bitmap.getWidth());
    setHeight(bitmap.getHeight());
  }
}
android.openglETC1

Most used methods

  • getEncodedDataSize
  • encodeImage
  • getHeight
  • getWidth
  • isValid

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • Kernel (java.awt.image)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now