Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by wallis2xk · Jul 10, 2012 at 06:54 PM · androidtextureformatglsupported

How to detect supported texture compression formats?

Hi, I have an asset bundle which contains a bunch of textures, which I have exported using the various Android texture compressions, DXT, PVR etc. Now is there a way to dynamically detect in the main application which method is supported on the device so I can load in the appropriate asset bundle. Or do I have to create different versions of the main application with the different methods hard-coded in?

There's a section in the Android docs which says

Here's an example query for supported texture compression formats from inside a GLSurfaceView.Renderer:

 public void onSurfaceChanged(GL10 gl, int w, int h) {
     String extensions = gl.glGetString(GL10.GL_EXTENSIONS);
     Log.d("ExampleActivity", extensions);
 }

This returns a string that lists each of the supported compression formats. Basically any way to get that info in Unity?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Aras · Oct 30, 2018 at 07:25 AM

I think https://docs.unity3d.com/ScriptReference/SystemInfo.SupportsTextureFormat.html might work

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lilinjie_ · Nov 01, 2018 at 01:55 AM 0
Share

Thank you. You are right.

avatar image
0

Answer by lilinjie_ · Nov 01, 2018 at 01:54 AM

 using System;
 using System.Text;
 using UnityEngine;
 using UnityEngine.UI;
 public class SupportsTextureFormat : MonoBehaviour {
 
     public Text showText;
     void Start () {
         StringBuilder sb = new StringBuilder();
         CheckSupportsTextureFormats(sb);
         showText.text = sb.ToString();
     }
 
     void CheckSupportsTextureFormats(StringBuilder sb) {
         try {
             foreach (TextureFormat format in Enum.GetValues(typeof(TextureFormat))) {
                 Debug.Log(format.ToString());
                 // PVRTC_*BPP_* is deprecate. SupportsTextureFormat will throw exception.
                 if (format.ToString().Contains("PVRTC_2BPP_RGB") || format.ToString().Contains("PVRTC_4BPP_RGB")) {
                     continue;
                 }
                 sb.AppendLine(format.ToString() + ": " + SystemInfo.SupportsTextureFormat(format).ToString());
             }
         } catch (Exception e) {
             Debug.LogError(e.ToString());
         }
     }
 }


I write an example, you can try.

Reference: https://docs.unity3d.com/ScriptReference/SystemInfo.SupportsTextureFormat.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Mipmapping on Tablets 1 Answer

why cannot build movie texture on android? 4 Answers

Assigning UV Map to model at runtime 0 Answers

Streamreader read .txt file with Android 0 Answers

Saving and loading to/from Android 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges