Archive Pages Design$type=blogging

How to check if Android Device Supports OpenGL ES 2.0

The OpenGL ES Android tutorial - How to check if Android Device Supports OpenGL ES 2.0

OpenGL ES stands for OpenGL for Embedded Systems also called as GLES. It is subset of OpenGL Computer graphics API for rendering 2D and 3D computer graphics particularly focusing on Hardware Accelerated using GPU. It is used in embedded systems like Smartphones (iPhone, Android Phones), Tablets (iPad, Android Tablets), Video game Consoles (Xbox, Play Station) and PDA (Personal Digital Assistant). Due to it openness and cross platform support, it is quite popular as well as most used graphics API in Smartphone and Tablets.

In this post we are going to know programically if Android Device Supports OpenGL ES 2.0. This is tutorial for OpenGL ES Android Programming . To check if Android Device Supports OpenGL ES 2.0 or not we are going to use very simple code. Let’s get started with it.

Prerequisite

For this our OpenGL ES Android tutorial it is assumed that you basic level of Java and Android Programming. It is also assumed that you are familiar with OpenGL as well. We are going to need some software installed on your computer to begin with our OpenGL ES Android tutorial. We need the following tools –
  • Android Studio (or Eclipse with ADT Plugin)
  • Android SDK

Android Studio is official IDE for Android Development so here I will show the tutorial in it, but you are free to use Eclipse (But why?).

Creating the Project

11.  First Step is to create a new project in Android Studio. Open Android Studio and create a new project but don’t create any activity for this as we are not going to need. You should choose “Add No Activity”. If required for further programming you can create Activity then.

22. Next Step is to create a class “MainActivity.java” (Right click on your package name under java -> new ->class). In this activity class just create the “onCreate” method. In the method we will use the logic to identify OpenGL 2.0. In a condtion we will check the status of OpenGL ES2.0 and toast  the result. Check the code below.

@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);      
ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
Boolean supportes2 = (info.reqGlEsVersion>= 0x20000);
Boolean supportes2 = (info.reqGlEsVersion>= 0x20000);
      
if(supportes2){
Toast.makeText(getApplicationContext(),"Your Device Support OpenGL ES2",Toast.LENGTH_LONG).show();
        }
        else{
Toast.makeText(getApplicationContext(),"Your Device doesn’t  Support OpenGL ES2",Toast.LENGTH_LONG).show();          
Log.d("OpenGL ES2", "Your Device doesn't  Support ES2. ("+info.reqGlEsVersion+")");
        }
    }

Explanation

First we created ActitivtyManager object to access or interact with the system services. Now we created ConfigurationInfo object and retrieve the hardware configuration of the device. This object will help us know the GLES version used.  Next we created the variable  supportes2. With reqGlEsVersion we checked the version from the condition we used and stored  result in our Boolean variable. We have used the condition with “0x20000” which represent the GLES version upper 16 bits for major version while lower 16 bits for minor version.

33.  Final Step is to run and check if Android Device Supports OpenGL ES 2.0. Go to Run menu and select “Run ‘app’” or use shortcut shift+f10. Check which toast is called.

Final Thought

Google added support for OpenGL ES 2.0 in Android 2.0 through NDK and Android 2.2 through Java. Today’s Modern Phone almost support the OpenGL ES 2.0 so if you wonder to check higher version like OpenGL ES 3.0 replace  0x20000 with 0x30000 in “Boolean supportes2 = (info.reqGlEsVersion>= 0x20000);” which is supported from Android 4.3.

Please comment below how you liked this tutorial. Give us feedback so we can improve on our OpenGL ES Android tutorial. Stay tune for more tutorials.

Reference



COMMENTS

Name

3D Bi-Cycle 3D Game 3D Laptop 3D Objects 3D Projects 3D Zoo Algorithm Android Aquarium Bellman-Ford Algorithm Block Breaker Blockshooting Bucket Sort C# Chess Clock Code Blocks Colors Complex Project Complex Projects Crab Pong Cross Zero DSAV Escapa First Come First Serve Fluids Font Demo Games Gear Motion GlutDino Glutplane Graphics Editor iOS iPhone Java Java OpenGL Graphics Programming Light Torus Linked List Ludo Board Game Mancala board games Memory blocks game Memory Game Menu Mickey Mouse Minesweeper Miniature Steam Engine moth Motion Blur MoveLight moving car Moving Ship Multiplex Networking Based Project Nuclear Power Plant Olympic opengl c++ examples OpenGL ES OpenGL Tutorial Origami OS Based Projects Paint Paper Folding Particles Drop Path Finding ping pong Pong Game Project Report Projects Report Puzzles qix like Random Flowing lines Rigid Body Rings Robot sample c++ opengl code Screen Saver Screen Saver Ship Shadow Cube Shadowfun Ship Iceberg Simple Drawing Simple Haloed Lined Wireframe Simple Move Light Simple Project Simulation SNAKE XENZIA GAME Solar system Sorting Sphere Spot Light Swing Stars Taj Mahal The Edge Game Tic Tac Toe Tower of Hanoi Traffic Signal Transformation Triangular Animation Tutorial water ripple effects Whirlpool
false
ltr
item
OpenGL Projects: How to check if Android Device Supports OpenGL ES 2.0
How to check if Android Device Supports OpenGL ES 2.0
The OpenGL ES Android tutorial - How to check if Android Device Supports OpenGL ES 2.0
https://3.bp.blogspot.com/-jNOV-3mEA8A/VbtFd-JyTyI/AAAAAAAAHb0/Q8UgX4itlDI/s400/Capture12232.PNG
https://3.bp.blogspot.com/-jNOV-3mEA8A/VbtFd-JyTyI/AAAAAAAAHb0/Q8UgX4itlDI/s72-c/Capture12232.PNG
OpenGL Projects
http://www.openglprojects.in/2015/07/how-to-check-if-android-device-supports-opengl-es-2.0.html
http://www.openglprojects.in/
http://www.openglprojects.in/
http://www.openglprojects.in/2015/07/how-to-check-if-android-device-supports-opengl-es-2.0.html
true
2020194800836807725
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago