# Detecting Alpha Channel with PVRTexTool's DDS Output

**URL:** <https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906>\
**Category:** PowerVR Insider\
**Tags:** pvrtextool\
**Created:** [September 23, 2013, 6:04pm UTC](https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906 "2013-09-23T18:04:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sw7](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sw7](https://forums.imgtec.com/u/sw7)\
**Post date:** [September 23, 2013, 6:04pm UTC](https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906/1 "2013-09-23T18:04:27Z")

</div>

I am using PVRTexTool (commandline) to generate a DDS file with specified PVRTC formats (PVRTC1\_4 , PVRTC1\_4\_RGB, etc.). I am having difficulty parsing the generated DDS header in my loader to determine which OpenGL internal format should be used, particularly between the RGBA and RGB formats (GL\_COMPRESSED\_RGBA\_PVRTC\_4BPPV1\_IMG vs. GL\_COMPRESSED\_RGB4\_PVRTC\_4BPPV1\_IMG).  
  
  
  
I would expect to read in the internal format for OpenGL by parsing the fourCC from the DDS header. When reading in the generated DDS header, it seems that regardless if PVRTC1\_4 or PVRTC1\_4\_RGB is specified, the same fourCC is generated for each. The only difference in fourCC’s used is between 2bpp and 4bpp. I also don’t see other flags being set in the DDS header that would help me parse out this information (e.g. dwAlphaBitDepth isn’t set).  
  
  
  
  
  
How can I correctly parse the generated DDS header from PVRTexTool to determine whether or not I should specify the RGB or RGBA internal format for OpenGL?

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [September 25, 2013, 11:45am UTC](https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906/2 "2013-09-25T11:45:50Z")

</div>

Hi Sw7,  
  
  
  
Unfortunately we never considered setting an alpha flag in a DDS file for the different file types - our DirectX implementations make no distinction between RGBA and RGB PVRTC textures - because regions of both are permitted in either case - the decode has to handle both regardless.  
  
  
  
This is now also true for our OpenGL ES implementation - I believe there used to be an optimisation for our MBX hardware when not supporting alpha, but if you’re on Series5 (SGX) it won’t make a difference - just upload it as RGBA, as this works as a catch all.  
  
  
  
So there’s nothing in the DDS header at present which would signify one or the other, though I can certainly add something to a future version of our DDS export code - I’ll have a look into it. I’ll probably do it by adding the “ALPHA\_PIXELS” flag. If you need this information from a application point of view, I can’t really make any suggestions at present beyond considering making the switch to PVR files, otherwise you’re probably going to have to enumerate it yourself some other way I’m afraid.  
  
  
  
Regards,  
  
Tobias

---

<div class="post-metadata">

**Author:** ![sw7](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sw7](https://forums.imgtec.com/u/sw7)\
**Post date:** [September 25, 2013, 4:06pm UTC](https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906/3 "2013-09-25T16:06:19Z")

</div>

Thanks for the response,  
  
  
  
If I’m understanding this correctly, with newer hardware (SGX), there’s no need to distinguish between the OpenGL ES internal format of RGB vs. RGBA for optimization or correctness purposes? If that’s the case, then I think we should be okay with how it is currently.

---

<div class="post-metadata">

**Author:** ![tobias](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tobias](https://forums.imgtec.com/u/tobias)\
**Post date:** [September 26, 2013, 7:09am UTC](https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906/4 "2013-09-26T07:09:14Z")

</div>

Hi Sw7,  
  
  
  
That is correct, yes. I’ll add the flag for a future release anyway though because it seems like a good idea 🙂  
  
  
  
Thanks,  
  
Tobias

---

<div class="post-metadata">

**Author:** ![sw7](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sw7](https://forums.imgtec.com/u/sw7)\
**Post date:** [September 26, 2013, 3:19pm UTC](https://forums.imgtec.com/t/detecting-alpha-channel-with-pvrtextools-dds-output/1906/5 "2013-09-26T15:19:20Z")

</div>

Great, thanks for your help!
