Arm Community
Site
Search
User
Site
Search
User
Groups
Education Hub
Distinguished Ambassadors
Open Source Software and Platforms
Research Collaboration and Enablement
Forums
AI and ML forum
Architectures and Processors forum
Arm Development Platforms forum
Arm Development Studio forum
Arm Virtual Hardware forum
Automotive forum
Compilers and Libraries forum
Graphics, Gaming, and VR forum
High Performance Computing (HPC) forum
Infrastructure Solutions forum
Internet of Things (IoT) forum
Keil forum
Morello forum
Operating Systems forum
SoC Design and Simulation forum
SystemReady Forum
Blogs
AI and ML blog
Announcements
Architectures and Processors blog
Automotive blog
Graphics, Gaming, and VR blog
High Performance Computing (HPC) blog
Infrastructure Solutions blog
Internet of Things (IoT) blog
Operating Systems blog
SoC Design and Simulation blog
Tools, Software and IDEs blog
Support
Arm Support Services
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Support forums
Graphics, Gaming, and VR forum
compression to PKM
Jump...
Cancel
Locked
Locked
Replies
8 replies
Subscribers
136 subscribers
Views
9578 views
Users
0 members are here
OpenGL ES
Mali Texture Compression Tool
Options
Share
More actions
Cancel
Related
How was your experience today?
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
compression to PKM
Irfan Ziaulla
over 11 years ago
Parents
Pete
over 11 years ago
Note: This was originally posted on 22nd March 2013 at
http://forums.arm.com
Hi Irfan,
I didn't spot you posted about the same issue twice - I've merged the threads and deleted the duplicate post without the code.
You are right that the ETC1 format used by OpenGL ES 2.0 doesn't contain an alpha channel, but plenty of OpenGL ES 2.0 games and examples manage translucent water effects, so you don't need to move to OpenGL ES 3.0 just for that reason. Since there are not many commercial devices supporting OpenGL ES 3.0 yet perhaps aim to do the effect under OpenGL ES 2.0 to maximise the target market?
There are a few ways to use both ETC1 and have an alpha channel, essentially it comes down to 2 choices.
1) you could double the height of the texture, and keep only RGB color data in the top half, and put the alpha channel in the bottom half in grayscale. Then, your fragment shader changes to sample the top half of the texture to get the color data and samples the same texel in the bottom half to read the alpha value.
2) you could have 2 ETC1 textures, one holding color data and one holding alpha data coded as grayscale. You sample both textures in your fragment shader to form the complete RGBA texture data.
We have some sample code and a document that goes into more depth on these techniques.
From the code posted, it looks like if you see the message "Unable to read PKM file header" then the code wasn't able to read even the ETC1 header bytes. Could it be a problem with the InputStream itself? You could try changing the code to print how many bytes were able to be read (we only know it's not the number that are in an ETC1 header). If for instance it comes back zero then something has gone wrong trying to read the stream at all. If it reads some but not enough for an ETC1 header then perhaps the file has become corrupt and truncated somehow.
HTH, Pete
Cancel
Up
0
Down
Cancel
Reply
Pete
over 11 years ago
Note: This was originally posted on 22nd March 2013 at
http://forums.arm.com
Hi Irfan,
I didn't spot you posted about the same issue twice - I've merged the threads and deleted the duplicate post without the code.
You are right that the ETC1 format used by OpenGL ES 2.0 doesn't contain an alpha channel, but plenty of OpenGL ES 2.0 games and examples manage translucent water effects, so you don't need to move to OpenGL ES 3.0 just for that reason. Since there are not many commercial devices supporting OpenGL ES 3.0 yet perhaps aim to do the effect under OpenGL ES 2.0 to maximise the target market?
There are a few ways to use both ETC1 and have an alpha channel, essentially it comes down to 2 choices.
1) you could double the height of the texture, and keep only RGB color data in the top half, and put the alpha channel in the bottom half in grayscale. Then, your fragment shader changes to sample the top half of the texture to get the color data and samples the same texel in the bottom half to read the alpha value.
2) you could have 2 ETC1 textures, one holding color data and one holding alpha data coded as grayscale. You sample both textures in your fragment shader to form the complete RGBA texture data.
We have some sample code and a document that goes into more depth on these techniques.
From the code posted, it looks like if you see the message "Unable to read PKM file header" then the code wasn't able to read even the ETC1 header bytes. Could it be a problem with the InputStream itself? You could try changing the code to print how many bytes were able to be read (we only know it's not the number that are in an ETC1 header). If for instance it comes back zero then something has gone wrong trying to read the stream at all. If it reads some but not enough for an ETC1 header then perhaps the file has become corrupt and truncated somehow.
HTH, Pete
Cancel
Up
0
Down
Cancel
Children
No data