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 7935231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:51:34+00:00 2026-06-03T21:51:34+00:00

I am making a OpenGL ES 2.0 android carousel. I have a for function

  • 0

I am making a OpenGL ES 2.0 android carousel. I have a “for” function that in each iteration calls “drawSquares” function that draws squares in a circle. That is done by changing the modelMatrix every time a new square is drawn. (For drawing the squares I use the same vertex and fragment shader)

I need to apply textures on the squares, but for every square to have a different texture. I can’t seem to be able to do this. I tried changing the value of the handle for the texture data right before the call drawSquare.

mTextureDataHandle = TextureHelper.loadTexture(context, item.getTexture());  

But every square has the same texture.

Can some suggest something, or tell me the best way to implement this. I am reading about opengl es 2.0 for about two months now, but still fill that there are many things I don’t understand. Please help, i would deeply appreciate every advice. Thank u!!!

  • 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-06-03T21:51:35+00:00Added an answer on June 3, 2026 at 9:51 pm

    Start Here. You have a couple of options –

    1. glBindTexture – every time you load a new texture into your handle, you will have to bind it again
    2. Use an array of handles – you can set mTextureDataHandle up as an int[], fill it in and then bind each texture to a separate GL Texture:

      mTextureDataHandle[0] = ...; //Load textures - repeat for [1..N]
      /* 
      *  Select which GL texture spot to use - GL has 30 pointers to use, your device 
      *  likely won't support that many
      */
      GLES20.glSetActiveTexture(GLES20.GL_TEXTURE0);
      GLES20.glBindTexture(GL_TEXTURE_2D, mTextureDataHandle[0]);
      
      GLES20.glSetActiveTexture(GLES20.GL_TEXTURE1);
      GLES20.gBindTexture(GL_TEXTURE_2D, mTextureDataHandle[1]);
      
      //To draw with the right texture select which GL texture to point to (index):
      GLES20.glUniform1i(mtextureUniformHandle, index);
      drawStuff();
      

      You will be restricted here by the number of textures supported by your device – use

      IntBuffer max = IntBuffer.allocate(1);
      GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_IMAGE_UNITS, max);
      Log.d("tag","Texture units: " + max.get());
      
    3. Or some combination of the two options – i.e. save processor time from loading by having an array of pre-loaded textures, but you may need to bind at least some of them on the fly to avoid running out of available textures.

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

Sidebar

Related Questions

Good afternoon. I have been making a small openGL based app for android that
I'm making an universal openGL based app that should work on ipod/iphone 2G/3G/3GS/4 and
Hi I am working on OpenGL and making a wallpaper in android,I want to
I'm looking into learning OpenGL ES for making a little graphics engine in Android
So I'm making an Android 2.2 app that uses GLSurfaceView. My question is, since
I currently have an OpenGL view that takes up nearly my entire screen. On
I'm making something like an augmented reality app, in which I have an OpenGL
I am making a program with opengl es 2.0 for android. I was planning
I'm making a 3D game with OpenGL that basically has a world made entirely
I'm making an opengl game for iPhone. And I'm about to start adding sound

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.