loading compressed textures

Problems with Canvas, OpenGL, etc...

loading compressed textures

Postby raiderJerry » Sat Sep 24, 2011 9:58 pm

I need to quickly load images into textures using opengles 1.0 . These images have alpha channels, so I have selected the dxt5 compression format loading dds files. I would like to use pvr, but this is not supported on all of the devices I am targeting. Currently I have code running, but the textures show up pure white.

Finding some documentation and examples on using glCompressedTexImage2D with android / java has been a wasted effort. Certainly someone is doing this somewhere. If you know of a good reference please let me know.

Here is the code I am currently working with:
Code: Select all
      ByteBuffer bb = null;
      if (useDDSLoader == true)
         bb = DDSLoader.loadImage(is);
         int format = DDSLoader.getFormat();
         this.total = bb.capacity();
         bb = this.readToByteBuffer(is);
      textureInfo.source = iFile;

      // Generate one texture pointer...
      gl.glGenTextures(1, textureInfo.textures, 0);
      // ...and bind it to our array
      gl.glBindTexture(GL10.GL_TEXTURE_2D, textureInfo.textures[0]);

      // Create Nearest Filtered Texture
      gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
      gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

      gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
      gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
      gl.glCompressedTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_PALETTE4_RGB8_OES, 256, 256, 0, (int) this.total, bb);

This code does not create any gl errors, but generates a totally white background.

Any help at all would be appreciated
Once Poster
Once Poster
Posts: 1
Joined: Sat Sep 24, 2011 9:39 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 5 guests