Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1054309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:23:06+00:00 2026-05-16T17:23:06+00:00

I want to learn OpenGL ES directly since I’m targeting my development to android,

  • 0

I want to learn OpenGL ES directly since I’m targeting my development to android, however. I want to learn OpenGL ES in order to develop my 2D games. I chose it for performances purpose (since basic SurfaceView drawing isn’t that efficient when it comes to RT games).
My question is: where to start?
I’ve spent over a month browsing Google and reading/trying some tutorials/examples I’ve found anywhere but to be honest, it didn’t help much and this is for two reasons:

  1. Almost all the articles/tutorials I’ve came across are 3D related (I only want to learn how to do my 2D Sprites drawing)
  2. There’s no base to start from since all the articles targets a specific things like: "How to draw a triangle (with vertices)", "How to create a Mesh"… etc.

I’ve tried to read some source code too (ex.: replica island) but the codes are too complicated and contains a lot of things that aren’t necessary; result: I get lost among 100 .java files with weird class names and stuff.

I guess there’s no course like the one I’m looking for, but I’ll be very glad if somebody could give me some guidelines and some links maybe to learn what I’m up to (only OpenGL ES 2D Sprites rendering! nothing 3D).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:23:07+00:00Added an answer on May 16, 2026 at 5:23 pm

    I was in a similar situation.
    The way I started with openGL with start by looking at the very basic GLSurfaceView samples/demos.

    Start, by setting up your app activity, and set up the basic canvas.

    Take a loot at the replica island source code file: GameRenderer.java for how to setup your canvas with the proper GL flags for 2D (sprite) rendering.
    You should really take a look at SpriteMethodTest by the same author of replica island: http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest

    See this question where I posted my own code: Using OpenGL to replace Canvas – Android

    After you have your canvas set up, you start by calling something like:
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    After that you’re ready to render a sprite.
    First, you’ll need to load the sprite into a texture: http://qdevarena.blogspot.com/2009/02/how-to-load-texture-in-android-opengl.html

    However, this is the tutorial that really helped me out with loading sprites:
    http://tkcodesharing.blogspot.com/2008/05/working-with-textures-in-androids.html

    This is how I do it, I have a class named Texture.java:

    public class Texture
    {
        /*Begin public declarations*/
        public float x = 0;
        public float y = 0;
        public float z = 0;
        public float width = 0;
        public float height = 0;
        /*Begin Private Declarations*/
        private GL10 gl;
        public int[] texture;    //holds the texture in integer form
        private int texture_name;
        private int[] mCropWorkspace;
        private final BitmapFactory.Options sBitmapOptions;
    
    
    /*Begin Methods*/
    public Texture( GL10 gl_obj )
    {
        gl = gl_obj;
        texture = new int[1];
        mCropWorkspace = new int[4];
        sBitmapOptions = new BitmapFactory.Options();
        sBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
        //Log.d(TAG, "Initializing Texture Object");
    }    
    public int get_texture_name( )
    {
        return texture_name;
    }
    
    /*Loads the resource to memory*/
    public boolean Load( Bitmap bitmap ) //rename this to glLoad and don't have it as an initializer parameter
    {
        /*many thanks to sprite method test if this works*/
        if ( gl == null )
        {
            Log.e(TAG, "Failed to load resource.  Context/GL is NULL");
            return false;
        }
        int error;
    
        int textureName = -1;
        gl.glGenTextures(1, texture, 0);
        textureName = texture[0];
    
        //Log.d(TAG, "Generated texture: " + textureName);
        gl.glBindTexture(GL10.GL_TEXTURE_2D, textureName);
        gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
        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.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);
    
        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
    
        mCropWorkspace[0] = 0;
        mCropWorkspace[1] = bitmap.getHeight();
        mCropWorkspace[2] = bitmap.getWidth();
        mCropWorkspace[3] = -bitmap.getHeight();
    
        ((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, 
                GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);
    
        error = gl.glGetError();
        if (error != GL10.GL_NO_ERROR)
        { 
            Log.e(TAG, "GL Texture Load Error: " + error);
    
        }
        //Log.d(TAG, "Loaded texture: " + textureName);
        return true;
     }
    }
    

    Then in my onDrawFrame() method I simply do:

    Texture texture = ...
    gl.glBindTexture(GL10.GL_TEXTURE_2D, texture.texture[0]);
    ((GL11Ext) gl).glDrawTexfOES((float)(draw_x + 0.5), (float)(draw_y + 0.5), 0, tile_width, tile_height);
    

    That should get you going with drawing 2D sprites on an openGL canvas.
    I’ve noticed that there is really no straightforward tutorial on this. Hopefully in the future I will post one in my dev blog: http://developingthedream.blogspot.com/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am beginner of Android OpenGL I want to learn and make Live wallpaper
I want to learn C++ so that i can develop C++ Python modules for
I want to learn about Code First development in EF4 and after googling about
I have a bit of experience writing OpenGL 2 applications and want to learn
I'm looking to learn OpenGL ES 2.0 on Android and the tutorials I've found
What's the best way to run into android game development with OpenGL ES? I
I want to learn OpenGL2.0 in android.But I didn't find the way how to
I am developing several iPhone applications using UIKit. I want to learn and develop
I'm trying to learn how to make video games on Android, and therefore I'm
Recently I want to learn OpenGL ES. But I don't know which version should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.