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

How to use
ETC1Util$ETC1Texture
in
android.opengl

Best Java code snippets using android.opengl.ETC1Util$ETC1Texture (Showing top 8 results out of 315)

origin: Rajawali/Rajawali

try {
  ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(mResourceId));
  mByteBuffers = new ByteBuffer[]{texture.getData()};
  setWidth(texture.getWidth());
  setHeight(texture.getHeight());
  setCompressionFormat(ETC1.ETC1_RGB8_OES);
} catch (IOException e) {
  for (int i = 0, length = mResourceIds.length; i < length; i++) {
    ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(mResourceIds[i]));
    mipmapChain[i] = texture.getData();
    if (i == 0) {
      mip_0_width = texture.getWidth();
      mip_0_height = texture.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: pondurii/vrVideo

public void setResourceIds(int[] resourceIds) {
  ByteBuffer[] mipmapChain = new ByteBuffer[resourceIds.length];
  Resources resources = TextureManager.getInstance().getContext().getResources();
  int mip_0_width = 1, mip_0_height = 1;
  try {
    for (int i = 0, length = resourceIds.length; i < length; i++) {
      ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(resourceIds[i]));
      mipmapChain[i] = texture.getData();
      if (i == 0) {
        mip_0_width = texture.getWidth();
        mip_0_height = texture.getHeight();
      }
    }
    setWidth(mip_0_width);
    setHeight(mip_0_height);
    setCompressionFormat(ETC1.ETC1_RGB8_OES);
  } catch (IOException e) {
    RajLog.e(e.getMessage());
    e.printStackTrace();
  }
  mByteBuffers = mipmapChain;
}
origin: pondurii/vrVideo

  public void setInputStream(InputStream compressedTexture, Bitmap fallbackTexture) {
    ETC1Util.ETC1Texture texture = null;

    try {
      texture = ETC1Util.createTexture(compressedTexture);
    } catch (IOException e) {
      RajLog.e("addEtc1Texture: " + e.getMessage());
    } finally {
      if (texture == null) {
        setBitmap(fallbackTexture);

        if (RajLog.isDebugEnabled())
          RajLog.d("Falling back to uncompressed texture");
      } else {
        setByteBuffer(texture.getData());
        setWidth(texture.getWidth());
        setHeight(texture.getHeight());

        if (RajLog.isDebugEnabled())
          RajLog.d("ETC1 texture load successful");
      }
    }
  }
}
origin: pondurii/vrVideo

public void setResourceId(int resourceId) {
  mResourceId = resourceId;
  Resources resources = TextureManager.getInstance().getContext().getResources();
  try {
    ETC1Util.ETC1Texture texture = ETC1Util.createTexture(resources.openRawResource(resourceId));
    mByteBuffers = new ByteBuffer[]{texture.getData()};
    setWidth(texture.getWidth());
    setHeight(texture.getHeight());
    setCompressionFormat(ETC1.ETC1_RGB8_OES);
  } catch (IOException e) {
    RajLog.e(e.getMessage());
    e.printStackTrace();
  }
}
origin: doggycoder/AndroidOpenGLDemo

Log.e("wuwang","is ETC null->"+(t==null));
if(t!=null&&tAlpha!=null){
  Gl2Utils.getMatrix(SM,type,t.getWidth(),t.getHeight(),width,height);
  setMatrix(SM);
  onSetExpandData();
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,texture[0]);
  ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D,0,0,GLES20.GL_RGB,GLES20
    .GL_UNSIGNED_SHORT_5_6_5,new ETC1Util.ETC1Texture(width,height,emptyBuffer));
  GLES20.glUniform1i(mHTexture,getTextureType());
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,texture[1]);
  ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D,0,0,GLES20.GL_RGB,GLES20
    .GL_UNSIGNED_SHORT_5_6_5,new ETC1Util.ETC1Texture(width,height,emptyBuffer));
  GLES20.glUniform1i(mGlHAlpha,1+getTextureType());
  isPlay=false;
origin: doggycoder/AndroidOpenGLDemo

Log.e("wuwang","is ETC null->"+(t==null));
if(t!=null&&tAlpha!=null){
  MatrixUtils.getMatrix(super.getMatrix(),MatrixUtils.TYPE_FITEND,t.getWidth(),t.getHeight(),width,height);
  MatrixUtils.flip(super.getMatrix(),false,true);
  onSetExpandData();
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,texture[0]);
  ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D,0,0,GLES20.GL_RGB,GLES20
      .GL_UNSIGNED_SHORT_5_6_5,new ETC1Util.ETC1Texture(width,height,emptyBuffer));
  GLES20.glUniform1i(mHTexture,getTextureType());
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,texture[1]);
  ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D,0,0,GLES20.GL_RGB,GLES20
      .GL_UNSIGNED_SHORT_5_6_5,new ETC1Util.ETC1Texture(width,height,emptyBuffer));
  GLES20.glUniform1i(mGlHAlpha,1+getTextureType());
  isPlay=false;
origin: Rajawali/Rajawali

  public void setInputStream(InputStream compressedTexture, Bitmap fallbackTexture) {
    ETC1Util.ETC1Texture texture = null;

    try {
      texture = ETC1Util.createTexture(compressedTexture);
    } catch (IOException e) {
      RajLog.e("addEtc1Texture: " + e.getMessage());
    } finally {
      if (texture == null) {
        setBitmap(fallbackTexture);

        if (RajLog.isDebugEnabled())
          RajLog.d("Falling back to uncompressed texture");
      } else {
        setByteBuffer(texture.getData());
        setWidth(texture.getWidth());
        setHeight(texture.getHeight());

        if (RajLog.isDebugEnabled())
          RajLog.d("ETC1 texture load successful");
      }
    }
  }
}
android.openglETC1Util$ETC1Texture

Most used methods

  • getHeight
  • getWidth
  • getData
  • <init>

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • BoxLayout (javax.swing)
  • JComboBox (javax.swing)
  • From CI to AI: The AI layer in your organization
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