Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6470085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:04:06+00:00 2026-05-25T06:04:06+00:00

i have to use texture compression as my app is currently using up to

  • 0

i have to use texture compression as my app is currently using up to 100MB of ram for textures.

i am creating textures from Views, so it is not possible for them to be created in a compressed format. how can i compress them with ETC1/ATC/PVRTC on the fly and send them to gpu? i tried:

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, ETC1.ETC1_RGB8_OES, bitmap, 0);

i also tried other compression formats supported by my phone, but the texture is always white. the input bitmap is an RGB_565 and mip-maps are disabled.

is it possible to send a bitmap as a texture to opengl es 1.1 so it gets automatically compressed on android, like it is possible on a pc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:04:07+00:00Added an answer on May 25, 2026 at 6:04 am

    with help from Arne Bergene Fossaa i get to this solution:

    int size = m_TexBitmap.getRowBytes() * m_TexBitmap.getHeight();
    ByteBuffer bb = ByteBuffer.allocateDirect(size); // size is good
    bb.order(ByteOrder.nativeOrder());
    m_TexBitmap.copyPixelsToBuffer(bb);
    bb.position(0);
    
    ETC1Texture etc1tex;
    // RGB_565 is 2 bytes per pixel
    //ETC1Texture etc1tex = ETC1Util.compressTexture(bb, m_TexWidth, m_TexHeight, 2, 2*m_TexWidth);
    
    final int encodedImageSize = ETC1.getEncodedDataSize(m_TexWidth, m_TexHeight);
    ByteBuffer compressedImage = ByteBuffer.allocateDirect(encodedImageSize).order(ByteOrder.nativeOrder());
    // RGB_565 is 2 bytes per pixel
    ETC1.encodeImage(bb, m_TexWidth, m_TexHeight, 2, 2*m_TexWidth, compressedImage);
    etc1tex = new ETC1Texture(m_TexWidth, m_TexHeight, compressedImage);
    
    //ETC1Util.loadTexture(GL10.GL_TEXTURE_2D, 0, 0, GL10.GL_RGB, GL10.GL_UNSIGNED_SHORT_5_6_5, etc1tex);
    gl.glCompressedTexImage2D(GL10.GL_TEXTURE_2D, 0, ETC1.ETC1_RGB8_OES, m_TexWidth, m_TexHeight, 0, etc1tex.getData().capacity(), etc1tex.getData());
    
    bb = null;
    compressedImage = null;
    etc1tex = null;
    

    i know about the ETC1Util.compressTexture and ETC1Util.loadTexture, but they were giving corrupted textures. good thing is that i went from 100MB down to 26MB with native memory consumption. but this solution is slow as hell. and even though it is done on a separate thread with min priority, the rendering thread is totally blocked. is there a more efficent way? or do i have to create these ETC1 textures on the first run on a new device and save them to SD card for later reuse?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a 1024 x 1024 image I use for a texture in my
Currently, I'm able to load in a static sized texture which I have created.
I have a grass texture: I use it in my 2d-game. I want to
I have a big texture, 256*256 there is 64*64 pixel textures on it. How
I want to manipulate a texture which I use in opengl using CUDA. Knowing
I have a problem where the colors of any textures that I use are
I use Texture Packer. I have .pvr.ccz file there are 10 frames. I need
I have use IlMerge to merge all the dlls of my projects in one
I have use include ('base.php') script in my other scripts ( more.php ). Now
Hello I have use DOMDocs in the past but I am stuck how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.